@@ -28,14 +28,14 @@ discard block |
||
| 28 | 28 | if ($this->db === null) die('Error: No DB connection. (Stats)'); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function addLastStatsUpdate($type,$stats_date) { |
|
| 31 | + public function addLastStatsUpdate($type, $stats_date) { |
|
| 32 | 32 | $query = "DELETE FROM config WHERE name = :type; |
| 33 | 33 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
| 34 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
| 34 | + $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
| 35 | 35 | try { |
| 36 | 36 | $sth = $this->db->prepare($query); |
| 37 | 37 | $sth->execute($query_values); |
| 38 | - } catch(PDOException $e) { |
|
| 38 | + } catch (PDOException $e) { |
|
| 39 | 39 | return "error : ".$e->getMessage(); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | try { |
| 46 | 46 | $sth = $this->db->prepare($query); |
| 47 | 47 | $sth->execute(array(':type' => $type)); |
| 48 | - } catch(PDOException $e) { |
|
| 48 | + } catch (PDOException $e) { |
|
| 49 | 49 | echo "error : ".$e->getMessage(); |
| 50 | 50 | } |
| 51 | 51 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | try { |
| 67 | 67 | $sth = $this->db->prepare($query); |
| 68 | 68 | $sth->execute(array(':filter_name' => $filter_name)); |
| 69 | - } catch(PDOException $e) { |
|
| 69 | + } catch (PDOException $e) { |
|
| 70 | 70 | return "error : ".$e->getMessage(); |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | try { |
| 80 | 80 | $sth = $this->db->prepare($query); |
| 81 | 81 | $sth->execute(); |
| 82 | - } catch(PDOException $e) { |
|
| 82 | + } catch (PDOException $e) { |
|
| 83 | 83 | return "error : ".$e->getMessage(); |
| 84 | 84 | } |
| 85 | 85 | $query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
| 86 | 86 | try { |
| 87 | 87 | $sth = $this->db->prepare($query); |
| 88 | 88 | $sth->execute(array(':filter_name' => $filter_name)); |
| 89 | - } catch(PDOException $e) { |
|
| 89 | + } catch (PDOException $e) { |
|
| 90 | 90 | return "error : ".$e->getMessage(); |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -98,77 +98,77 @@ discard block |
||
| 98 | 98 | try { |
| 99 | 99 | $sth = $this->db->prepare($query); |
| 100 | 100 | $sth->execute(array(':filter_name' => $filter_name)); |
| 101 | - } catch(PDOException $e) { |
|
| 101 | + } catch (PDOException $e) { |
|
| 102 | 102 | echo "error : ".$e->getMessage(); |
| 103 | 103 | } |
| 104 | 104 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 105 | 105 | if (empty($all)) { |
| 106 | 106 | $filters = array(); |
| 107 | 107 | if ($filter_name != '') { |
| 108 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 108 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 109 | 109 | } |
| 110 | 110 | $Spotter = new Spotter($this->db); |
| 111 | - $all = $Spotter->getAllAirlineNames('',NULL,$filters); |
|
| 111 | + $all = $Spotter->getAllAirlineNames('', NULL, $filters); |
|
| 112 | 112 | } |
| 113 | 113 | return $all; |
| 114 | 114 | } |
| 115 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
| 115 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
| 116 | 116 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 117 | 117 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
| 118 | 118 | try { |
| 119 | 119 | $sth = $this->db->prepare($query); |
| 120 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 121 | - } catch(PDOException $e) { |
|
| 120 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 121 | + } catch (PDOException $e) { |
|
| 122 | 122 | echo "error : ".$e->getMessage(); |
| 123 | 123 | } |
| 124 | 124 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 125 | 125 | return $all; |
| 126 | 126 | } |
| 127 | - public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
| 127 | + public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
|
| 128 | 128 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 129 | 129 | $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"; |
| 130 | 130 | try { |
| 131 | 131 | $sth = $this->db->prepare($query); |
| 132 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 133 | - } catch(PDOException $e) { |
|
| 132 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 133 | + } catch (PDOException $e) { |
|
| 134 | 134 | echo "error : ".$e->getMessage(); |
| 135 | 135 | } |
| 136 | 136 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 137 | 137 | return $all; |
| 138 | 138 | } |
| 139 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
| 139 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
| 140 | 140 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 141 | 141 | $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"; |
| 142 | 142 | try { |
| 143 | 143 | $sth = $this->db->prepare($query); |
| 144 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 145 | - } catch(PDOException $e) { |
|
| 144 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 145 | + } catch (PDOException $e) { |
|
| 146 | 146 | echo "error : ".$e->getMessage(); |
| 147 | 147 | } |
| 148 | 148 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 149 | 149 | return $all; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
|
| 152 | + public function getAllOwnerNames($stats_airline = '', $filter_name = '') { |
|
| 153 | 153 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 154 | 154 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
| 155 | 155 | try { |
| 156 | 156 | $sth = $this->db->prepare($query); |
| 157 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 158 | - } catch(PDOException $e) { |
|
| 157 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 158 | + } catch (PDOException $e) { |
|
| 159 | 159 | echo "error : ".$e->getMessage(); |
| 160 | 160 | } |
| 161 | 161 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 162 | 162 | return $all; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
|
| 165 | + public function getAllPilotNames($stats_airline = '', $filter_name = '') { |
|
| 166 | 166 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 167 | 167 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
| 168 | 168 | try { |
| 169 | 169 | $sth = $this->db->prepare($query); |
| 170 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 171 | - } catch(PDOException $e) { |
|
| 170 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 171 | + } catch (PDOException $e) { |
|
| 172 | 172 | echo "error : ".$e->getMessage(); |
| 173 | 173 | } |
| 174 | 174 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -176,23 +176,23 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | |
| 179 | - public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
| 179 | + public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 180 | 180 | global $globalStatsFilters; |
| 181 | 181 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 182 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 182 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 183 | 183 | $Spotter = new Spotter($this->db); |
| 184 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 184 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 185 | 185 | $alliance_airlines = array(); |
| 186 | 186 | foreach ($airlines as $airline) { |
| 187 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 187 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 188 | 188 | } |
| 189 | 189 | if ($year == '' && $month == '') { |
| 190 | - 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 aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 191 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 190 | + 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 aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 191 | + else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 192 | 192 | try { |
| 193 | 193 | $sth = $this->db->prepare($query); |
| 194 | 194 | $sth->execute(array(':filter_name' => $filter_name)); |
| 195 | - } catch(PDOException $e) { |
|
| 195 | + } catch (PDOException $e) { |
|
| 196 | 196 | echo "error : ".$e->getMessage(); |
| 197 | 197 | } |
| 198 | 198 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -203,29 +203,29 @@ discard block |
||
| 203 | 203 | else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
| 204 | 204 | try { |
| 205 | 205 | $sth = $this->db->prepare($query); |
| 206 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 207 | - } catch(PDOException $e) { |
|
| 206 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 207 | + } catch (PDOException $e) { |
|
| 208 | 208 | echo "error : ".$e->getMessage(); |
| 209 | 209 | } |
| 210 | 210 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 211 | 211 | } else $all = array(); |
| 212 | 212 | } |
| 213 | 213 | if (empty($all)) { |
| 214 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 215 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 214 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 215 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 216 | 216 | } else { |
| 217 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 217 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 218 | 218 | } |
| 219 | 219 | if ($filter_name != '') { |
| 220 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 220 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 221 | 221 | } |
| 222 | 222 | $Spotter = new Spotter($this->db); |
| 223 | 223 | //$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
| 224 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
| 224 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
| 225 | 225 | } |
| 226 | 226 | return $all; |
| 227 | 227 | } |
| 228 | - public function countAllMarineTypes($limit = true, $filter_name = '',$year = '', $month = '') { |
|
| 228 | + public function countAllMarineTypes($limit = true, $filter_name = '', $year = '', $month = '') { |
|
| 229 | 229 | global $globalStatsFilters; |
| 230 | 230 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 231 | 231 | if ($year == '' && $month == '') { |
@@ -234,23 +234,23 @@ discard block |
||
| 234 | 234 | try { |
| 235 | 235 | $sth = $this->db->prepare($query); |
| 236 | 236 | $sth->execute(array(':filter_name' => $filter_name)); |
| 237 | - } catch(PDOException $e) { |
|
| 237 | + } catch (PDOException $e) { |
|
| 238 | 238 | echo "error : ".$e->getMessage(); |
| 239 | 239 | } |
| 240 | 240 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 241 | 241 | } else $all = array(); |
| 242 | 242 | if (empty($all)) { |
| 243 | - $filters = array('year' => $year,'month' => $month); |
|
| 243 | + $filters = array('year' => $year, 'month' => $month); |
|
| 244 | 244 | if ($filter_name != '') { |
| 245 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 245 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 246 | 246 | } |
| 247 | 247 | $Marine = new Marine($this->db); |
| 248 | 248 | //$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
| 249 | - $all = $Marine->countAllMarineTypes($limit,0,'',$filters); |
|
| 249 | + $all = $Marine->countAllMarineTypes($limit, 0, '', $filters); |
|
| 250 | 250 | } |
| 251 | 251 | return $all; |
| 252 | 252 | } |
| 253 | - public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
|
| 253 | + public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
|
| 254 | 254 | global $globalStatsFilters; |
| 255 | 255 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 256 | 256 | if ($year == '' && $month == '') { |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | try { |
| 260 | 260 | $sth = $this->db->prepare($query); |
| 261 | 261 | $sth->execute(array(':filter_name' => $filter_name)); |
| 262 | - } catch(PDOException $e) { |
|
| 262 | + } catch (PDOException $e) { |
|
| 263 | 263 | echo "error : ".$e->getMessage(); |
| 264 | 264 | } |
| 265 | 265 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -267,32 +267,32 @@ discard block |
||
| 267 | 267 | if (empty($all)) { |
| 268 | 268 | $Spotter = new Spotter($this->db); |
| 269 | 269 | $filters = array(); |
| 270 | - $filters = array('year' => $year,'month' => $month); |
|
| 270 | + $filters = array('year' => $year, 'month' => $month); |
|
| 271 | 271 | if ($filter_name != '') { |
| 272 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 272 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 273 | 273 | } |
| 274 | 274 | //$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
| 275 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
| 275 | + $all = $Spotter->countAllAirlineCountries($limit, $filters); |
|
| 276 | 276 | } |
| 277 | 277 | return $all; |
| 278 | 278 | } |
| 279 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
| 279 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 280 | 280 | global $globalStatsFilters; |
| 281 | 281 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 282 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 282 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 283 | 283 | $Spotter = new Spotter($this->db); |
| 284 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 284 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 285 | 285 | $alliance_airlines = array(); |
| 286 | 286 | foreach ($airlines as $airline) { |
| 287 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 287 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 288 | 288 | } |
| 289 | 289 | if ($year == '' && $month == '') { |
| 290 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 291 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 290 | + if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 291 | + else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 292 | 292 | try { |
| 293 | 293 | $sth = $this->db->prepare($query); |
| 294 | 294 | $sth->execute(array(':filter_name' => $filter_name)); |
| 295 | - } catch(PDOException $e) { |
|
| 295 | + } catch (PDOException $e) { |
|
| 296 | 296 | echo "error : ".$e->getMessage(); |
| 297 | 297 | } |
| 298 | 298 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -303,21 +303,21 @@ discard block |
||
| 303 | 303 | 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"; |
| 304 | 304 | try { |
| 305 | 305 | $sth = $this->db->prepare($query); |
| 306 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 307 | - } catch(PDOException $e) { |
|
| 306 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 307 | + } catch (PDOException $e) { |
|
| 308 | 308 | echo "error : ".$e->getMessage(); |
| 309 | 309 | } |
| 310 | 310 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 311 | 311 | } else $all = array(); |
| 312 | 312 | } |
| 313 | 313 | if (empty($all)) { |
| 314 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 315 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 314 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 315 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 316 | 316 | } else { |
| 317 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 317 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 318 | 318 | } |
| 319 | 319 | if ($filter_name != '') { |
| 320 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 320 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 321 | 321 | } |
| 322 | 322 | $Spotter = new Spotter($this->db); |
| 323 | 323 | //$all = $Spotter->countAllAircraftManufacturers($filters,$year,$month); |
@@ -326,23 +326,23 @@ discard block |
||
| 326 | 326 | return $all; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
| 329 | + public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 330 | 330 | global $globalStatsFilters; |
| 331 | 331 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 332 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 332 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 333 | 333 | $Spotter = new Spotter($this->db); |
| 334 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 334 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 335 | 335 | $alliance_airlines = array(); |
| 336 | 336 | foreach ($airlines as $airline) { |
| 337 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 337 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 338 | 338 | } |
| 339 | 339 | if ($year == '' && $month == '') { |
| 340 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 341 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 340 | + if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 341 | + else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 342 | 342 | try { |
| 343 | 343 | $sth = $this->db->prepare($query); |
| 344 | 344 | $sth->execute(array(':filter_name' => $filter_name)); |
| 345 | - } catch(PDOException $e) { |
|
| 345 | + } catch (PDOException $e) { |
|
| 346 | 346 | echo "error : ".$e->getMessage(); |
| 347 | 347 | } |
| 348 | 348 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -353,61 +353,61 @@ discard block |
||
| 353 | 353 | else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
| 354 | 354 | try { |
| 355 | 355 | $sth = $this->db->prepare($query); |
| 356 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 357 | - } catch(PDOException $e) { |
|
| 356 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 357 | + } catch (PDOException $e) { |
|
| 358 | 358 | echo "error : ".$e->getMessage(); |
| 359 | 359 | } |
| 360 | 360 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 361 | 361 | } else $all = array(); |
| 362 | 362 | } |
| 363 | 363 | if (empty($all)) { |
| 364 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 365 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 364 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 365 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 366 | 366 | } else { |
| 367 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 367 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 368 | 368 | } |
| 369 | 369 | if ($filter_name != '') { |
| 370 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 370 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 371 | 371 | } |
| 372 | 372 | $Spotter = new Spotter($this->db); |
| 373 | 373 | //$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
| 374 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
| 374 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
| 375 | 375 | } |
| 376 | 376 | return $all; |
| 377 | 377 | } |
| 378 | 378 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
| 379 | 379 | global $globalStatsFilters; |
| 380 | 380 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 381 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 381 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 382 | 382 | $Spotter = new Spotter($this->db); |
| 383 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 383 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 384 | 384 | $alliance_airlines = array(); |
| 385 | 385 | foreach ($airlines as $airline) { |
| 386 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 386 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 387 | 387 | } |
| 388 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 389 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 388 | + if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 389 | + else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 390 | 390 | $query_values = array(':filter_name' => $filter_name); |
| 391 | 391 | } else { |
| 392 | 392 | if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
| 393 | 393 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
| 394 | - $query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 394 | + $query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 395 | 395 | } |
| 396 | 396 | try { |
| 397 | 397 | $sth = $this->db->prepare($query); |
| 398 | 398 | $sth->execute($query_values); |
| 399 | - } catch(PDOException $e) { |
|
| 399 | + } catch (PDOException $e) { |
|
| 400 | 400 | echo "error : ".$e->getMessage(); |
| 401 | 401 | } |
| 402 | 402 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 403 | 403 | if (empty($all)) { |
| 404 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 405 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 404 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 405 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 406 | 406 | } else { |
| 407 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 407 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 408 | 408 | } |
| 409 | 409 | if ($filter_name != '') { |
| 410 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 410 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 411 | 411 | } |
| 412 | 412 | $Spotter = new Spotter($this->db); |
| 413 | 413 | //$all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | return $all; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
|
| 419 | + public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') { |
|
| 420 | 420 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
| 421 | 421 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 422 | 422 | if ($year == '' && $month == '') { |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | if (isset($forsource)) { |
| 426 | 426 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
| 427 | 427 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
| 428 | - $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
|
| 428 | + $query_values = array(':filter_name' => $filter_name, ':forsource' => $forsource); |
|
| 429 | 429 | } else { |
| 430 | 430 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
| 431 | 431 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | try { |
| 435 | 435 | $sth = $this->db->prepare($query); |
| 436 | 436 | $sth->execute($query_values); |
| 437 | - } catch(PDOException $e) { |
|
| 437 | + } catch (PDOException $e) { |
|
| 438 | 438 | echo "error : ".$e->getMessage(); |
| 439 | 439 | } |
| 440 | 440 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -442,32 +442,32 @@ discard block |
||
| 442 | 442 | if (empty($all)) { |
| 443 | 443 | $Spotter = new Spotter($this->db); |
| 444 | 444 | $filters = array(); |
| 445 | - $filters = array('year' => $year,'month' => $month); |
|
| 445 | + $filters = array('year' => $year, 'month' => $month); |
|
| 446 | 446 | if ($filter_name != '') { |
| 447 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 447 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 448 | 448 | } |
| 449 | 449 | //$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
| 450 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
| 450 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
|
| 451 | 451 | } |
| 452 | 452 | return $all; |
| 453 | 453 | } |
| 454 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 454 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 455 | 455 | global $globalStatsFilters; |
| 456 | 456 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 457 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 457 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 458 | 458 | $Spotter = new Spotter($this->db); |
| 459 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 459 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 460 | 460 | $alliance_airlines = array(); |
| 461 | 461 | foreach ($airlines as $airline) { |
| 462 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 462 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 463 | 463 | } |
| 464 | 464 | if ($year == '' && $month == '') { |
| 465 | - 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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 466 | - 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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 465 | + 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 IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 466 | + 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 IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 467 | 467 | try { |
| 468 | 468 | $sth = $this->db->prepare($query); |
| 469 | 469 | $sth->execute(array(':filter_name' => $filter_name)); |
| 470 | - } catch(PDOException $e) { |
|
| 470 | + } catch (PDOException $e) { |
|
| 471 | 471 | echo "error : ".$e->getMessage(); |
| 472 | 472 | } |
| 473 | 473 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -478,45 +478,45 @@ discard block |
||
| 478 | 478 | 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"; |
| 479 | 479 | try { |
| 480 | 480 | $sth = $this->db->prepare($query); |
| 481 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 482 | - } catch(PDOException $e) { |
|
| 481 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 482 | + } catch (PDOException $e) { |
|
| 483 | 483 | echo "error : ".$e->getMessage(); |
| 484 | 484 | } |
| 485 | 485 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 486 | 486 | } else $all = array(); |
| 487 | 487 | } |
| 488 | 488 | if (empty($all)) { |
| 489 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 490 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 489 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 490 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 491 | 491 | } else { |
| 492 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 492 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 493 | 493 | } |
| 494 | 494 | if ($filter_name != '') { |
| 495 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 495 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 496 | 496 | } |
| 497 | 497 | $Spotter = new Spotter($this->db); |
| 498 | 498 | //$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
| 499 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
| 499 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
| 500 | 500 | } |
| 501 | 501 | return $all; |
| 502 | 502 | } |
| 503 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 503 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 504 | 504 | global $globalStatsFilters; |
| 505 | 505 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 506 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 506 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 507 | 507 | $Spotter = new Spotter($this->db); |
| 508 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 508 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 509 | 509 | $alliance_airlines = array(); |
| 510 | 510 | foreach ($airlines as $airline) { |
| 511 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 511 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 512 | 512 | } |
| 513 | 513 | if ($year == '' && $month == '') { |
| 514 | - 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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 515 | - 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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 514 | + 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 IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 515 | + 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 IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 516 | 516 | try { |
| 517 | 517 | $sth = $this->db->prepare($query); |
| 518 | 518 | $sth->execute(array(':filter_name' => $filter_name)); |
| 519 | - } catch(PDOException $e) { |
|
| 519 | + } catch (PDOException $e) { |
|
| 520 | 520 | echo "error : ".$e->getMessage(); |
| 521 | 521 | } |
| 522 | 522 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -527,46 +527,46 @@ discard block |
||
| 527 | 527 | 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"; |
| 528 | 528 | try { |
| 529 | 529 | $sth = $this->db->prepare($query); |
| 530 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 531 | - } catch(PDOException $e) { |
|
| 530 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 531 | + } catch (PDOException $e) { |
|
| 532 | 532 | echo "error : ".$e->getMessage(); |
| 533 | 533 | } |
| 534 | 534 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 535 | 535 | } else $all = array(); |
| 536 | 536 | } |
| 537 | 537 | if (empty($all)) { |
| 538 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 539 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 538 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 539 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 540 | 540 | } else { |
| 541 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 541 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 542 | 542 | } |
| 543 | 543 | if ($filter_name != '') { |
| 544 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 544 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 545 | 545 | } |
| 546 | 546 | $Spotter = new Spotter($this->db); |
| 547 | 547 | //$all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month); |
| 548 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
| 548 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
| 549 | 549 | } |
| 550 | 550 | return $all; |
| 551 | 551 | } |
| 552 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 552 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 553 | 553 | $Connection = new Connection($this->db); |
| 554 | 554 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 555 | 555 | if ($Connection->tableExists('countries')) { |
| 556 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 556 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 557 | 557 | $Spotter = new Spotter($this->db); |
| 558 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 558 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 559 | 559 | if ($year == '' && $month == '') { |
| 560 | 560 | $alliance_airlines = array(); |
| 561 | 561 | foreach ($airlines as $airline) { |
| 562 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 562 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 563 | 563 | } |
| 564 | - 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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 565 | - 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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 564 | + 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 IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 565 | + 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 IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 566 | 566 | try { |
| 567 | 567 | $sth = $this->db->prepare($query); |
| 568 | 568 | $sth->execute(array(':filter_name' => $filter_name)); |
| 569 | - } catch(PDOException $e) { |
|
| 569 | + } catch (PDOException $e) { |
|
| 570 | 570 | echo "error : ".$e->getMessage(); |
| 571 | 571 | } |
| 572 | 572 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -578,8 +578,8 @@ discard block |
||
| 578 | 578 | 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"; |
| 579 | 579 | try { |
| 580 | 580 | $sth = $this->db->prepare($query); |
| 581 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 582 | - } catch(PDOException $e) { |
|
| 581 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 582 | + } catch (PDOException $e) { |
|
| 583 | 583 | echo "error : ".$e->getMessage(); |
| 584 | 584 | } |
| 585 | 585 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | return $Spotter->countAllFlightOverCountries($limit); |
| 591 | 591 | } else return array(); |
| 592 | 592 | } |
| 593 | - public function countAllMarineOverCountries($limit = true, $filter_name = '',$year = '',$month = '') { |
|
| 593 | + public function countAllMarineOverCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
|
| 594 | 594 | $Connection = new Connection($this->db); |
| 595 | 595 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 596 | 596 | if ($Connection->tableExists('countries')) { |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | try { |
| 602 | 602 | $sth = $this->db->prepare($query); |
| 603 | 603 | $sth->execute(array(':filter_name' => $filter_name)); |
| 604 | - } catch(PDOException $e) { |
|
| 604 | + } catch (PDOException $e) { |
|
| 605 | 605 | echo "error : ".$e->getMessage(); |
| 606 | 606 | } |
| 607 | 607 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -609,15 +609,15 @@ discard block |
||
| 609 | 609 | if (empty($all)) { |
| 610 | 610 | $filters = array(); |
| 611 | 611 | if ($filter_name != '') { |
| 612 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 612 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 613 | 613 | } |
| 614 | 614 | $Marine = new Marine($this->db); |
| 615 | - $all = $Marine->countAllMarineOverCountries($limit,0,'',$filters); |
|
| 615 | + $all = $Marine->countAllMarineOverCountries($limit, 0, '', $filters); |
|
| 616 | 616 | } |
| 617 | 617 | return $all; |
| 618 | 618 | } else return array(); |
| 619 | 619 | } |
| 620 | - public function countAllTrackerOverCountries($limit = true, $filter_name = '',$year = '',$month = '') { |
|
| 620 | + public function countAllTrackerOverCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
|
| 621 | 621 | global $globalStatsFilters; |
| 622 | 622 | $Connection = new Connection($this->db); |
| 623 | 623 | if ($filter_name == '') $filter_name = $this->filter_name; |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | try { |
| 630 | 630 | $sth = $this->db->prepare($query); |
| 631 | 631 | $sth->execute(array(':filter_name' => $filter_name)); |
| 632 | - } catch(PDOException $e) { |
|
| 632 | + } catch (PDOException $e) { |
|
| 633 | 633 | echo "error : ".$e->getMessage(); |
| 634 | 634 | } |
| 635 | 635 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -638,15 +638,15 @@ discard block |
||
| 638 | 638 | if (empty($all)) { |
| 639 | 639 | $filters = array(); |
| 640 | 640 | if ($filter_name != '') { |
| 641 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 641 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 642 | 642 | } |
| 643 | 643 | $Tracker = new Tracker($this->db); |
| 644 | - $all = $Tracker->countAllTrackerOverCountries($limit,0,'',$filters); |
|
| 644 | + $all = $Tracker->countAllTrackerOverCountries($limit, 0, '', $filters); |
|
| 645 | 645 | } |
| 646 | 646 | return $all; |
| 647 | 647 | } else return array(); |
| 648 | 648 | } |
| 649 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
|
| 649 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 650 | 650 | global $globalStatsFilters; |
| 651 | 651 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 652 | 652 | if ($year == '' && $month == '') { |
@@ -654,41 +654,41 @@ discard block |
||
| 654 | 654 | 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"; |
| 655 | 655 | try { |
| 656 | 656 | $sth = $this->db->prepare($query); |
| 657 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 658 | - } catch(PDOException $e) { |
|
| 657 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 658 | + } catch (PDOException $e) { |
|
| 659 | 659 | echo "error : ".$e->getMessage(); |
| 660 | 660 | } |
| 661 | 661 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 662 | 662 | } else $all = array(); |
| 663 | 663 | if (empty($all)) { |
| 664 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 664 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 665 | 665 | if ($filter_name != '') { |
| 666 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 666 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 667 | 667 | } |
| 668 | 668 | $Spotter = new Spotter($this->db); |
| 669 | 669 | //$all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month); |
| 670 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
| 670 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
| 671 | 671 | } |
| 672 | 672 | return $all; |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
| 675 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 676 | 676 | global $globalStatsFilters; |
| 677 | 677 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 678 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 678 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 679 | 679 | $Spotter = new Spotter($this->db); |
| 680 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 680 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 681 | 681 | if ($year == '' && $month == '') { |
| 682 | 682 | $alliance_airlines = array(); |
| 683 | 683 | foreach ($airlines as $airline) { |
| 684 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 684 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 685 | 685 | } |
| 686 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 687 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 686 | + if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 687 | + else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 688 | 688 | try { |
| 689 | 689 | $sth = $this->db->prepare($query); |
| 690 | 690 | $sth->execute(array(':filter_name' => $filter_name)); |
| 691 | - } catch(PDOException $e) { |
|
| 691 | + } catch (PDOException $e) { |
|
| 692 | 692 | echo "error : ".$e->getMessage(); |
| 693 | 693 | } |
| 694 | 694 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -699,45 +699,45 @@ discard block |
||
| 699 | 699 | 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"; |
| 700 | 700 | try { |
| 701 | 701 | $sth = $this->db->prepare($query); |
| 702 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 703 | - } catch(PDOException $e) { |
|
| 702 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 703 | + } catch (PDOException $e) { |
|
| 704 | 704 | echo "error : ".$e->getMessage(); |
| 705 | 705 | } |
| 706 | 706 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 707 | 707 | } else $all = array(); |
| 708 | 708 | } |
| 709 | 709 | if (empty($all)) { |
| 710 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 711 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 710 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 711 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 712 | 712 | } else { |
| 713 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 713 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 714 | 714 | } |
| 715 | 715 | if ($filter_name != '') { |
| 716 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 716 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 717 | 717 | } |
| 718 | 718 | $Spotter = new Spotter($this->db); |
| 719 | 719 | //$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
| 720 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
| 720 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
| 721 | 721 | } |
| 722 | 722 | return $all; |
| 723 | 723 | } |
| 724 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 724 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 725 | 725 | global $globalStatsFilters; |
| 726 | 726 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 727 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 727 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 728 | 728 | $Spotter = new Spotter($this->db); |
| 729 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 729 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 730 | 730 | if ($year == '' && $month == '') { |
| 731 | 731 | $alliance_airlines = array(); |
| 732 | 732 | foreach ($airlines as $airline) { |
| 733 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 733 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 734 | 734 | } |
| 735 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 736 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 735 | + if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 736 | + else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 737 | 737 | try { |
| 738 | 738 | $sth = $this->db->prepare($query); |
| 739 | 739 | $sth->execute(array(':filter_name' => $filter_name)); |
| 740 | - } catch(PDOException $e) { |
|
| 740 | + } catch (PDOException $e) { |
|
| 741 | 741 | echo "error : ".$e->getMessage(); |
| 742 | 742 | } |
| 743 | 743 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -748,27 +748,27 @@ discard block |
||
| 748 | 748 | else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
| 749 | 749 | try { |
| 750 | 750 | $sth = $this->db->prepare($query); |
| 751 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 752 | - } catch(PDOException $e) { |
|
| 751 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 752 | + } catch (PDOException $e) { |
|
| 753 | 753 | echo "error : ".$e->getMessage(); |
| 754 | 754 | } |
| 755 | 755 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 756 | 756 | } else $all = array(); |
| 757 | 757 | } |
| 758 | 758 | if (empty($all)) { |
| 759 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 760 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 759 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 760 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 761 | 761 | } else { |
| 762 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 762 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 763 | 763 | } |
| 764 | 764 | if ($filter_name != '') { |
| 765 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 765 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 766 | 766 | } |
| 767 | 767 | $Spotter = new Spotter($this->db); |
| 768 | 768 | // $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
| 769 | 769 | // $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
| 770 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
| 771 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
| 770 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
| 771 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
| 772 | 772 | $all = array(); |
| 773 | 773 | foreach ($pall as $value) { |
| 774 | 774 | $icao = $value['airport_departure_icao']; |
@@ -784,27 +784,27 @@ discard block |
||
| 784 | 784 | foreach ($all as $key => $row) { |
| 785 | 785 | $count[$key] = $row['airport_departure_icao_count']; |
| 786 | 786 | } |
| 787 | - array_multisort($count,SORT_DESC,$all); |
|
| 787 | + array_multisort($count, SORT_DESC, $all); |
|
| 788 | 788 | } |
| 789 | 789 | return $all; |
| 790 | 790 | } |
| 791 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 791 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 792 | 792 | global $globalStatsFilters; |
| 793 | 793 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 794 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 794 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 795 | 795 | $Spotter = new Spotter($this->db); |
| 796 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 796 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 797 | 797 | if ($year == '' && $month == '') { |
| 798 | 798 | $alliance_airlines = array(); |
| 799 | 799 | foreach ($airlines as $airline) { |
| 800 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 800 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 801 | 801 | } |
| 802 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 803 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 802 | + if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 803 | + else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 804 | 804 | try { |
| 805 | 805 | $sth = $this->db->prepare($query); |
| 806 | 806 | $sth->execute(array(':filter_name' => $filter_name)); |
| 807 | - } catch(PDOException $e) { |
|
| 807 | + } catch (PDOException $e) { |
|
| 808 | 808 | echo "error : ".$e->getMessage(); |
| 809 | 809 | } |
| 810 | 810 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -815,27 +815,27 @@ discard block |
||
| 815 | 815 | else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
| 816 | 816 | try { |
| 817 | 817 | $sth = $this->db->prepare($query); |
| 818 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 819 | - } catch(PDOException $e) { |
|
| 818 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 819 | + } catch (PDOException $e) { |
|
| 820 | 820 | echo "error : ".$e->getMessage(); |
| 821 | 821 | } |
| 822 | 822 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 823 | 823 | } else $all = array(); |
| 824 | 824 | } |
| 825 | 825 | if (empty($all)) { |
| 826 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 827 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 826 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 827 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 828 | 828 | } else { |
| 829 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 829 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 830 | 830 | } |
| 831 | 831 | if ($filter_name != '') { |
| 832 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 832 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 833 | 833 | } |
| 834 | 834 | $Spotter = new Spotter($this->db); |
| 835 | 835 | // $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month); |
| 836 | 836 | // $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
| 837 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
| 838 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
| 837 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
| 838 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
| 839 | 839 | $all = array(); |
| 840 | 840 | foreach ($pall as $value) { |
| 841 | 841 | $icao = $value['airport_arrival_icao']; |
@@ -851,26 +851,26 @@ discard block |
||
| 851 | 851 | foreach ($all as $key => $row) { |
| 852 | 852 | $count[$key] = $row['airport_arrival_icao_count']; |
| 853 | 853 | } |
| 854 | - array_multisort($count,SORT_DESC,$all); |
|
| 854 | + array_multisort($count, SORT_DESC, $all); |
|
| 855 | 855 | } |
| 856 | 856 | return $all; |
| 857 | 857 | } |
| 858 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
| 858 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
| 859 | 859 | global $globalDBdriver, $globalStatsFilters; |
| 860 | 860 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 861 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 861 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 862 | 862 | $Spotter = new Spotter($this->db); |
| 863 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 863 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 864 | 864 | $alliance_airlines = array(); |
| 865 | 865 | foreach ($airlines as $airline) { |
| 866 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 866 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 867 | 867 | } |
| 868 | 868 | if ($globalDBdriver == 'mysql') { |
| 869 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 870 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 869 | + if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 870 | + else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 871 | 871 | } else { |
| 872 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 873 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 872 | + if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(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 IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 873 | + else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 874 | 874 | } |
| 875 | 875 | $query_data = array(':filter_name' => $filter_name); |
| 876 | 876 | } else { |
@@ -881,23 +881,23 @@ discard block |
||
| 881 | 881 | 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"; |
| 882 | 882 | 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"; |
| 883 | 883 | } |
| 884 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 884 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 885 | 885 | } |
| 886 | 886 | try { |
| 887 | 887 | $sth = $this->db->prepare($query); |
| 888 | 888 | $sth->execute($query_data); |
| 889 | - } catch(PDOException $e) { |
|
| 889 | + } catch (PDOException $e) { |
|
| 890 | 890 | echo "error : ".$e->getMessage(); |
| 891 | 891 | } |
| 892 | 892 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 893 | 893 | if (empty($all)) { |
| 894 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 895 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 894 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 895 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 896 | 896 | } else { |
| 897 | 897 | $filters = array('airlines' => array($stats_airline)); |
| 898 | 898 | } |
| 899 | 899 | if ($filter_name != '') { |
| 900 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 900 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 901 | 901 | } |
| 902 | 902 | $Spotter = new Spotter($this->db); |
| 903 | 903 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | return $all; |
| 906 | 906 | } |
| 907 | 907 | |
| 908 | - public function countAllMarineMonthsLastYear($limit = true,$filter_name = '') { |
|
| 908 | + public function countAllMarineMonthsLastYear($limit = true, $filter_name = '') { |
|
| 909 | 909 | global $globalDBdriver, $globalStatsFilters; |
| 910 | 910 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 911 | 911 | if ($globalDBdriver == 'mysql') { |
@@ -919,14 +919,14 @@ discard block |
||
| 919 | 919 | try { |
| 920 | 920 | $sth = $this->db->prepare($query); |
| 921 | 921 | $sth->execute($query_data); |
| 922 | - } catch(PDOException $e) { |
|
| 922 | + } catch (PDOException $e) { |
|
| 923 | 923 | echo "error : ".$e->getMessage(); |
| 924 | 924 | } |
| 925 | 925 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 926 | 926 | if (empty($all)) { |
| 927 | 927 | $filters = array(); |
| 928 | 928 | if ($filter_name != '') { |
| 929 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 929 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 930 | 930 | } |
| 931 | 931 | $Marine = new Marine($this->db); |
| 932 | 932 | $all = $Marine->countAllMonthsLastYear($filters); |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | return $all; |
| 935 | 935 | } |
| 936 | 936 | |
| 937 | - public function countAllTrackerMonthsLastYear($limit = true,$filter_name = '') { |
|
| 937 | + public function countAllTrackerMonthsLastYear($limit = true, $filter_name = '') { |
|
| 938 | 938 | global $globalDBdriver, $globalStatsFilters; |
| 939 | 939 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 940 | 940 | if ($globalDBdriver == 'mysql') { |
@@ -948,14 +948,14 @@ discard block |
||
| 948 | 948 | try { |
| 949 | 949 | $sth = $this->db->prepare($query); |
| 950 | 950 | $sth->execute($query_data); |
| 951 | - } catch(PDOException $e) { |
|
| 951 | + } catch (PDOException $e) { |
|
| 952 | 952 | echo "error : ".$e->getMessage(); |
| 953 | 953 | } |
| 954 | 954 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 955 | 955 | if (empty($all)) { |
| 956 | 956 | $filters = array(); |
| 957 | 957 | if ($filter_name != '') { |
| 958 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 958 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 959 | 959 | } |
| 960 | 960 | $Tracker = new Tracker($this->db); |
| 961 | 961 | $all = $Tracker->countAllMonthsLastYear($filters); |
@@ -963,37 +963,37 @@ discard block |
||
| 963 | 963 | return $all; |
| 964 | 964 | } |
| 965 | 965 | |
| 966 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
| 966 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
| 967 | 967 | global $globalStatsFilters; |
| 968 | 968 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 969 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 969 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 970 | 970 | $Spotter = new Spotter($this->db); |
| 971 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 971 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 972 | 972 | $alliance_airlines = array(); |
| 973 | 973 | foreach ($airlines as $airline) { |
| 974 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 974 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 975 | 975 | } |
| 976 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 976 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 977 | 977 | $query_data = array(':filter_name' => $filter_name); |
| 978 | 978 | } else { |
| 979 | 979 | $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"; |
| 980 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 980 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 981 | 981 | } |
| 982 | 982 | try { |
| 983 | 983 | $sth = $this->db->prepare($query); |
| 984 | 984 | $sth->execute($query_data); |
| 985 | - } catch(PDOException $e) { |
|
| 985 | + } catch (PDOException $e) { |
|
| 986 | 986 | echo "error : ".$e->getMessage(); |
| 987 | 987 | } |
| 988 | 988 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 989 | 989 | if (empty($all)) { |
| 990 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 991 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 990 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 991 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 992 | 992 | } else { |
| 993 | 993 | $filters = array('airlines' => array($stats_airline)); |
| 994 | 994 | } |
| 995 | 995 | if ($filter_name != '') { |
| 996 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 996 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 997 | 997 | } |
| 998 | 998 | $Spotter = new Spotter($this->db); |
| 999 | 999 | $all = $Spotter->countAllDatesLastMonth($filters); |
@@ -1008,14 +1008,14 @@ discard block |
||
| 1008 | 1008 | try { |
| 1009 | 1009 | $sth = $this->db->prepare($query); |
| 1010 | 1010 | $sth->execute($query_data); |
| 1011 | - } catch(PDOException $e) { |
|
| 1011 | + } catch (PDOException $e) { |
|
| 1012 | 1012 | echo "error : ".$e->getMessage(); |
| 1013 | 1013 | } |
| 1014 | 1014 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1015 | 1015 | if (empty($all)) { |
| 1016 | 1016 | $filters = array(); |
| 1017 | 1017 | if ($filter_name != '') { |
| 1018 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1018 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1019 | 1019 | } |
| 1020 | 1020 | $Marine = new Marine($this->db); |
| 1021 | 1021 | $all = $Marine->countAllDatesLastMonth($filters); |
@@ -1030,34 +1030,34 @@ discard block |
||
| 1030 | 1030 | try { |
| 1031 | 1031 | $sth = $this->db->prepare($query); |
| 1032 | 1032 | $sth->execute($query_data); |
| 1033 | - } catch(PDOException $e) { |
|
| 1033 | + } catch (PDOException $e) { |
|
| 1034 | 1034 | echo "error : ".$e->getMessage(); |
| 1035 | 1035 | } |
| 1036 | 1036 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1037 | 1037 | if (empty($all)) { |
| 1038 | 1038 | $filters = array(); |
| 1039 | 1039 | if ($filter_name != '') { |
| 1040 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1040 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1041 | 1041 | } |
| 1042 | 1042 | $Tracker = new Tracker($this->db); |
| 1043 | 1043 | $all = $Tracker->countAllDatesLastMonth($filters); |
| 1044 | 1044 | } |
| 1045 | 1045 | return $all; |
| 1046 | 1046 | } |
| 1047 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
| 1047 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
| 1048 | 1048 | global $globalDBdriver, $globalStatsFilters; |
| 1049 | 1049 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1050 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1050 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1051 | 1051 | $Spotter = new Spotter($this->db); |
| 1052 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1052 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1053 | 1053 | $alliance_airlines = array(); |
| 1054 | 1054 | foreach ($airlines as $airline) { |
| 1055 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 1055 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 1056 | 1056 | } |
| 1057 | 1057 | if ($globalDBdriver == 'mysql') { |
| 1058 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1058 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1059 | 1059 | } else { |
| 1060 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1060 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1061 | 1061 | } |
| 1062 | 1062 | $query_data = array(':filter_name' => $filter_name); |
| 1063 | 1063 | } else { |
@@ -1066,23 +1066,23 @@ discard block |
||
| 1066 | 1066 | } else { |
| 1067 | 1067 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1068 | 1068 | } |
| 1069 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1069 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1070 | 1070 | } |
| 1071 | 1071 | try { |
| 1072 | 1072 | $sth = $this->db->prepare($query); |
| 1073 | 1073 | $sth->execute($query_data); |
| 1074 | - } catch(PDOException $e) { |
|
| 1074 | + } catch (PDOException $e) { |
|
| 1075 | 1075 | echo "error : ".$e->getMessage(); |
| 1076 | 1076 | } |
| 1077 | 1077 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1078 | 1078 | if (empty($all)) { |
| 1079 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1080 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1079 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1080 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1081 | 1081 | } else { |
| 1082 | 1082 | $filters = array('airlines' => array($stats_airline)); |
| 1083 | 1083 | } |
| 1084 | 1084 | if ($filter_name != '') { |
| 1085 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1085 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1086 | 1086 | } |
| 1087 | 1087 | $Spotter = new Spotter($this->db); |
| 1088 | 1088 | $all = $Spotter->countAllDatesLast7Days($filters); |
@@ -1101,14 +1101,14 @@ discard block |
||
| 1101 | 1101 | try { |
| 1102 | 1102 | $sth = $this->db->prepare($query); |
| 1103 | 1103 | $sth->execute($query_data); |
| 1104 | - } catch(PDOException $e) { |
|
| 1104 | + } catch (PDOException $e) { |
|
| 1105 | 1105 | echo "error : ".$e->getMessage(); |
| 1106 | 1106 | } |
| 1107 | 1107 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1108 | 1108 | if (empty($all)) { |
| 1109 | 1109 | $filters = array(); |
| 1110 | 1110 | if ($filter_name != '') { |
| 1111 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1111 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1112 | 1112 | } |
| 1113 | 1113 | $Marine = new Marine($this->db); |
| 1114 | 1114 | $all = $Marine->countAllDatesLast7Days($filters); |
@@ -1127,51 +1127,51 @@ discard block |
||
| 1127 | 1127 | try { |
| 1128 | 1128 | $sth = $this->db->prepare($query); |
| 1129 | 1129 | $sth->execute($query_data); |
| 1130 | - } catch(PDOException $e) { |
|
| 1130 | + } catch (PDOException $e) { |
|
| 1131 | 1131 | echo "error : ".$e->getMessage(); |
| 1132 | 1132 | } |
| 1133 | 1133 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1134 | 1134 | if (empty($all)) { |
| 1135 | 1135 | $filters = array(); |
| 1136 | 1136 | if ($filter_name != '') { |
| 1137 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1137 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1138 | 1138 | } |
| 1139 | 1139 | $Tracker = new Tracker($this->db); |
| 1140 | 1140 | $all = $Tracker->countAllDatesLast7Days($filters); |
| 1141 | 1141 | } |
| 1142 | 1142 | return $all; |
| 1143 | 1143 | } |
| 1144 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
| 1144 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
| 1145 | 1145 | global $globalStatsFilters; |
| 1146 | 1146 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1147 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1147 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1148 | 1148 | $Spotter = new Spotter($this->db); |
| 1149 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1149 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1150 | 1150 | $alliance_airlines = array(); |
| 1151 | 1151 | foreach ($airlines as $airline) { |
| 1152 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 1152 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 1153 | 1153 | } |
| 1154 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC"; |
|
| 1154 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC"; |
|
| 1155 | 1155 | $query_data = array(':filter_name' => $filter_name); |
| 1156 | 1156 | } else { |
| 1157 | 1157 | $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 ORDER BY date_count DESC"; |
| 1158 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1158 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1159 | 1159 | } |
| 1160 | 1160 | try { |
| 1161 | 1161 | $sth = $this->db->prepare($query); |
| 1162 | 1162 | $sth->execute($query_data); |
| 1163 | - } catch(PDOException $e) { |
|
| 1163 | + } catch (PDOException $e) { |
|
| 1164 | 1164 | echo "error : ".$e->getMessage(); |
| 1165 | 1165 | } |
| 1166 | 1166 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1167 | 1167 | if (empty($all)) { |
| 1168 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1169 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1168 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1169 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1170 | 1170 | } else { |
| 1171 | 1171 | $filters = array('airlines' => array($stats_airline)); |
| 1172 | 1172 | } |
| 1173 | 1173 | if ($filter_name != '') { |
| 1174 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1174 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1175 | 1175 | } |
| 1176 | 1176 | $Spotter = new Spotter($this->db); |
| 1177 | 1177 | $all = $Spotter->countAllDates($filters); |
@@ -1186,7 +1186,7 @@ discard block |
||
| 1186 | 1186 | try { |
| 1187 | 1187 | $sth = $this->db->prepare($query); |
| 1188 | 1188 | $sth->execute($query_data); |
| 1189 | - } catch(PDOException $e) { |
|
| 1189 | + } catch (PDOException $e) { |
|
| 1190 | 1190 | echo "error : ".$e->getMessage(); |
| 1191 | 1191 | } |
| 1192 | 1192 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1208,7 +1208,7 @@ discard block |
||
| 1208 | 1208 | try { |
| 1209 | 1209 | $sth = $this->db->prepare($query); |
| 1210 | 1210 | $sth->execute($query_data); |
| 1211 | - } catch(PDOException $e) { |
|
| 1211 | + } catch (PDOException $e) { |
|
| 1212 | 1212 | echo "error : ".$e->getMessage(); |
| 1213 | 1213 | } |
| 1214 | 1214 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1230,34 +1230,34 @@ discard block |
||
| 1230 | 1230 | try { |
| 1231 | 1231 | $sth = $this->db->prepare($query); |
| 1232 | 1232 | $sth->execute($query_data); |
| 1233 | - } catch(PDOException $e) { |
|
| 1233 | + } catch (PDOException $e) { |
|
| 1234 | 1234 | echo "error : ".$e->getMessage(); |
| 1235 | 1235 | } |
| 1236 | 1236 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1237 | 1237 | if (empty($all)) { |
| 1238 | 1238 | $filters = array(); |
| 1239 | 1239 | if ($filter_name != '') { |
| 1240 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1240 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1241 | 1241 | } |
| 1242 | 1242 | $Spotter = new Spotter($this->db); |
| 1243 | 1243 | $all = $Spotter->countAllDatesByAirlines($filters); |
| 1244 | 1244 | } |
| 1245 | 1245 | return $all; |
| 1246 | 1246 | } |
| 1247 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
| 1247 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
| 1248 | 1248 | global $globalStatsFilters, $globalDBdriver; |
| 1249 | 1249 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1250 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1250 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1251 | 1251 | $Spotter = new Spotter($this->db); |
| 1252 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1252 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1253 | 1253 | $alliance_airlines = array(); |
| 1254 | 1254 | foreach ($airlines as $airline) { |
| 1255 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 1255 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 1256 | 1256 | } |
| 1257 | 1257 | if ($globalDBdriver == 'mysql') { |
| 1258 | - $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
| 1258 | + $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
| 1259 | 1259 | } else { |
| 1260 | - $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
| 1260 | + $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
| 1261 | 1261 | } |
| 1262 | 1262 | $query_data = array(':filter_name' => $filter_name); |
| 1263 | 1263 | } else { |
@@ -1271,18 +1271,18 @@ discard block |
||
| 1271 | 1271 | try { |
| 1272 | 1272 | $sth = $this->db->prepare($query); |
| 1273 | 1273 | $sth->execute($query_data); |
| 1274 | - } catch(PDOException $e) { |
|
| 1274 | + } catch (PDOException $e) { |
|
| 1275 | 1275 | echo "error : ".$e->getMessage(); |
| 1276 | 1276 | } |
| 1277 | 1277 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1278 | 1278 | if (empty($all)) { |
| 1279 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1280 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1279 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1280 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1281 | 1281 | } else { |
| 1282 | 1282 | $filters = array('airlines' => array($stats_airline)); |
| 1283 | 1283 | } |
| 1284 | 1284 | if ($filter_name != '') { |
| 1285 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1285 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1286 | 1286 | } |
| 1287 | 1287 | $Spotter = new Spotter($this->db); |
| 1288 | 1288 | $all = $Spotter->countAllMonths($filters); |
@@ -1299,7 +1299,7 @@ discard block |
||
| 1299 | 1299 | try { |
| 1300 | 1300 | $sth = $this->db->prepare($query); |
| 1301 | 1301 | $sth->execute(); |
| 1302 | - } catch(PDOException $e) { |
|
| 1302 | + } catch (PDOException $e) { |
|
| 1303 | 1303 | echo "error : ".$e->getMessage(); |
| 1304 | 1304 | } |
| 1305 | 1305 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | try { |
| 1320 | 1320 | $sth = $this->db->prepare($query); |
| 1321 | 1321 | $sth->execute(); |
| 1322 | - } catch(PDOException $e) { |
|
| 1322 | + } catch (PDOException $e) { |
|
| 1323 | 1323 | echo "error : ".$e->getMessage(); |
| 1324 | 1324 | } |
| 1325 | 1325 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1336,32 +1336,32 @@ discard block |
||
| 1336 | 1336 | try { |
| 1337 | 1337 | $sth = $this->db->prepare($query); |
| 1338 | 1338 | $sth->execute(array(':filter_name' => $filter_name)); |
| 1339 | - } catch(PDOException $e) { |
|
| 1339 | + } catch (PDOException $e) { |
|
| 1340 | 1340 | echo "error : ".$e->getMessage(); |
| 1341 | 1341 | } |
| 1342 | 1342 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1343 | 1343 | if (empty($all)) { |
| 1344 | 1344 | $filters = array(); |
| 1345 | 1345 | if ($filter_name != '') { |
| 1346 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1346 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1347 | 1347 | } |
| 1348 | 1348 | $Spotter = new Spotter($this->db); |
| 1349 | 1349 | $all = $Spotter->countAllMilitaryMonths($filters); |
| 1350 | 1350 | } |
| 1351 | 1351 | return $all; |
| 1352 | 1352 | } |
| 1353 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
| 1353 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
| 1354 | 1354 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 1355 | 1355 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1356 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1356 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1357 | 1357 | $Spotter = new Spotter($this->db); |
| 1358 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1358 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1359 | 1359 | $alliance_airlines = array(); |
| 1360 | 1360 | foreach ($airlines as $airline) { |
| 1361 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 1361 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 1362 | 1362 | } |
| 1363 | - if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1364 | - else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1363 | + if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1364 | + else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1365 | 1365 | $query_data = array(':filter_name' => $filter_name); |
| 1366 | 1366 | } else { |
| 1367 | 1367 | 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"; |
@@ -1379,25 +1379,25 @@ discard block |
||
| 1379 | 1379 | try { |
| 1380 | 1380 | $sth = $this->db->prepare($query); |
| 1381 | 1381 | $sth->execute($query_data); |
| 1382 | - } catch(PDOException $e) { |
|
| 1382 | + } catch (PDOException $e) { |
|
| 1383 | 1383 | echo "error : ".$e->getMessage(); |
| 1384 | 1384 | } |
| 1385 | 1385 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1386 | 1386 | if (empty($all)) { |
| 1387 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1388 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1387 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1388 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1389 | 1389 | } else { |
| 1390 | 1390 | $filters = array('airlines' => array($stats_airline)); |
| 1391 | 1391 | } |
| 1392 | 1392 | if ($filter_name != '') { |
| 1393 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1393 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1394 | 1394 | } |
| 1395 | 1395 | $Spotter = new Spotter($this->db); |
| 1396 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
| 1396 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
| 1397 | 1397 | } |
| 1398 | 1398 | return $all; |
| 1399 | 1399 | } |
| 1400 | - public function countAllMarineHours($orderby = 'hour',$limit = true,$filter_name = '') { |
|
| 1400 | + public function countAllMarineHours($orderby = 'hour', $limit = true, $filter_name = '') { |
|
| 1401 | 1401 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 1402 | 1402 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1403 | 1403 | if ($limit) $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
@@ -1414,21 +1414,21 @@ discard block |
||
| 1414 | 1414 | try { |
| 1415 | 1415 | $sth = $this->db->prepare($query); |
| 1416 | 1416 | $sth->execute($query_data); |
| 1417 | - } catch(PDOException $e) { |
|
| 1417 | + } catch (PDOException $e) { |
|
| 1418 | 1418 | echo "error : ".$e->getMessage(); |
| 1419 | 1419 | } |
| 1420 | 1420 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1421 | 1421 | if (empty($all)) { |
| 1422 | 1422 | $filters = array(); |
| 1423 | 1423 | if ($filter_name != '') { |
| 1424 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1424 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1425 | 1425 | } |
| 1426 | 1426 | $Marine = new Marine($this->db); |
| 1427 | - $all = $Marine->countAllHours($orderby,$filters); |
|
| 1427 | + $all = $Marine->countAllHours($orderby, $filters); |
|
| 1428 | 1428 | } |
| 1429 | 1429 | return $all; |
| 1430 | 1430 | } |
| 1431 | - public function countAllTrackerHours($orderby = 'hour',$limit = true,$filter_name = '') { |
|
| 1431 | + public function countAllTrackerHours($orderby = 'hour', $limit = true, $filter_name = '') { |
|
| 1432 | 1432 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 1433 | 1433 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1434 | 1434 | if ($limit) $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
@@ -1445,33 +1445,33 @@ discard block |
||
| 1445 | 1445 | try { |
| 1446 | 1446 | $sth = $this->db->prepare($query); |
| 1447 | 1447 | $sth->execute($query_data); |
| 1448 | - } catch(PDOException $e) { |
|
| 1448 | + } catch (PDOException $e) { |
|
| 1449 | 1449 | echo "error : ".$e->getMessage(); |
| 1450 | 1450 | } |
| 1451 | 1451 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1452 | 1452 | if (empty($all)) { |
| 1453 | 1453 | $filters = array(); |
| 1454 | 1454 | if ($filter_name != '') { |
| 1455 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1455 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1456 | 1456 | } |
| 1457 | 1457 | $Tracker = new Tracker($this->db); |
| 1458 | - $all = $Tracker->countAllHours($orderby,$filters); |
|
| 1458 | + $all = $Tracker->countAllHours($orderby, $filters); |
|
| 1459 | 1459 | } |
| 1460 | 1460 | return $all; |
| 1461 | 1461 | } |
| 1462 | - public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
| 1462 | + public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 1463 | 1463 | global $globalStatsFilters; |
| 1464 | 1464 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1465 | 1465 | if ($year == '') $year = date('Y'); |
| 1466 | - $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1466 | + $all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 1467 | 1467 | if (empty($all)) { |
| 1468 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1469 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 1468 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1469 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 1470 | 1470 | } else { |
| 1471 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 1471 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 1472 | 1472 | } |
| 1473 | 1473 | if ($filter_name != '') { |
| 1474 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1474 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1475 | 1475 | } |
| 1476 | 1476 | $Spotter = new Spotter($this->db); |
| 1477 | 1477 | //$all = $Spotter->countOverallFlights($filters,$year,$month); |
@@ -1479,15 +1479,15 @@ discard block |
||
| 1479 | 1479 | } |
| 1480 | 1480 | return $all; |
| 1481 | 1481 | } |
| 1482 | - public function countOverallMarine($filter_name = '',$year = '',$month = '') { |
|
| 1482 | + public function countOverallMarine($filter_name = '', $year = '', $month = '') { |
|
| 1483 | 1483 | global $globalStatsFilters; |
| 1484 | 1484 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1485 | 1485 | if ($year == '') $year = date('Y'); |
| 1486 | - $all = $this->getSumStats('marine_bymonth',$year,'',$filter_name,$month); |
|
| 1486 | + $all = $this->getSumStats('marine_bymonth', $year, '', $filter_name, $month); |
|
| 1487 | 1487 | if (empty($all)) { |
| 1488 | - $filters = array('year' => $year,'month' => $month); |
|
| 1488 | + $filters = array('year' => $year, 'month' => $month); |
|
| 1489 | 1489 | if ($filter_name != '') { |
| 1490 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1490 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1491 | 1491 | } |
| 1492 | 1492 | $Marine = new Marine($this->db); |
| 1493 | 1493 | //$all = $Spotter->countOverallFlights($filters,$year,$month); |
@@ -1495,15 +1495,15 @@ discard block |
||
| 1495 | 1495 | } |
| 1496 | 1496 | return $all; |
| 1497 | 1497 | } |
| 1498 | - public function countOverallTracker($filter_name = '',$year = '',$month = '') { |
|
| 1498 | + public function countOverallTracker($filter_name = '', $year = '', $month = '') { |
|
| 1499 | 1499 | global $globalStatsFilters; |
| 1500 | 1500 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1501 | 1501 | if ($year == '') $year = date('Y'); |
| 1502 | - $all = $this->getSumStats('tracker_bymonth',$year,'',$filter_name,$month); |
|
| 1502 | + $all = $this->getSumStats('tracker_bymonth', $year, '', $filter_name, $month); |
|
| 1503 | 1503 | if (empty($all)) { |
| 1504 | - $filters = array('year' => $year,'month' => $month); |
|
| 1504 | + $filters = array('year' => $year, 'month' => $month); |
|
| 1505 | 1505 | if ($filter_name != '') { |
| 1506 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1506 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1507 | 1507 | } |
| 1508 | 1508 | $Tracker = new Tracker($this->db); |
| 1509 | 1509 | //$all = $Spotter->countOverallFlights($filters,$year,$month); |
@@ -1511,16 +1511,16 @@ discard block |
||
| 1511 | 1511 | } |
| 1512 | 1512 | return $all; |
| 1513 | 1513 | } |
| 1514 | - public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
|
| 1514 | + public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') { |
|
| 1515 | 1515 | global $globalStatsFilters; |
| 1516 | 1516 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1517 | 1517 | if ($year == '') $year = date('Y'); |
| 1518 | - $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
|
| 1518 | + $all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month); |
|
| 1519 | 1519 | if (empty($all)) { |
| 1520 | 1520 | $filters = array(); |
| 1521 | - $filters = array('year' => $year,'month' => $month); |
|
| 1521 | + $filters = array('year' => $year, 'month' => $month); |
|
| 1522 | 1522 | if ($filter_name != '') { |
| 1523 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1523 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1524 | 1524 | } |
| 1525 | 1525 | $Spotter = new Spotter($this->db); |
| 1526 | 1526 | //$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
@@ -1528,19 +1528,19 @@ discard block |
||
| 1528 | 1528 | } |
| 1529 | 1529 | return $all; |
| 1530 | 1530 | } |
| 1531 | - public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
|
| 1531 | + public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 1532 | 1532 | global $globalStatsFilters; |
| 1533 | 1533 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1534 | 1534 | if ($year == '') $year = date('Y'); |
| 1535 | - $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1535 | + $all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 1536 | 1536 | if (empty($all)) { |
| 1537 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1538 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 1537 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1538 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 1539 | 1539 | } else { |
| 1540 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 1540 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 1541 | 1541 | } |
| 1542 | 1542 | if ($filter_name != '') { |
| 1543 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1543 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1544 | 1544 | } |
| 1545 | 1545 | $Spotter = new Spotter($this->db); |
| 1546 | 1546 | //$all = $Spotter->countOverallArrival($filters,$year,$month); |
@@ -1548,48 +1548,48 @@ discard block |
||
| 1548 | 1548 | } |
| 1549 | 1549 | return $all; |
| 1550 | 1550 | } |
| 1551 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
| 1551 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 1552 | 1552 | global $globalStatsFilters; |
| 1553 | 1553 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1554 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1554 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1555 | 1555 | $Spotter = new Spotter($this->db); |
| 1556 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1556 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1557 | 1557 | if ($year == '' && $month == '') { |
| 1558 | 1558 | $alliance_airlines = array(); |
| 1559 | 1559 | foreach ($airlines as $airline) { |
| 1560 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 1560 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 1561 | 1561 | } |
| 1562 | - $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1562 | + $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1563 | 1563 | try { |
| 1564 | 1564 | $sth = $this->db->prepare($query); |
| 1565 | 1565 | $sth->execute(array(':filter_name' => $filter_name)); |
| 1566 | - } catch(PDOException $e) { |
|
| 1566 | + } catch (PDOException $e) { |
|
| 1567 | 1567 | echo "error : ".$e->getMessage(); |
| 1568 | 1568 | } |
| 1569 | 1569 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1570 | 1570 | $all = $result[0]['nb']; |
| 1571 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1571 | + } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 1572 | 1572 | } else { |
| 1573 | 1573 | if ($year == '' && $month == '') { |
| 1574 | 1574 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1575 | 1575 | try { |
| 1576 | 1576 | $sth = $this->db->prepare($query); |
| 1577 | - $sth->execute(array(':filter_name' => $filter_name,':stats_airline' => $stats_airline)); |
|
| 1578 | - } catch(PDOException $e) { |
|
| 1577 | + $sth->execute(array(':filter_name' => $filter_name, ':stats_airline' => $stats_airline)); |
|
| 1578 | + } catch (PDOException $e) { |
|
| 1579 | 1579 | echo "error : ".$e->getMessage(); |
| 1580 | 1580 | } |
| 1581 | 1581 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1582 | 1582 | $all = $result[0]['nb']; |
| 1583 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1583 | + } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 1584 | 1584 | } |
| 1585 | 1585 | if (empty($all)) { |
| 1586 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1587 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 1586 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1587 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 1588 | 1588 | } else { |
| 1589 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 1589 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 1590 | 1590 | } |
| 1591 | 1591 | if ($filter_name != '') { |
| 1592 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1592 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1593 | 1593 | } |
| 1594 | 1594 | $Spotter = new Spotter($this->db); |
| 1595 | 1595 | //$all = $Spotter->countOverallAircrafts($filters,$year,$month); |
@@ -1597,7 +1597,7 @@ discard block |
||
| 1597 | 1597 | } |
| 1598 | 1598 | return $all; |
| 1599 | 1599 | } |
| 1600 | - public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
|
| 1600 | + public function countOverallAirlines($filter_name = '', $year = '', $month = '') { |
|
| 1601 | 1601 | global $globalStatsFilters; |
| 1602 | 1602 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1603 | 1603 | if ($year == '' && $month == '') { |
@@ -1605,17 +1605,17 @@ discard block |
||
| 1605 | 1605 | try { |
| 1606 | 1606 | $sth = $this->db->prepare($query); |
| 1607 | 1607 | $sth->execute(array(':filter_name' => $filter_name)); |
| 1608 | - } catch(PDOException $e) { |
|
| 1608 | + } catch (PDOException $e) { |
|
| 1609 | 1609 | echo "error : ".$e->getMessage(); |
| 1610 | 1610 | } |
| 1611 | 1611 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1612 | 1612 | $all = $result[0]['nb_airline']; |
| 1613 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 1613 | + } else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month); |
|
| 1614 | 1614 | if (empty($all)) { |
| 1615 | 1615 | $filters = array(); |
| 1616 | - $filters = array('year' => $year,'month' => $month); |
|
| 1616 | + $filters = array('year' => $year, 'month' => $month); |
|
| 1617 | 1617 | if ($filter_name != '') { |
| 1618 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1618 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1619 | 1619 | } |
| 1620 | 1620 | $Spotter = new Spotter($this->db); |
| 1621 | 1621 | //$all = $Spotter->countOverallAirlines($filters,$year,$month); |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | } |
| 1624 | 1624 | return $all; |
| 1625 | 1625 | } |
| 1626 | - public function countOverallMarineTypes($filter_name = '',$year = '',$month = '') { |
|
| 1626 | + public function countOverallMarineTypes($filter_name = '', $year = '', $month = '') { |
|
| 1627 | 1627 | global $globalStatsFilters; |
| 1628 | 1628 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1629 | 1629 | $all = array(); |
@@ -1632,7 +1632,7 @@ discard block |
||
| 1632 | 1632 | try { |
| 1633 | 1633 | $sth = $this->db->prepare($query); |
| 1634 | 1634 | $sth->execute(array(':filter_name' => $filter_name)); |
| 1635 | - } catch(PDOException $e) { |
|
| 1635 | + } catch (PDOException $e) { |
|
| 1636 | 1636 | echo "error : ".$e->getMessage(); |
| 1637 | 1637 | } |
| 1638 | 1638 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1640,9 +1640,9 @@ discard block |
||
| 1640 | 1640 | } |
| 1641 | 1641 | if (empty($all)) { |
| 1642 | 1642 | $filters = array(); |
| 1643 | - $filters = array('year' => $year,'month' => $month); |
|
| 1643 | + $filters = array('year' => $year, 'month' => $month); |
|
| 1644 | 1644 | if ($filter_name != '') { |
| 1645 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1645 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1646 | 1646 | } |
| 1647 | 1647 | $Marine = new Marine($this->db); |
| 1648 | 1648 | //$all = $Spotter->countOverallAirlines($filters,$year,$month); |
@@ -1650,29 +1650,29 @@ discard block |
||
| 1650 | 1650 | } |
| 1651 | 1651 | return $all; |
| 1652 | 1652 | } |
| 1653 | - public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
| 1653 | + public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 1654 | 1654 | global $globalStatsFilters; |
| 1655 | 1655 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1656 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1656 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1657 | 1657 | $Spotter = new Spotter($this->db); |
| 1658 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1658 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1659 | 1659 | if ($year == '' && $month == '') { |
| 1660 | 1660 | $alliance_airlines = array(); |
| 1661 | 1661 | foreach ($airlines as $airline) { |
| 1662 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 1662 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 1663 | 1663 | } |
| 1664 | - $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1664 | + $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1665 | 1665 | $query_values = array(':filter_name' => $filter_name); |
| 1666 | 1666 | try { |
| 1667 | 1667 | $sth = $this->db->prepare($query); |
| 1668 | 1668 | $sth->execute($query_values); |
| 1669 | - } catch(PDOException $e) { |
|
| 1669 | + } catch (PDOException $e) { |
|
| 1670 | 1670 | echo "error : ".$e->getMessage(); |
| 1671 | 1671 | } |
| 1672 | 1672 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1673 | 1673 | $all = $result[0]['nb']; |
| 1674 | 1674 | } else { |
| 1675 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1675 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 1676 | 1676 | } |
| 1677 | 1677 | } else { |
| 1678 | 1678 | if ($year == '' && $month == '') { |
@@ -1681,23 +1681,23 @@ discard block |
||
| 1681 | 1681 | try { |
| 1682 | 1682 | $sth = $this->db->prepare($query); |
| 1683 | 1683 | $sth->execute($query_values); |
| 1684 | - } catch(PDOException $e) { |
|
| 1684 | + } catch (PDOException $e) { |
|
| 1685 | 1685 | echo "error : ".$e->getMessage(); |
| 1686 | 1686 | } |
| 1687 | 1687 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1688 | 1688 | $all = $result[0]['nb']; |
| 1689 | 1689 | } else { |
| 1690 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1690 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 1691 | 1691 | } |
| 1692 | 1692 | } |
| 1693 | 1693 | if (empty($all)) { |
| 1694 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1695 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
| 1694 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1695 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
| 1696 | 1696 | } else { |
| 1697 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 1697 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 1698 | 1698 | } |
| 1699 | 1699 | if ($filter_name != '') { |
| 1700 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1700 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1701 | 1701 | } |
| 1702 | 1702 | $Spotter = new Spotter($this->db); |
| 1703 | 1703 | //$all = $Spotter->countOverallOwners($filters,$year,$month); |
@@ -1705,7 +1705,7 @@ discard block |
||
| 1705 | 1705 | } |
| 1706 | 1706 | return $all; |
| 1707 | 1707 | } |
| 1708 | - public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
| 1708 | + public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
| 1709 | 1709 | global $globalStatsFilters; |
| 1710 | 1710 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1711 | 1711 | //if ($year == '') $year = date('Y'); |
@@ -1715,18 +1715,18 @@ discard block |
||
| 1715 | 1715 | try { |
| 1716 | 1716 | $sth = $this->db->prepare($query); |
| 1717 | 1717 | $sth->execute($query_values); |
| 1718 | - } catch(PDOException $e) { |
|
| 1718 | + } catch (PDOException $e) { |
|
| 1719 | 1719 | echo "error : ".$e->getMessage(); |
| 1720 | 1720 | } |
| 1721 | 1721 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1722 | 1722 | $all = $result[0]['nb']; |
| 1723 | 1723 | } else { |
| 1724 | - $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1724 | + $all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month); |
|
| 1725 | 1725 | } |
| 1726 | 1726 | if (empty($all)) { |
| 1727 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
| 1727 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
| 1728 | 1728 | if ($filter_name != '') { |
| 1729 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 1729 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
| 1730 | 1730 | } |
| 1731 | 1731 | $Spotter = new Spotter($this->db); |
| 1732 | 1732 | //$all = $Spotter->countOverallPilots($filters,$year,$month); |
@@ -1735,104 +1735,104 @@ discard block |
||
| 1735 | 1735 | return $all; |
| 1736 | 1736 | } |
| 1737 | 1737 | |
| 1738 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
| 1738 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
| 1739 | 1739 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1740 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1740 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1741 | 1741 | $Spotter = new Spotter($this->db); |
| 1742 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1742 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1743 | 1743 | $alliance_airlines = array(); |
| 1744 | 1744 | foreach ($airlines as $airline) { |
| 1745 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 1745 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 1746 | 1746 | } |
| 1747 | - $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY date"; |
|
| 1748 | - $query_values = array(':airport_icao' => $airport_icao,':filter_name' => $filter_name); |
|
| 1747 | + $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY date"; |
|
| 1748 | + $query_values = array(':airport_icao' => $airport_icao, ':filter_name' => $filter_name); |
|
| 1749 | 1749 | } else { |
| 1750 | 1750 | $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"; |
| 1751 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1751 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1752 | 1752 | } |
| 1753 | 1753 | try { |
| 1754 | 1754 | $sth = $this->db->prepare($query); |
| 1755 | 1755 | $sth->execute($query_values); |
| 1756 | - } catch(PDOException $e) { |
|
| 1756 | + } catch (PDOException $e) { |
|
| 1757 | 1757 | echo "error : ".$e->getMessage(); |
| 1758 | 1758 | } |
| 1759 | 1759 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1760 | 1760 | return $all; |
| 1761 | 1761 | } |
| 1762 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
| 1762 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
| 1763 | 1763 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1764 | 1764 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
| 1765 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1765 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1766 | 1766 | try { |
| 1767 | 1767 | $sth = $this->db->prepare($query); |
| 1768 | 1768 | $sth->execute($query_values); |
| 1769 | - } catch(PDOException $e) { |
|
| 1769 | + } catch (PDOException $e) { |
|
| 1770 | 1770 | echo "error : ".$e->getMessage(); |
| 1771 | 1771 | } |
| 1772 | 1772 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1773 | 1773 | return $all; |
| 1774 | 1774 | } |
| 1775 | - public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
|
| 1775 | + public function deleteStatsByType($type, $stats_airline = '', $filter_name = '') { |
|
| 1776 | 1776 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1777 | 1777 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1778 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1778 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1779 | 1779 | try { |
| 1780 | 1780 | $sth = $this->db->prepare($query); |
| 1781 | 1781 | $sth->execute($query_values); |
| 1782 | - } catch(PDOException $e) { |
|
| 1782 | + } catch (PDOException $e) { |
|
| 1783 | 1783 | echo "error : ".$e->getMessage(); |
| 1784 | 1784 | } |
| 1785 | 1785 | } |
| 1786 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
|
| 1786 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') { |
|
| 1787 | 1787 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1788 | 1788 | global $globalArchiveMonths, $globalDBdriver; |
| 1789 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1789 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1790 | 1790 | $Spotter = new Spotter($this->db); |
| 1791 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1791 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1792 | 1792 | $alliance_airlines = array(); |
| 1793 | 1793 | foreach ($airlines as $airline) { |
| 1794 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 1794 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 1795 | 1795 | } |
| 1796 | 1796 | if ($globalDBdriver == 'mysql') { |
| 1797 | 1797 | if ($month == '') { |
| 1798 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1798 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1799 | 1799 | $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name); |
| 1800 | 1800 | } else { |
| 1801 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1802 | - $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month); |
|
| 1801 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1802 | + $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month); |
|
| 1803 | 1803 | } |
| 1804 | 1804 | } else { |
| 1805 | 1805 | if ($month == '') { |
| 1806 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1806 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1807 | 1807 | $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name); |
| 1808 | 1808 | } else { |
| 1809 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1810 | - $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month); |
|
| 1809 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1810 | + $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month); |
|
| 1811 | 1811 | } |
| 1812 | 1812 | } |
| 1813 | 1813 | } else { |
| 1814 | 1814 | if ($globalDBdriver == 'mysql') { |
| 1815 | 1815 | if ($month == '') { |
| 1816 | 1816 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1817 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1817 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1818 | 1818 | } else { |
| 1819 | 1819 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1820 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
| 1820 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
| 1821 | 1821 | } |
| 1822 | 1822 | } else { |
| 1823 | 1823 | if ($month == '') { |
| 1824 | 1824 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1825 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1825 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1826 | 1826 | } else { |
| 1827 | 1827 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1828 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
| 1828 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
| 1829 | 1829 | } |
| 1830 | 1830 | } |
| 1831 | 1831 | } |
| 1832 | 1832 | try { |
| 1833 | 1833 | $sth = $this->db->prepare($query); |
| 1834 | 1834 | $sth->execute($query_values); |
| 1835 | - } catch(PDOException $e) { |
|
| 1835 | + } catch (PDOException $e) { |
|
| 1836 | 1836 | echo "error : ".$e->getMessage(); |
| 1837 | 1837 | } |
| 1838 | 1838 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1841,17 +1841,17 @@ discard block |
||
| 1841 | 1841 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
| 1842 | 1842 | global $globalArchiveMonths, $globalDBdriver; |
| 1843 | 1843 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1844 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1844 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1845 | 1845 | $Spotter = new Spotter($this->db); |
| 1846 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1846 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1847 | 1847 | $alliance_airlines = array(); |
| 1848 | 1848 | foreach ($airlines as $airline) { |
| 1849 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 1849 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 1850 | 1850 | } |
| 1851 | 1851 | if ($globalDBdriver == 'mysql') { |
| 1852 | - $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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1852 | + $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 IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1853 | 1853 | } else { |
| 1854 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1854 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1855 | 1855 | } |
| 1856 | 1856 | $query_values = array(':type' => $type, ':filter_name' => $filter_name); |
| 1857 | 1857 | } else { |
@@ -1865,7 +1865,7 @@ discard block |
||
| 1865 | 1865 | try { |
| 1866 | 1866 | $sth = $this->db->prepare($query); |
| 1867 | 1867 | $sth->execute($query_values); |
| 1868 | - } catch(PDOException $e) { |
|
| 1868 | + } catch (PDOException $e) { |
|
| 1869 | 1869 | echo "error : ".$e->getMessage(); |
| 1870 | 1870 | } |
| 1871 | 1871 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1874,17 +1874,17 @@ discard block |
||
| 1874 | 1874 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
| 1875 | 1875 | global $globalArchiveMonths, $globalDBdriver; |
| 1876 | 1876 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1877 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
| 1877 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
| 1878 | 1878 | $Spotter = new Spotter($this->db); |
| 1879 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
| 1879 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
| 1880 | 1880 | $alliance_airlines = array(); |
| 1881 | 1881 | foreach ($airlines as $airline) { |
| 1882 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
| 1882 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
| 1883 | 1883 | } |
| 1884 | 1884 | if ($globalDBdriver == 'mysql') { |
| 1885 | - $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1885 | + $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1886 | 1886 | } else { |
| 1887 | - $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1887 | + $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
| 1888 | 1888 | } |
| 1889 | 1889 | } else { |
| 1890 | 1890 | if ($globalDBdriver == 'mysql') { |
@@ -1896,7 +1896,7 @@ discard block |
||
| 1896 | 1896 | try { |
| 1897 | 1897 | $sth = $this->db->prepare($query); |
| 1898 | 1898 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
| 1899 | - } catch(PDOException $e) { |
|
| 1899 | + } catch (PDOException $e) { |
|
| 1900 | 1900 | echo "error : ".$e->getMessage(); |
| 1901 | 1901 | } |
| 1902 | 1902 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1913,7 +1913,7 @@ discard block |
||
| 1913 | 1913 | try { |
| 1914 | 1914 | $sth = $this->db->prepare($query); |
| 1915 | 1915 | $sth->execute(array(':filter_name' => $filter_name)); |
| 1916 | - } catch(PDOException $e) { |
|
| 1916 | + } catch (PDOException $e) { |
|
| 1917 | 1917 | echo "error : ".$e->getMessage(); |
| 1918 | 1918 | } |
| 1919 | 1919 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1930,20 +1930,20 @@ discard block |
||
| 1930 | 1930 | try { |
| 1931 | 1931 | $sth = $this->db->prepare($query); |
| 1932 | 1932 | $sth->execute(array(':filter_name' => $filter_name)); |
| 1933 | - } catch(PDOException $e) { |
|
| 1933 | + } catch (PDOException $e) { |
|
| 1934 | 1934 | echo "error : ".$e->getMessage(); |
| 1935 | 1935 | } |
| 1936 | 1936 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1937 | 1937 | return $all[0]['total']; |
| 1938 | 1938 | } |
| 1939 | - public function getStatsOwner($owner_name,$filter_name = '') { |
|
| 1939 | + public function getStatsOwner($owner_name, $filter_name = '') { |
|
| 1940 | 1940 | global $globalArchiveMonths, $globalDBdriver; |
| 1941 | 1941 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1942 | 1942 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
| 1943 | 1943 | try { |
| 1944 | 1944 | $sth = $this->db->prepare($query); |
| 1945 | - $sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name)); |
|
| 1946 | - } catch(PDOException $e) { |
|
| 1945 | + $sth->execute(array(':filter_name' => $filter_name, ':owner_name' => $owner_name)); |
|
| 1946 | + } catch (PDOException $e) { |
|
| 1947 | 1947 | echo "error : ".$e->getMessage(); |
| 1948 | 1948 | } |
| 1949 | 1949 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1961,20 +1961,20 @@ discard block |
||
| 1961 | 1961 | try { |
| 1962 | 1962 | $sth = $this->db->prepare($query); |
| 1963 | 1963 | $sth->execute(array(':filter_name' => $filter_name)); |
| 1964 | - } catch(PDOException $e) { |
|
| 1964 | + } catch (PDOException $e) { |
|
| 1965 | 1965 | echo "error : ".$e->getMessage(); |
| 1966 | 1966 | } |
| 1967 | 1967 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1968 | 1968 | return $all[0]['total']; |
| 1969 | 1969 | } |
| 1970 | - public function getStatsPilot($pilot,$filter_name = '') { |
|
| 1970 | + public function getStatsPilot($pilot, $filter_name = '') { |
|
| 1971 | 1971 | global $globalArchiveMonths, $globalDBdriver; |
| 1972 | 1972 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1973 | 1973 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
| 1974 | 1974 | try { |
| 1975 | 1975 | $sth = $this->db->prepare($query); |
| 1976 | - $sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot)); |
|
| 1977 | - } catch(PDOException $e) { |
|
| 1976 | + $sth->execute(array(':filter_name' => $filter_name, ':pilot' => $pilot)); |
|
| 1977 | + } catch (PDOException $e) { |
|
| 1978 | 1978 | echo "error : ".$e->getMessage(); |
| 1979 | 1979 | } |
| 1980 | 1980 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1982,7 +1982,7 @@ discard block |
||
| 1982 | 1982 | else return 0; |
| 1983 | 1983 | } |
| 1984 | 1984 | |
| 1985 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
| 1985 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
| 1986 | 1986 | global $globalDBdriver; |
| 1987 | 1987 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 1988 | 1988 | if ($globalDBdriver == 'mysql') { |
@@ -1990,15 +1990,15 @@ discard block |
||
| 1990 | 1990 | } else { |
| 1991 | 1991 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1992 | 1992 | } |
| 1993 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1993 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 1994 | 1994 | try { |
| 1995 | 1995 | $sth = $this->db->prepare($query); |
| 1996 | 1996 | $sth->execute($query_values); |
| 1997 | - } catch(PDOException $e) { |
|
| 1997 | + } catch (PDOException $e) { |
|
| 1998 | 1998 | return "error : ".$e->getMessage(); |
| 1999 | 1999 | } |
| 2000 | 2000 | } |
| 2001 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
| 2001 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
| 2002 | 2002 | global $globalDBdriver; |
| 2003 | 2003 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 2004 | 2004 | if ($globalDBdriver == 'mysql') { |
@@ -2007,11 +2007,11 @@ discard block |
||
| 2007 | 2007 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
| 2008 | 2008 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 2009 | 2009 | } |
| 2010 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 2010 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 2011 | 2011 | try { |
| 2012 | 2012 | $sth = $this->db->prepare($query); |
| 2013 | 2013 | $sth->execute($query_values); |
| 2014 | - } catch(PDOException $e) { |
|
| 2014 | + } catch (PDOException $e) { |
|
| 2015 | 2015 | return "error : ".$e->getMessage(); |
| 2016 | 2016 | } |
| 2017 | 2017 | } |
@@ -2035,95 +2035,95 @@ discard block |
||
| 2035 | 2035 | } |
| 2036 | 2036 | */ |
| 2037 | 2037 | |
| 2038 | - public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
|
| 2038 | + public function getStatsSource($stats_type, $year = '', $month = '', $day = '') { |
|
| 2039 | 2039 | global $globalDBdriver; |
| 2040 | 2040 | $query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
| 2041 | 2041 | $query_values = array(); |
| 2042 | 2042 | if ($globalDBdriver == 'mysql') { |
| 2043 | 2043 | if ($year != '') { |
| 2044 | 2044 | $query .= ' AND YEAR(stats_date) = :year'; |
| 2045 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 2045 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 2046 | 2046 | } |
| 2047 | 2047 | if ($month != '') { |
| 2048 | 2048 | $query .= ' AND MONTH(stats_date) = :month'; |
| 2049 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 2049 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 2050 | 2050 | } |
| 2051 | 2051 | if ($day != '') { |
| 2052 | 2052 | $query .= ' AND DAY(stats_date) = :day'; |
| 2053 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 2053 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 2054 | 2054 | } |
| 2055 | 2055 | } else { |
| 2056 | 2056 | if ($year != '') { |
| 2057 | 2057 | $query .= ' AND EXTRACT(YEAR FROM stats_date) = :year'; |
| 2058 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 2058 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 2059 | 2059 | } |
| 2060 | 2060 | if ($month != '') { |
| 2061 | 2061 | $query .= ' AND EXTRACT(MONTH FROM stats_date) = :month'; |
| 2062 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 2062 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 2063 | 2063 | } |
| 2064 | 2064 | if ($day != '') { |
| 2065 | 2065 | $query .= ' AND EXTRACT(DAY FROM stats_date) = :day'; |
| 2066 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 2066 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 2067 | 2067 | } |
| 2068 | 2068 | } |
| 2069 | 2069 | $query .= " ORDER BY source_name"; |
| 2070 | - $query_values = array_merge($query_values,array(':stats_type' => $stats_type)); |
|
| 2070 | + $query_values = array_merge($query_values, array(':stats_type' => $stats_type)); |
|
| 2071 | 2071 | try { |
| 2072 | 2072 | $sth = $this->db->prepare($query); |
| 2073 | 2073 | $sth->execute($query_values); |
| 2074 | - } catch(PDOException $e) { |
|
| 2074 | + } catch (PDOException $e) { |
|
| 2075 | 2075 | echo "error : ".$e->getMessage(); |
| 2076 | 2076 | } |
| 2077 | 2077 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2078 | 2078 | return $all; |
| 2079 | 2079 | } |
| 2080 | 2080 | |
| 2081 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
| 2081 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
| 2082 | 2082 | global $globalDBdriver; |
| 2083 | 2083 | if ($globalDBdriver == 'mysql') { |
| 2084 | 2084 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
| 2085 | 2085 | } else { |
| 2086 | 2086 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
| 2087 | 2087 | } |
| 2088 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
| 2088 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
| 2089 | 2089 | try { |
| 2090 | 2090 | $sth = $this->db->prepare($query); |
| 2091 | 2091 | $sth->execute($query_values); |
| 2092 | - } catch(PDOException $e) { |
|
| 2092 | + } catch (PDOException $e) { |
|
| 2093 | 2093 | return "error : ".$e->getMessage(); |
| 2094 | 2094 | } |
| 2095 | 2095 | } |
| 2096 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
| 2096 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
| 2097 | 2097 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
| 2098 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 2098 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 2099 | 2099 | try { |
| 2100 | 2100 | $sth = $this->db->prepare($query); |
| 2101 | 2101 | $sth->execute($query_values); |
| 2102 | - } catch(PDOException $e) { |
|
| 2102 | + } catch (PDOException $e) { |
|
| 2103 | 2103 | return "error : ".$e->getMessage(); |
| 2104 | 2104 | } |
| 2105 | 2105 | } |
| 2106 | - public function addStatMarine($type,$date_name,$cnt,$filter_name = '') { |
|
| 2106 | + public function addStatMarine($type, $date_name, $cnt, $filter_name = '') { |
|
| 2107 | 2107 | $query = "INSERT INTO stats_marine (stats_type,marine_date,cnt,filter_name) VALUES (:type,:flight_date,:cnt,:filter_name)"; |
| 2108 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 2108 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 2109 | 2109 | try { |
| 2110 | 2110 | $sth = $this->db->prepare($query); |
| 2111 | 2111 | $sth->execute($query_values); |
| 2112 | - } catch(PDOException $e) { |
|
| 2112 | + } catch (PDOException $e) { |
|
| 2113 | 2113 | return "error : ".$e->getMessage(); |
| 2114 | 2114 | } |
| 2115 | 2115 | } |
| 2116 | - public function addStatTracker($type,$date_name,$cnt,$filter_name = '') { |
|
| 2116 | + public function addStatTracker($type, $date_name, $cnt, $filter_name = '') { |
|
| 2117 | 2117 | $query = "INSERT INTO stats_tracker (stats_type,tracker_date,cnt,filter_name) VALUES (:type,:flight_date,:cnt,:filter_name)"; |
| 2118 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 2118 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 2119 | 2119 | try { |
| 2120 | 2120 | $sth = $this->db->prepare($query); |
| 2121 | 2121 | $sth->execute($query_values); |
| 2122 | - } catch(PDOException $e) { |
|
| 2122 | + } catch (PDOException $e) { |
|
| 2123 | 2123 | return "error : ".$e->getMessage(); |
| 2124 | 2124 | } |
| 2125 | 2125 | } |
| 2126 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
|
| 2126 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 2127 | 2127 | global $globalDBdriver; |
| 2128 | 2128 | if ($globalDBdriver == 'mysql') { |
| 2129 | 2129 | if ($reset) { |
@@ -2138,15 +2138,15 @@ discard block |
||
| 2138 | 2138 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 2139 | 2139 | } |
| 2140 | 2140 | } |
| 2141 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 2141 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 2142 | 2142 | try { |
| 2143 | 2143 | $sth = $this->db->prepare($query); |
| 2144 | 2144 | $sth->execute($query_values); |
| 2145 | - } catch(PDOException $e) { |
|
| 2145 | + } catch (PDOException $e) { |
|
| 2146 | 2146 | return "error : ".$e->getMessage(); |
| 2147 | 2147 | } |
| 2148 | 2148 | } |
| 2149 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
|
| 2149 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 2150 | 2150 | global $globalDBdriver; |
| 2151 | 2151 | if ($globalDBdriver == 'mysql') { |
| 2152 | 2152 | if ($reset) { |
@@ -2161,15 +2161,15 @@ discard block |
||
| 2161 | 2161 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
| 2162 | 2162 | } |
| 2163 | 2163 | } |
| 2164 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 2164 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 2165 | 2165 | try { |
| 2166 | 2166 | $sth = $this->db->prepare($query); |
| 2167 | 2167 | $sth->execute($query_values); |
| 2168 | - } catch(PDOException $e) { |
|
| 2168 | + } catch (PDOException $e) { |
|
| 2169 | 2169 | return "error : ".$e->getMessage(); |
| 2170 | 2170 | } |
| 2171 | 2171 | } |
| 2172 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) { |
|
| 2172 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 2173 | 2173 | global $globalDBdriver; |
| 2174 | 2174 | if ($globalDBdriver == 'mysql') { |
| 2175 | 2175 | if ($reset) { |
@@ -2184,15 +2184,15 @@ discard block |
||
| 2184 | 2184 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline; INSERT INTO stats_country (iso2,iso3,name,cnt,stats_airline,filter_name) SELECT :iso2,:iso3,:name,:cnt,:airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline);"; |
| 2185 | 2185 | } |
| 2186 | 2186 | } |
| 2187 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
| 2187 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name, ':airline' => $airline_icao); |
|
| 2188 | 2188 | try { |
| 2189 | 2189 | $sth = $this->db->prepare($query); |
| 2190 | 2190 | $sth->execute($query_values); |
| 2191 | - } catch(PDOException $e) { |
|
| 2191 | + } catch (PDOException $e) { |
|
| 2192 | 2192 | return "error : ".$e->getMessage(); |
| 2193 | 2193 | } |
| 2194 | 2194 | } |
| 2195 | - public function addStatCountryMarine($iso2,$iso3,$name,$cnt,$filter_name = '',$reset = false) { |
|
| 2195 | + public function addStatCountryMarine($iso2, $iso3, $name, $cnt, $filter_name = '', $reset = false) { |
|
| 2196 | 2196 | global $globalDBdriver; |
| 2197 | 2197 | if ($globalDBdriver == 'mysql') { |
| 2198 | 2198 | if ($reset) { |
@@ -2207,15 +2207,15 @@ discard block |
||
| 2207 | 2207 | $query = "UPDATE stats_marine_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_marine_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_marine_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; |
| 2208 | 2208 | } |
| 2209 | 2209 | } |
| 2210 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 2210 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 2211 | 2211 | try { |
| 2212 | 2212 | $sth = $this->db->prepare($query); |
| 2213 | 2213 | $sth->execute($query_values); |
| 2214 | - } catch(PDOException $e) { |
|
| 2214 | + } catch (PDOException $e) { |
|
| 2215 | 2215 | return "error : ".$e->getMessage(); |
| 2216 | 2216 | } |
| 2217 | 2217 | } |
| 2218 | - public function addStatCountryTracker($iso2,$iso3,$name,$cnt,$filter_name = '',$reset = false) { |
|
| 2218 | + public function addStatCountryTracker($iso2, $iso3, $name, $cnt, $filter_name = '', $reset = false) { |
|
| 2219 | 2219 | global $globalDBdriver; |
| 2220 | 2220 | if ($globalDBdriver == 'mysql') { |
| 2221 | 2221 | if ($reset) { |
@@ -2230,15 +2230,15 @@ discard block |
||
| 2230 | 2230 | $query = "UPDATE stats_tracker_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_tracker_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_tracker_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; |
| 2231 | 2231 | } |
| 2232 | 2232 | } |
| 2233 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 2233 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 2234 | 2234 | try { |
| 2235 | 2235 | $sth = $this->db->prepare($query); |
| 2236 | 2236 | $sth->execute($query_values); |
| 2237 | - } catch(PDOException $e) { |
|
| 2237 | + } catch (PDOException $e) { |
|
| 2238 | 2238 | return "error : ".$e->getMessage(); |
| 2239 | 2239 | } |
| 2240 | 2240 | } |
| 2241 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 2241 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 2242 | 2242 | global $globalDBdriver; |
| 2243 | 2243 | if ($globalDBdriver == 'mysql') { |
| 2244 | 2244 | if ($reset) { |
@@ -2253,15 +2253,15 @@ discard block |
||
| 2253 | 2253 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 2254 | 2254 | } |
| 2255 | 2255 | } |
| 2256 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 2256 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 2257 | 2257 | try { |
| 2258 | 2258 | $sth = $this->db->prepare($query); |
| 2259 | 2259 | $sth->execute($query_values); |
| 2260 | - } catch(PDOException $e) { |
|
| 2260 | + } catch (PDOException $e) { |
|
| 2261 | 2261 | return "error : ".$e->getMessage(); |
| 2262 | 2262 | } |
| 2263 | 2263 | } |
| 2264 | - public function addStatMarineType($type,$type_id,$cnt, $filter_name = '', $reset = false) { |
|
| 2264 | + public function addStatMarineType($type, $type_id, $cnt, $filter_name = '', $reset = false) { |
|
| 2265 | 2265 | global $globalDBdriver; |
| 2266 | 2266 | if ($globalDBdriver == 'mysql') { |
| 2267 | 2267 | if ($reset) { |
@@ -2276,15 +2276,15 @@ discard block |
||
| 2276 | 2276 | $query = "UPDATE stats_marine_type SET cnt = cnt+:cnt, type = :type, filter_name = :filter_name WHERE type_id = :type_id AND filter_name = :filter_name; INSERT INTO stats_marine_type (type,type_id,cnt,filter_name) SELECT :type,:type_id,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_marine_type WHERE type_id = :type_id AND filter_name = :filter_name);"; |
| 2277 | 2277 | } |
| 2278 | 2278 | } |
| 2279 | - $query_values = array(':type' => $type,':type_id' => $type_id,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 2279 | + $query_values = array(':type' => $type, ':type_id' => $type_id, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 2280 | 2280 | try { |
| 2281 | 2281 | $sth = $this->db->prepare($query); |
| 2282 | 2282 | $sth->execute($query_values); |
| 2283 | - } catch(PDOException $e) { |
|
| 2283 | + } catch (PDOException $e) { |
|
| 2284 | 2284 | return "error : ".$e->getMessage(); |
| 2285 | 2285 | } |
| 2286 | 2286 | } |
| 2287 | - public function addStatTrackerType($type,$cnt, $filter_name = '', $reset = false) { |
|
| 2287 | + public function addStatTrackerType($type, $cnt, $filter_name = '', $reset = false) { |
|
| 2288 | 2288 | global $globalDBdriver; |
| 2289 | 2289 | if ($globalDBdriver == 'mysql') { |
| 2290 | 2290 | if ($reset) { |
@@ -2299,15 +2299,15 @@ discard block |
||
| 2299 | 2299 | $query = "UPDATE stats_tracker_type SET cnt = cnt+:cnt WHERE type = :type AND filter_name = :filter_name; INSERT INTO stats_tracker_type (type,cnt,filter_name) SELECT :type,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_tracker_type WHERE type = :type AND filter_name = :filter_name);"; |
| 2300 | 2300 | } |
| 2301 | 2301 | } |
| 2302 | - $query_values = array(':type' => $type,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 2302 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 2303 | 2303 | try { |
| 2304 | 2304 | $sth = $this->db->prepare($query); |
| 2305 | 2305 | $sth->execute($query_values); |
| 2306 | - } catch(PDOException $e) { |
|
| 2306 | + } catch (PDOException $e) { |
|
| 2307 | 2307 | return "error : ".$e->getMessage(); |
| 2308 | 2308 | } |
| 2309 | 2309 | } |
| 2310 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
|
| 2310 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) { |
|
| 2311 | 2311 | global $globalDBdriver; |
| 2312 | 2312 | if ($globalDBdriver == 'mysql') { |
| 2313 | 2313 | if ($reset) { |
@@ -2322,15 +2322,15 @@ discard block |
||
| 2322 | 2322 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
| 2323 | 2323 | } |
| 2324 | 2324 | } |
| 2325 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 2325 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 2326 | 2326 | try { |
| 2327 | 2327 | $sth = $this->db->prepare($query); |
| 2328 | 2328 | $sth->execute($query_values); |
| 2329 | - } catch(PDOException $e) { |
|
| 2329 | + } catch (PDOException $e) { |
|
| 2330 | 2330 | return "error : ".$e->getMessage(); |
| 2331 | 2331 | } |
| 2332 | 2332 | } |
| 2333 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
|
| 2333 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) { |
|
| 2334 | 2334 | global $globalDBdriver; |
| 2335 | 2335 | if ($globalDBdriver == 'mysql') { |
| 2336 | 2336 | if ($reset) { |
@@ -2345,15 +2345,15 @@ discard block |
||
| 2345 | 2345 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 2346 | 2346 | } |
| 2347 | 2347 | } |
| 2348 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 2348 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 2349 | 2349 | try { |
| 2350 | 2350 | $sth = $this->db->prepare($query); |
| 2351 | 2351 | $sth->execute($query_values); |
| 2352 | - } catch(PDOException $e) { |
|
| 2352 | + } catch (PDOException $e) { |
|
| 2353 | 2353 | return "error : ".$e->getMessage(); |
| 2354 | 2354 | } |
| 2355 | 2355 | } |
| 2356 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
|
| 2356 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) { |
|
| 2357 | 2357 | global $globalDBdriver; |
| 2358 | 2358 | if ($globalDBdriver == 'mysql') { |
| 2359 | 2359 | if ($reset) { |
@@ -2368,15 +2368,15 @@ discard block |
||
| 2368 | 2368 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; |
| 2369 | 2369 | } |
| 2370 | 2370 | } |
| 2371 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
| 2371 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source); |
|
| 2372 | 2372 | try { |
| 2373 | 2373 | $sth = $this->db->prepare($query); |
| 2374 | 2374 | $sth->execute($query_values); |
| 2375 | - } catch(PDOException $e) { |
|
| 2375 | + } catch (PDOException $e) { |
|
| 2376 | 2376 | return "error : ".$e->getMessage(); |
| 2377 | 2377 | } |
| 2378 | 2378 | } |
| 2379 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
|
| 2379 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 2380 | 2380 | global $globalDBdriver; |
| 2381 | 2381 | if ($airport_icao != '') { |
| 2382 | 2382 | if ($globalDBdriver == 'mysql') { |
@@ -2392,16 +2392,16 @@ discard block |
||
| 2392 | 2392 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
| 2393 | 2393 | } |
| 2394 | 2394 | } |
| 2395 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 2395 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 2396 | 2396 | try { |
| 2397 | 2397 | $sth = $this->db->prepare($query); |
| 2398 | 2398 | $sth->execute($query_values); |
| 2399 | - } catch(PDOException $e) { |
|
| 2399 | + } catch (PDOException $e) { |
|
| 2400 | 2400 | return "error : ".$e->getMessage(); |
| 2401 | 2401 | } |
| 2402 | 2402 | } |
| 2403 | 2403 | } |
| 2404 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
| 2404 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
| 2405 | 2405 | global $globalDBdriver; |
| 2406 | 2406 | if ($airport_icao != '') { |
| 2407 | 2407 | if ($globalDBdriver == 'mysql') { |
@@ -2409,16 +2409,16 @@ discard block |
||
| 2409 | 2409 | } else { |
| 2410 | 2410 | $query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 2411 | 2411 | } |
| 2412 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 2412 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 2413 | 2413 | try { |
| 2414 | 2414 | $sth = $this->db->prepare($query); |
| 2415 | 2415 | $sth->execute($query_values); |
| 2416 | - } catch(PDOException $e) { |
|
| 2416 | + } catch (PDOException $e) { |
|
| 2417 | 2417 | return "error : ".$e->getMessage(); |
| 2418 | 2418 | } |
| 2419 | 2419 | } |
| 2420 | 2420 | } |
| 2421 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
|
| 2421 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) { |
|
| 2422 | 2422 | global $globalDBdriver; |
| 2423 | 2423 | if ($airport_icao != '') { |
| 2424 | 2424 | if ($globalDBdriver == 'mysql') { |
@@ -2434,16 +2434,16 @@ discard block |
||
| 2434 | 2434 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
| 2435 | 2435 | } |
| 2436 | 2436 | } |
| 2437 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 2437 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 2438 | 2438 | try { |
| 2439 | 2439 | $sth = $this->db->prepare($query); |
| 2440 | 2440 | $sth->execute($query_values); |
| 2441 | - } catch(PDOException $e) { |
|
| 2441 | + } catch (PDOException $e) { |
|
| 2442 | 2442 | return "error : ".$e->getMessage(); |
| 2443 | 2443 | } |
| 2444 | 2444 | } |
| 2445 | 2445 | } |
| 2446 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
| 2446 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
| 2447 | 2447 | global $globalDBdriver; |
| 2448 | 2448 | if ($airport_icao != '') { |
| 2449 | 2449 | if ($globalDBdriver == 'mysql') { |
@@ -2451,11 +2451,11 @@ discard block |
||
| 2451 | 2451 | } else { |
| 2452 | 2452 | $query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 2453 | 2453 | } |
| 2454 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 2454 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 2455 | 2455 | try { |
| 2456 | 2456 | $sth = $this->db->prepare($query); |
| 2457 | 2457 | $sth->execute($query_values); |
| 2458 | - } catch(PDOException $e) { |
|
| 2458 | + } catch (PDOException $e) { |
|
| 2459 | 2459 | return "error : ".$e->getMessage(); |
| 2460 | 2460 | } |
| 2461 | 2461 | } |
@@ -2467,7 +2467,7 @@ discard block |
||
| 2467 | 2467 | try { |
| 2468 | 2468 | $sth = $this->db->prepare($query); |
| 2469 | 2469 | $sth->execute($query_values); |
| 2470 | - } catch(PDOException $e) { |
|
| 2470 | + } catch (PDOException $e) { |
|
| 2471 | 2471 | return "error : ".$e->getMessage(); |
| 2472 | 2472 | } |
| 2473 | 2473 | } |
@@ -2477,7 +2477,7 @@ discard block |
||
| 2477 | 2477 | try { |
| 2478 | 2478 | $sth = $this->db->prepare($query); |
| 2479 | 2479 | $sth->execute($query_values); |
| 2480 | - } catch(PDOException $e) { |
|
| 2480 | + } catch (PDOException $e) { |
|
| 2481 | 2481 | return "error : ".$e->getMessage(); |
| 2482 | 2482 | } |
| 2483 | 2483 | } |
@@ -2487,7 +2487,7 @@ discard block |
||
| 2487 | 2487 | try { |
| 2488 | 2488 | $sth = $this->db->prepare($query); |
| 2489 | 2489 | $sth->execute($query_values); |
| 2490 | - } catch(PDOException $e) { |
|
| 2490 | + } catch (PDOException $e) { |
|
| 2491 | 2491 | return "error : ".$e->getMessage(); |
| 2492 | 2492 | } |
| 2493 | 2493 | } |
@@ -2497,7 +2497,7 @@ discard block |
||
| 2497 | 2497 | try { |
| 2498 | 2498 | $sth = $this->db->prepare($query); |
| 2499 | 2499 | $sth->execute($query_values); |
| 2500 | - } catch(PDOException $e) { |
|
| 2500 | + } catch (PDOException $e) { |
|
| 2501 | 2501 | return "error : ".$e->getMessage(); |
| 2502 | 2502 | } |
| 2503 | 2503 | } |
@@ -2507,13 +2507,13 @@ discard block |
||
| 2507 | 2507 | try { |
| 2508 | 2508 | $sth = $this->db->prepare($query); |
| 2509 | 2509 | $sth->execute($query_values); |
| 2510 | - } catch(PDOException $e) { |
|
| 2510 | + } catch (PDOException $e) { |
|
| 2511 | 2511 | return "error : ".$e->getMessage(); |
| 2512 | 2512 | } |
| 2513 | 2513 | } |
| 2514 | 2514 | |
| 2515 | 2515 | public function addOldStats() { |
| 2516 | - global $globalMasterServer, $globalAircraft, $globalMarine, $globalTracker, $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear, $globalAccidents; |
|
| 2516 | + global $globalMasterServer, $globalAircraft, $globalMarine, $globalTracker, $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear, $globalAccidents; |
|
| 2517 | 2517 | $Common = new Common(); |
| 2518 | 2518 | $Connection = new Connection($this->db); |
| 2519 | 2519 | date_default_timezone_set('UTC'); |
@@ -2528,9 +2528,9 @@ discard block |
||
| 2528 | 2528 | $filtername = 'marine'; |
| 2529 | 2529 | if ($Connection->tableExists('countries')) { |
| 2530 | 2530 | if ($globalDebug) echo 'Count all vessels by countries...'."\n"; |
| 2531 | - $alldata = $Marine->countAllMarineOverCountries(false,0,$last_update_day); |
|
| 2531 | + $alldata = $Marine->countAllMarineOverCountries(false, 0, $last_update_day); |
|
| 2532 | 2532 | foreach ($alldata as $number) { |
| 2533 | - echo $this->addStatCountryMarine($number['marine_country_iso2'],$number['marine_country_iso3'],$number['marine_country'],$number['marine_count'],'','',$reset); |
|
| 2533 | + echo $this->addStatCountryMarine($number['marine_country_iso2'], $number['marine_country_iso3'], $number['marine_country'], $number['marine_count'], '', '', $reset); |
|
| 2534 | 2534 | } |
| 2535 | 2535 | } |
| 2536 | 2536 | if ($globalDebug) echo 'Count all vessels by months...'."\n"; |
@@ -2540,44 +2540,44 @@ discard block |
||
| 2540 | 2540 | $lastyear = false; |
| 2541 | 2541 | foreach ($alldata as $number) { |
| 2542 | 2542 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 2543 | - $this->addStat('marine_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
| 2543 | + $this->addStat('marine_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 2544 | 2544 | } |
| 2545 | 2545 | echo 'Marine data...'."\n"; |
| 2546 | 2546 | $this->deleteStatMarine('month'); |
| 2547 | 2547 | echo '-> countAllDatesLastMonth...'."\n"; |
| 2548 | 2548 | $alldata = $Marine->countAllDatesLastMonth($filter_last_month); |
| 2549 | 2549 | foreach ($alldata as $number) { |
| 2550 | - $this->addStatMarine('month',$number['date_name'],$number['date_count']); |
|
| 2550 | + $this->addStatMarine('month', $number['date_name'], $number['date_count']); |
|
| 2551 | 2551 | } |
| 2552 | 2552 | echo '-> countAllDates...'."\n"; |
| 2553 | 2553 | $previousdata = $this->countAllDatesMarine(); |
| 2554 | 2554 | $this->deleteStatMarine('date'); |
| 2555 | - $alldata = $Common->array_merge_noappend($previousdata,$Marine->countAllDates($filter_last_month)); |
|
| 2555 | + $alldata = $Common->array_merge_noappend($previousdata, $Marine->countAllDates($filter_last_month)); |
|
| 2556 | 2556 | $values = array(); |
| 2557 | 2557 | foreach ($alldata as $cnt) { |
| 2558 | 2558 | $values[] = $cnt['date_count']; |
| 2559 | 2559 | } |
| 2560 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 2561 | - array_splice($alldata,11); |
|
| 2560 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 2561 | + array_splice($alldata, 11); |
|
| 2562 | 2562 | foreach ($alldata as $number) { |
| 2563 | - $this->addStatMarine('date',$number['date_name'],$number['date_count']); |
|
| 2563 | + $this->addStatMarine('date', $number['date_name'], $number['date_count']); |
|
| 2564 | 2564 | } |
| 2565 | 2565 | |
| 2566 | 2566 | $this->deleteStatMarine('hour'); |
| 2567 | 2567 | echo '-> countAllHours...'."\n"; |
| 2568 | - $alldata = $Marine->countAllHours('hour',$filter_last_month); |
|
| 2568 | + $alldata = $Marine->countAllHours('hour', $filter_last_month); |
|
| 2569 | 2569 | foreach ($alldata as $number) { |
| 2570 | - $this->addStatMarine('hour',$number['hour_name'],$number['hour_count']); |
|
| 2570 | + $this->addStatMarine('hour', $number['hour_name'], $number['hour_count']); |
|
| 2571 | 2571 | } |
| 2572 | 2572 | if ($globalDebug) echo 'Count all types...'."\n"; |
| 2573 | - $alldata = $Marine->countAllMarineTypes(false,0,$last_update_day); |
|
| 2573 | + $alldata = $Marine->countAllMarineTypes(false, 0, $last_update_day); |
|
| 2574 | 2574 | foreach ($alldata as $number) { |
| 2575 | - $this->addStatMarineType($number['marine_type'],$number['marine_type_id'],$number['marine_type_count'],'',$reset); |
|
| 2575 | + $this->addStatMarineType($number['marine_type'], $number['marine_type_id'], $number['marine_type_count'], '', $reset); |
|
| 2576 | 2576 | } |
| 2577 | 2577 | |
| 2578 | 2578 | echo 'Insert last stats update date...'."\n"; |
| 2579 | 2579 | date_default_timezone_set('UTC'); |
| 2580 | - $this->addLastStatsUpdate('last_update_stats_marine',date('Y-m-d G:i:s')); |
|
| 2580 | + $this->addLastStatsUpdate('last_update_stats_marine', date('Y-m-d G:i:s')); |
|
| 2581 | 2581 | } |
| 2582 | 2582 | if ((isset($globalTracker) && $globalTracker) || (isset($globalMasterServer) && $globalMasterServer)) { |
| 2583 | 2583 | $last_update = $this->getLastStatsUpdate('last_update_stats_tracker'); |
@@ -2589,9 +2589,9 @@ discard block |
||
| 2589 | 2589 | $Tracker = new Tracker($this->db); |
| 2590 | 2590 | if ($Connection->tableExists('countries')) { |
| 2591 | 2591 | if ($globalDebug) echo 'Count all trackers by countries...'."\n"; |
| 2592 | - $alldata = $Tracker->countAllTrackerOverCountries(false,0,$last_update_day); |
|
| 2592 | + $alldata = $Tracker->countAllTrackerOverCountries(false, 0, $last_update_day); |
|
| 2593 | 2593 | foreach ($alldata as $number) { |
| 2594 | - $this->addStatCountryTracker($number['tracker_country_iso2'],$number['tracker_country_iso3'],$number['tracker_country'],$number['tracker_count'],'','',$reset); |
|
| 2594 | + $this->addStatCountryTracker($number['tracker_country_iso2'], $number['tracker_country_iso3'], $number['tracker_country'], $number['tracker_count'], '', '', $reset); |
|
| 2595 | 2595 | } |
| 2596 | 2596 | } |
| 2597 | 2597 | if ($globalDebug) echo 'Count all vessels by months...'."\n"; |
@@ -2601,43 +2601,43 @@ discard block |
||
| 2601 | 2601 | $lastyear = false; |
| 2602 | 2602 | foreach ($alldata as $number) { |
| 2603 | 2603 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 2604 | - $this->addStat('tracker_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
| 2604 | + $this->addStat('tracker_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
| 2605 | 2605 | } |
| 2606 | 2606 | echo 'Tracker data...'."\n"; |
| 2607 | 2607 | $this->deleteStatTracker('month'); |
| 2608 | 2608 | echo '-> countAllDatesLastMonth...'."\n"; |
| 2609 | 2609 | $alldata = $Tracker->countAllDatesLastMonth($filter_last_month); |
| 2610 | 2610 | foreach ($alldata as $number) { |
| 2611 | - $this->addStatTracker('month',$number['date_name'],$number['date_count']); |
|
| 2611 | + $this->addStatTracker('month', $number['date_name'], $number['date_count']); |
|
| 2612 | 2612 | } |
| 2613 | 2613 | echo '-> countAllDates...'."\n"; |
| 2614 | 2614 | $previousdata = $this->countAllDatesTracker(); |
| 2615 | 2615 | $this->deleteStatTracker('date'); |
| 2616 | - $alldata = $Common->array_merge_noappend($previousdata,$Tracker->countAllDates($filter_last_month)); |
|
| 2616 | + $alldata = $Common->array_merge_noappend($previousdata, $Tracker->countAllDates($filter_last_month)); |
|
| 2617 | 2617 | $values = array(); |
| 2618 | 2618 | foreach ($alldata as $cnt) { |
| 2619 | 2619 | $values[] = $cnt['date_count']; |
| 2620 | 2620 | } |
| 2621 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 2622 | - array_splice($alldata,11); |
|
| 2621 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 2622 | + array_splice($alldata, 11); |
|
| 2623 | 2623 | foreach ($alldata as $number) { |
| 2624 | - $this->addStatTracker('date',$number['date_name'],$number['date_count']); |
|
| 2624 | + $this->addStatTracker('date', $number['date_name'], $number['date_count']); |
|
| 2625 | 2625 | } |
| 2626 | 2626 | |
| 2627 | 2627 | $this->deleteStatTracker('hour'); |
| 2628 | 2628 | echo '-> countAllHours...'."\n"; |
| 2629 | - $alldata = $Tracker->countAllHours('hour',$filter_last_month); |
|
| 2629 | + $alldata = $Tracker->countAllHours('hour', $filter_last_month); |
|
| 2630 | 2630 | foreach ($alldata as $number) { |
| 2631 | - $this->addStatTracker('hour',$number['hour_name'],$number['hour_count']); |
|
| 2631 | + $this->addStatTracker('hour', $number['hour_name'], $number['hour_count']); |
|
| 2632 | 2632 | } |
| 2633 | 2633 | if ($globalDebug) echo 'Count all types...'."\n"; |
| 2634 | - $alldata = $Tracker->countAllTrackerTypes(false,0,$last_update_day); |
|
| 2634 | + $alldata = $Tracker->countAllTrackerTypes(false, 0, $last_update_day); |
|
| 2635 | 2635 | foreach ($alldata as $number) { |
| 2636 | - $this->addStatTrackerType($number['tracker_type'],$number['tracker_type_count'],'',$reset); |
|
| 2636 | + $this->addStatTrackerType($number['tracker_type'], $number['tracker_type_count'], '', $reset); |
|
| 2637 | 2637 | } |
| 2638 | 2638 | echo 'Insert last stats update date...'."\n"; |
| 2639 | 2639 | date_default_timezone_set('UTC'); |
| 2640 | - $this->addLastStatsUpdate('last_update_stats_tracker',date('Y-m-d G:i:s')); |
|
| 2640 | + $this->addLastStatsUpdate('last_update_stats_tracker', date('Y-m-d G:i:s')); |
|
| 2641 | 2641 | } |
| 2642 | 2642 | |
| 2643 | 2643 | if (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft) || (isset($globalMasterServer) && $globalMasterServer)) { |
@@ -2655,41 +2655,41 @@ discard block |
||
| 2655 | 2655 | $Spotter = new Spotter($this->db); |
| 2656 | 2656 | |
| 2657 | 2657 | if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
| 2658 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
| 2658 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
| 2659 | 2659 | foreach ($alldata as $number) { |
| 2660 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
|
| 2660 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset); |
|
| 2661 | 2661 | } |
| 2662 | 2662 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
| 2663 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
| 2663 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
| 2664 | 2664 | foreach ($alldata as $number) { |
| 2665 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
|
| 2665 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset); |
|
| 2666 | 2666 | } |
| 2667 | 2667 | if ($globalDebug) echo 'Count all registrations...'."\n"; |
| 2668 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
| 2668 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
| 2669 | 2669 | foreach ($alldata as $number) { |
| 2670 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
|
| 2670 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset); |
|
| 2671 | 2671 | } |
| 2672 | 2672 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
| 2673 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
| 2673 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
| 2674 | 2674 | foreach ($alldata as $number) { |
| 2675 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
| 2675 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
| 2676 | 2676 | } |
| 2677 | 2677 | if ($globalDebug) echo 'Count all owners...'."\n"; |
| 2678 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
| 2678 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
| 2679 | 2679 | foreach ($alldata as $number) { |
| 2680 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
|
| 2680 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset); |
|
| 2681 | 2681 | } |
| 2682 | 2682 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
| 2683 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
| 2683 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
| 2684 | 2684 | foreach ($alldata as $number) { |
| 2685 | 2685 | if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name']; |
| 2686 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
|
| 2686 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset); |
|
| 2687 | 2687 | } |
| 2688 | 2688 | |
| 2689 | 2689 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
| 2690 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
| 2690 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
| 2691 | 2691 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
| 2692 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
| 2692 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
| 2693 | 2693 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
| 2694 | 2694 | $alldata = array(); |
| 2695 | 2695 | foreach ($pall as $value) { |
@@ -2706,14 +2706,14 @@ discard block |
||
| 2706 | 2706 | foreach ($alldata as $key => $row) { |
| 2707 | 2707 | $count[$key] = $row['airport_departure_icao_count']; |
| 2708 | 2708 | } |
| 2709 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 2709 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 2710 | 2710 | foreach ($alldata as $number) { |
| 2711 | - 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); |
|
| 2711 | + 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); |
|
| 2712 | 2712 | } |
| 2713 | 2713 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
| 2714 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
| 2714 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
| 2715 | 2715 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
| 2716 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
| 2716 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
| 2717 | 2717 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
| 2718 | 2718 | $alldata = array(); |
| 2719 | 2719 | foreach ($pall as $value) { |
@@ -2730,18 +2730,18 @@ discard block |
||
| 2730 | 2730 | foreach ($alldata as $key => $row) { |
| 2731 | 2731 | $count[$key] = $row['airport_arrival_icao_count']; |
| 2732 | 2732 | } |
| 2733 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 2733 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 2734 | 2734 | foreach ($alldata as $number) { |
| 2735 | - 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); |
|
| 2735 | + 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); |
|
| 2736 | 2736 | } |
| 2737 | 2737 | if ($Connection->tableExists('countries')) { |
| 2738 | 2738 | if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
| 2739 | 2739 | //$SpotterArchive = new SpotterArchive(); |
| 2740 | 2740 | //$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
| 2741 | 2741 | $Spotter = new Spotter($this->db); |
| 2742 | - $alldata = $Spotter->countAllFlightOverCountries(false,0,$last_update_day); |
|
| 2742 | + $alldata = $Spotter->countAllFlightOverCountries(false, 0, $last_update_day); |
|
| 2743 | 2743 | foreach ($alldata as $number) { |
| 2744 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'','',$reset); |
|
| 2744 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', '', $reset); |
|
| 2745 | 2745 | } |
| 2746 | 2746 | } |
| 2747 | 2747 | |
@@ -2751,12 +2751,12 @@ discard block |
||
| 2751 | 2751 | $this->deleteStatsByType('fatalities_byyear'); |
| 2752 | 2752 | $alldata = $Accident->countFatalitiesByYear(); |
| 2753 | 2753 | foreach ($alldata as $number) { |
| 2754 | - $this->addStat('fatalities_byyear',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,1,1,$number['year']))); |
|
| 2754 | + $this->addStat('fatalities_byyear', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, 1, 1, $number['year']))); |
|
| 2755 | 2755 | } |
| 2756 | 2756 | $this->deleteStatsByType('fatalities_bymonth'); |
| 2757 | 2757 | $alldata = $Accident->countFatalitiesLast12Months(); |
| 2758 | 2758 | foreach ($alldata as $number) { |
| 2759 | - $this->addStat('fatalities_bymonth',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month'],1,$number['year']))); |
|
| 2759 | + $this->addStat('fatalities_bymonth', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month'], 1, $number['year']))); |
|
| 2760 | 2760 | } |
| 2761 | 2761 | } |
| 2762 | 2762 | |
@@ -2770,37 +2770,37 @@ discard block |
||
| 2770 | 2770 | $lastyear = false; |
| 2771 | 2771 | foreach ($alldata as $number) { |
| 2772 | 2772 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 2773 | - $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']))); |
|
| 2773 | + $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']))); |
|
| 2774 | 2774 | } |
| 2775 | 2775 | if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
| 2776 | 2776 | $alldata = $Spotter->countAllMilitaryMonths($filter_last_month); |
| 2777 | 2777 | foreach ($alldata as $number) { |
| 2778 | - $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']))); |
|
| 2778 | + $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']))); |
|
| 2779 | 2779 | } |
| 2780 | 2780 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
| 2781 | 2781 | $alldata = $Spotter->countAllMonthsOwners($filter_last_month); |
| 2782 | 2782 | foreach ($alldata as $number) { |
| 2783 | - $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']))); |
|
| 2783 | + $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']))); |
|
| 2784 | 2784 | } |
| 2785 | 2785 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
| 2786 | 2786 | $alldata = $Spotter->countAllMonthsPilots($filter_last_month); |
| 2787 | 2787 | foreach ($alldata as $number) { |
| 2788 | - $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']))); |
|
| 2788 | + $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']))); |
|
| 2789 | 2789 | } |
| 2790 | 2790 | if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
| 2791 | 2791 | $alldata = $Spotter->countAllMonthsAirlines($filter_last_month); |
| 2792 | 2792 | foreach ($alldata as $number) { |
| 2793 | - $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']))); |
|
| 2793 | + $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']))); |
|
| 2794 | 2794 | } |
| 2795 | 2795 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
| 2796 | 2796 | $alldata = $Spotter->countAllMonthsAircrafts($filter_last_month); |
| 2797 | 2797 | foreach ($alldata as $number) { |
| 2798 | - $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']))); |
|
| 2798 | + $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']))); |
|
| 2799 | 2799 | } |
| 2800 | 2800 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
| 2801 | 2801 | $alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month); |
| 2802 | 2802 | foreach ($alldata as $number) { |
| 2803 | - $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']))); |
|
| 2803 | + $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']))); |
|
| 2804 | 2804 | } |
| 2805 | 2805 | if ($globalDebug) echo 'Airports data...'."\n"; |
| 2806 | 2806 | if ($globalDebug) echo '...Departure'."\n"; |
@@ -2845,7 +2845,7 @@ discard block |
||
| 2845 | 2845 | } |
| 2846 | 2846 | $alldata = $pall; |
| 2847 | 2847 | foreach ($alldata as $number) { |
| 2848 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
| 2848 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
| 2849 | 2849 | } |
| 2850 | 2850 | echo '...Arrival'."\n"; |
| 2851 | 2851 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -2886,7 +2886,7 @@ discard block |
||
| 2886 | 2886 | } |
| 2887 | 2887 | $alldata = $pall; |
| 2888 | 2888 | foreach ($alldata as $number) { |
| 2889 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
| 2889 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
| 2890 | 2890 | } |
| 2891 | 2891 | |
| 2892 | 2892 | echo 'Flights data...'."\n"; |
@@ -2894,28 +2894,28 @@ discard block |
||
| 2894 | 2894 | echo '-> countAllDatesLastMonth...'."\n"; |
| 2895 | 2895 | $alldata = $Spotter->countAllDatesLastMonth($filter_last_month); |
| 2896 | 2896 | foreach ($alldata as $number) { |
| 2897 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
| 2897 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
| 2898 | 2898 | } |
| 2899 | 2899 | echo '-> countAllDates...'."\n"; |
| 2900 | 2900 | $previousdata = $this->countAllDates(); |
| 2901 | 2901 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
| 2902 | 2902 | $this->deleteStatFlight('date'); |
| 2903 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter_last_month)); |
|
| 2903 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter_last_month)); |
|
| 2904 | 2904 | $values = array(); |
| 2905 | 2905 | foreach ($alldata as $cnt) { |
| 2906 | 2906 | $values[] = $cnt['date_count']; |
| 2907 | 2907 | } |
| 2908 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 2909 | - array_splice($alldata,11); |
|
| 2908 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 2909 | + array_splice($alldata, 11); |
|
| 2910 | 2910 | foreach ($alldata as $number) { |
| 2911 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
| 2911 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
| 2912 | 2912 | } |
| 2913 | 2913 | |
| 2914 | 2914 | $this->deleteStatFlight('hour'); |
| 2915 | 2915 | echo '-> countAllHours...'."\n"; |
| 2916 | - $alldata = $Spotter->countAllHours('hour',$filter_last_month); |
|
| 2916 | + $alldata = $Spotter->countAllHours('hour', $filter_last_month); |
|
| 2917 | 2917 | foreach ($alldata as $number) { |
| 2918 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
| 2918 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
| 2919 | 2919 | } |
| 2920 | 2920 | |
| 2921 | 2921 | // Count by airlines |
@@ -2924,42 +2924,42 @@ discard block |
||
| 2924 | 2924 | if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
| 2925 | 2925 | $SpotterArchive = new SpotterArchive($this->db); |
| 2926 | 2926 | //$Spotter = new Spotter($this->db); |
| 2927 | - $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
|
| 2927 | + $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false, 0, $last_update_day); |
|
| 2928 | 2928 | //$alldata = $Spotter->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
| 2929 | 2929 | foreach ($alldata as $number) { |
| 2930 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
|
| 2930 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], $number['airline_icao'], '', $reset); |
|
| 2931 | 2931 | } |
| 2932 | 2932 | } |
| 2933 | 2933 | if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
| 2934 | 2934 | $Spotter = new Spotter($this->db); |
| 2935 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
| 2935 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
| 2936 | 2936 | foreach ($alldata as $number) { |
| 2937 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
|
| 2937 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset); |
|
| 2938 | 2938 | } |
| 2939 | 2939 | if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
| 2940 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
| 2940 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
| 2941 | 2941 | foreach ($alldata as $number) { |
| 2942 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
|
| 2942 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset); |
|
| 2943 | 2943 | } |
| 2944 | 2944 | if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
| 2945 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
| 2945 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
| 2946 | 2946 | foreach ($alldata as $number) { |
| 2947 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
| 2947 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
| 2948 | 2948 | } |
| 2949 | 2949 | if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
| 2950 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
| 2950 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
| 2951 | 2951 | foreach ($alldata as $number) { |
| 2952 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
|
| 2952 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset); |
|
| 2953 | 2953 | } |
| 2954 | 2954 | if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
| 2955 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
| 2955 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
| 2956 | 2956 | foreach ($alldata as $number) { |
| 2957 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
|
| 2957 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset); |
|
| 2958 | 2958 | } |
| 2959 | 2959 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
| 2960 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 2960 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
| 2961 | 2961 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
| 2962 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 2962 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
| 2963 | 2963 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
| 2964 | 2964 | //$alldata = array(); |
| 2965 | 2965 | foreach ($dall as $value) { |
@@ -2979,12 +2979,12 @@ discard block |
||
| 2979 | 2979 | } |
| 2980 | 2980 | $alldata = $pall; |
| 2981 | 2981 | foreach ($alldata as $number) { |
| 2982 | - 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); |
|
| 2982 | + 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); |
|
| 2983 | 2983 | } |
| 2984 | 2984 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
| 2985 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 2985 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
| 2986 | 2986 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
| 2987 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 2987 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
| 2988 | 2988 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
| 2989 | 2989 | //$alldata = array(); |
| 2990 | 2990 | foreach ($dall as $value) { |
@@ -3004,7 +3004,7 @@ discard block |
||
| 3004 | 3004 | } |
| 3005 | 3005 | $alldata = $pall; |
| 3006 | 3006 | foreach ($alldata as $number) { |
| 3007 | - 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); |
|
| 3007 | + 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); |
|
| 3008 | 3008 | } |
| 3009 | 3009 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
| 3010 | 3010 | $Spotter = new Spotter($this->db); |
@@ -3012,27 +3012,27 @@ discard block |
||
| 3012 | 3012 | $lastyear = false; |
| 3013 | 3013 | foreach ($alldata as $number) { |
| 3014 | 3014 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 3015 | - $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']); |
|
| 3015 | + $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']); |
|
| 3016 | 3016 | } |
| 3017 | 3017 | if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
| 3018 | 3018 | $alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month); |
| 3019 | 3019 | foreach ($alldata as $number) { |
| 3020 | - $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']); |
|
| 3020 | + $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']); |
|
| 3021 | 3021 | } |
| 3022 | 3022 | if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
| 3023 | 3023 | $alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month); |
| 3024 | 3024 | foreach ($alldata as $number) { |
| 3025 | - $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']); |
|
| 3025 | + $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']); |
|
| 3026 | 3026 | } |
| 3027 | 3027 | if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
| 3028 | 3028 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month); |
| 3029 | 3029 | foreach ($alldata as $number) { |
| 3030 | - $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']); |
|
| 3030 | + $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']); |
|
| 3031 | 3031 | } |
| 3032 | 3032 | if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
| 3033 | 3033 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month); |
| 3034 | 3034 | foreach ($alldata as $number) { |
| 3035 | - $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']); |
|
| 3035 | + $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']); |
|
| 3036 | 3036 | } |
| 3037 | 3037 | if ($globalDebug) echo '...Departure'."\n"; |
| 3038 | 3038 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -3055,7 +3055,7 @@ discard block |
||
| 3055 | 3055 | } |
| 3056 | 3056 | $alldata = $pall; |
| 3057 | 3057 | foreach ($alldata as $number) { |
| 3058 | - $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']); |
|
| 3058 | + $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']); |
|
| 3059 | 3059 | } |
| 3060 | 3060 | if ($globalDebug) echo '...Arrival'."\n"; |
| 3061 | 3061 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -3078,32 +3078,32 @@ discard block |
||
| 3078 | 3078 | } |
| 3079 | 3079 | $alldata = $pall; |
| 3080 | 3080 | foreach ($alldata as $number) { |
| 3081 | - $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']); |
|
| 3081 | + $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']); |
|
| 3082 | 3082 | } |
| 3083 | 3083 | |
| 3084 | 3084 | if ($globalDebug) echo 'Flights data...'."\n"; |
| 3085 | 3085 | if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
| 3086 | 3086 | $alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month); |
| 3087 | 3087 | foreach ($alldata as $number) { |
| 3088 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
| 3088 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
| 3089 | 3089 | } |
| 3090 | 3090 | if ($globalDebug) echo '-> countAllDates...'."\n"; |
| 3091 | 3091 | //$previousdata = $this->countAllDatesByAirlines(); |
| 3092 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month)); |
|
| 3092 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines($filter_last_month)); |
|
| 3093 | 3093 | $values = array(); |
| 3094 | 3094 | foreach ($alldata as $cnt) { |
| 3095 | 3095 | $values[] = $cnt['date_count']; |
| 3096 | 3096 | } |
| 3097 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 3098 | - array_splice($alldata,11); |
|
| 3097 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 3098 | + array_splice($alldata, 11); |
|
| 3099 | 3099 | foreach ($alldata as $number) { |
| 3100 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
| 3100 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
| 3101 | 3101 | } |
| 3102 | 3102 | |
| 3103 | 3103 | if ($globalDebug) echo '-> countAllHours...'."\n"; |
| 3104 | - $alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month); |
|
| 3104 | + $alldata = $Spotter->countAllHoursByAirlines('hour', $filter_last_month); |
|
| 3105 | 3105 | foreach ($alldata as $number) { |
| 3106 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
| 3106 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
| 3107 | 3107 | } |
| 3108 | 3108 | |
| 3109 | 3109 | // Stats by filters |
@@ -3127,7 +3127,7 @@ discard block |
||
| 3127 | 3127 | $last_update_day = date('Y').'-01-01 00:00:00'; |
| 3128 | 3128 | } |
| 3129 | 3129 | } |
| 3130 | - if (isset($filter['DeleteLastYearStats']) && date('Y',strtotime($last_update_day)) != date('Y')) { |
|
| 3130 | + if (isset($filter['DeleteLastYearStats']) && date('Y', strtotime($last_update_day)) != date('Y')) { |
|
| 3131 | 3131 | $last_update_day = date('Y').'-01-01 00:00:00'; |
| 3132 | 3132 | $reset = true; |
| 3133 | 3133 | } |
@@ -3135,38 +3135,38 @@ discard block |
||
| 3135 | 3135 | if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
| 3136 | 3136 | $Spotter = new Spotter($this->db); |
| 3137 | 3137 | if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
| 3138 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
| 3138 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
| 3139 | 3139 | foreach ($alldata as $number) { |
| 3140 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
|
| 3140 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset); |
|
| 3141 | 3141 | } |
| 3142 | 3142 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
| 3143 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
| 3143 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
| 3144 | 3144 | foreach ($alldata as $number) { |
| 3145 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
|
| 3145 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset); |
|
| 3146 | 3146 | } |
| 3147 | 3147 | if ($globalDebug) echo 'Count all aircraft registrations...'."\n"; |
| 3148 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
| 3148 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
| 3149 | 3149 | foreach ($alldata as $number) { |
| 3150 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
|
| 3150 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset); |
|
| 3151 | 3151 | } |
| 3152 | 3152 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
| 3153 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
| 3153 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
| 3154 | 3154 | foreach ($alldata as $number) { |
| 3155 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
|
| 3155 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset); |
|
| 3156 | 3156 | } |
| 3157 | 3157 | if ($globalDebug) echo 'Count all owners...'."\n"; |
| 3158 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
| 3158 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
| 3159 | 3159 | foreach ($alldata as $number) { |
| 3160 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
|
| 3160 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset); |
|
| 3161 | 3161 | } |
| 3162 | 3162 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
| 3163 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
| 3163 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
| 3164 | 3164 | foreach ($alldata as $number) { |
| 3165 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
|
| 3165 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset); |
|
| 3166 | 3166 | } |
| 3167 | 3167 | if ($globalDebug) echo 'Count departure airports...'."\n"; |
| 3168 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
| 3169 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
| 3168 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
| 3169 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
| 3170 | 3170 | $alldata = array(); |
| 3171 | 3171 | foreach ($pall as $value) { |
| 3172 | 3172 | $icao = $value['airport_departure_icao']; |
@@ -3182,13 +3182,13 @@ discard block |
||
| 3182 | 3182 | foreach ($alldata as $key => $row) { |
| 3183 | 3183 | $count[$key] = $row['airport_departure_icao_count']; |
| 3184 | 3184 | } |
| 3185 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 3185 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 3186 | 3186 | foreach ($alldata as $number) { |
| 3187 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
|
| 3187 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name, $reset); |
|
| 3188 | 3188 | } |
| 3189 | 3189 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
| 3190 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
|
| 3191 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
| 3190 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
| 3191 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
| 3192 | 3192 | $alldata = array(); |
| 3193 | 3193 | foreach ($pall as $value) { |
| 3194 | 3194 | $icao = $value['airport_arrival_icao']; |
@@ -3204,9 +3204,9 @@ discard block |
||
| 3204 | 3204 | foreach ($alldata as $key => $row) { |
| 3205 | 3205 | $count[$key] = $row['airport_arrival_icao_count']; |
| 3206 | 3206 | } |
| 3207 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 3207 | + array_multisort($count, SORT_DESC, $alldata); |
|
| 3208 | 3208 | foreach ($alldata as $number) { |
| 3209 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset); |
|
| 3209 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name, $reset); |
|
| 3210 | 3210 | } |
| 3211 | 3211 | if ($globalDebug) echo 'Count all months...'."\n"; |
| 3212 | 3212 | $Spotter = new Spotter($this->db); |
@@ -3214,36 +3214,36 @@ discard block |
||
| 3214 | 3214 | $lastyear = false; |
| 3215 | 3215 | foreach ($alldata as $number) { |
| 3216 | 3216 | if ($number['year_name'] != date('Y')) $lastyear = true; |
| 3217 | - $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); |
|
| 3217 | + $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); |
|
| 3218 | 3218 | } |
| 3219 | 3219 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
| 3220 | 3220 | $alldata = $Spotter->countAllMonthsOwners($filter); |
| 3221 | 3221 | foreach ($alldata as $number) { |
| 3222 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 3222 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 3223 | 3223 | } |
| 3224 | 3224 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
| 3225 | 3225 | $alldata = $Spotter->countAllMonthsPilots($filter); |
| 3226 | 3226 | foreach ($alldata as $number) { |
| 3227 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 3227 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 3228 | 3228 | } |
| 3229 | 3229 | if ($globalDebug) echo 'Count all military by months...'."\n"; |
| 3230 | 3230 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
| 3231 | 3231 | foreach ($alldata as $number) { |
| 3232 | - $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 3232 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 3233 | 3233 | } |
| 3234 | 3234 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
| 3235 | 3235 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
| 3236 | 3236 | foreach ($alldata as $number) { |
| 3237 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 3237 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 3238 | 3238 | } |
| 3239 | 3239 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
| 3240 | 3240 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
| 3241 | 3241 | foreach ($alldata as $number) { |
| 3242 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
| 3242 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
| 3243 | 3243 | } |
| 3244 | 3244 | echo '...Departure'."\n"; |
| 3245 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
| 3246 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
| 3245 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
| 3246 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
| 3247 | 3247 | foreach ($dall as $value) { |
| 3248 | 3248 | $icao = $value['departure_airport_icao']; |
| 3249 | 3249 | $ddate = $value['date']; |
@@ -3261,11 +3261,11 @@ discard block |
||
| 3261 | 3261 | } |
| 3262 | 3262 | $alldata = $pall; |
| 3263 | 3263 | foreach ($alldata as $number) { |
| 3264 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
|
| 3264 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name); |
|
| 3265 | 3265 | } |
| 3266 | 3266 | echo '...Arrival'."\n"; |
| 3267 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
| 3268 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
| 3267 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
| 3268 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
| 3269 | 3269 | foreach ($dall as $value) { |
| 3270 | 3270 | $icao = $value['arrival_airport_icao']; |
| 3271 | 3271 | $ddate = $value['date']; |
@@ -3283,39 +3283,39 @@ discard block |
||
| 3283 | 3283 | } |
| 3284 | 3284 | $alldata = $pall; |
| 3285 | 3285 | foreach ($alldata as $number) { |
| 3286 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
|
| 3286 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name); |
|
| 3287 | 3287 | } |
| 3288 | 3288 | echo 'Flights data...'."\n"; |
| 3289 | 3289 | echo '-> countAllDatesLastMonth...'."\n"; |
| 3290 | 3290 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
| 3291 | 3291 | foreach ($alldata as $number) { |
| 3292 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
| 3292 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
| 3293 | 3293 | } |
| 3294 | 3294 | echo '-> countAllDates...'."\n"; |
| 3295 | - $previousdata = $this->countAllDates('',$filter_name); |
|
| 3296 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
| 3295 | + $previousdata = $this->countAllDates('', $filter_name); |
|
| 3296 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
| 3297 | 3297 | $values = array(); |
| 3298 | 3298 | foreach ($alldata as $cnt) { |
| 3299 | 3299 | $values[] = $cnt['date_count']; |
| 3300 | 3300 | } |
| 3301 | - array_multisort($values,SORT_DESC,$alldata); |
|
| 3302 | - array_splice($alldata,11); |
|
| 3301 | + array_multisort($values, SORT_DESC, $alldata); |
|
| 3302 | + array_splice($alldata, 11); |
|
| 3303 | 3303 | foreach ($alldata as $number) { |
| 3304 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
| 3304 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
| 3305 | 3305 | } |
| 3306 | 3306 | |
| 3307 | 3307 | echo '-> countAllHours...'."\n"; |
| 3308 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
| 3308 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
| 3309 | 3309 | foreach ($alldata as $number) { |
| 3310 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
| 3310 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
| 3311 | 3311 | } |
| 3312 | 3312 | echo 'Insert last stats update date...'."\n"; |
| 3313 | 3313 | date_default_timezone_set('UTC'); |
| 3314 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
| 3314 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
|
| 3315 | 3315 | if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
| 3316 | - if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
| 3316 | + if (date('Y', strtotime($last_update_day)) != date('Y')) { |
|
| 3317 | 3317 | $this->deleteOldStats($filter_name); |
| 3318 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
| 3318 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
|
| 3319 | 3319 | } |
| 3320 | 3320 | } |
| 3321 | 3321 | } |
@@ -3328,16 +3328,16 @@ discard block |
||
| 3328 | 3328 | // SUM all previous month to put as year |
| 3329 | 3329 | $previous_year = date('Y'); |
| 3330 | 3330 | $previous_year--; |
| 3331 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 3332 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 3333 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 3334 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
| 3331 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 3332 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 3333 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 3334 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
| 3335 | 3335 | $allairlines = $this->getAllAirlineNames(); |
| 3336 | 3336 | foreach ($allairlines as $data) { |
| 3337 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 3338 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 3339 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 3340 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
| 3337 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 3338 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 3339 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 3340 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
| 3341 | 3341 | } |
| 3342 | 3342 | |
| 3343 | 3343 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -3346,21 +3346,21 @@ discard block |
||
| 3346 | 3346 | try { |
| 3347 | 3347 | $sth = $this->db->prepare($query); |
| 3348 | 3348 | $sth->execute(); |
| 3349 | - } catch(PDOException $e) { |
|
| 3349 | + } catch (PDOException $e) { |
|
| 3350 | 3350 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 3351 | 3351 | } |
| 3352 | 3352 | $query = "INSERT INTO tracker_archive_output SELECT * FROM tracker_output WHERE tracker_output.date < '".date('Y')."-01-01 00:00:00'"; |
| 3353 | 3353 | try { |
| 3354 | 3354 | $sth = $this->db->prepare($query); |
| 3355 | 3355 | $sth->execute(); |
| 3356 | - } catch(PDOException $e) { |
|
| 3356 | + } catch (PDOException $e) { |
|
| 3357 | 3357 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 3358 | 3358 | } |
| 3359 | 3359 | $query = "INSERT INTO marine_archive_output SELECT * FROM marine_output WHERE marine_output.date < '".date('Y')."-01-01 00:00:00'"; |
| 3360 | 3360 | try { |
| 3361 | 3361 | $sth = $this->db->prepare($query); |
| 3362 | 3362 | $sth->execute(); |
| 3363 | - } catch(PDOException $e) { |
|
| 3363 | + } catch (PDOException $e) { |
|
| 3364 | 3364 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 3365 | 3365 | } |
| 3366 | 3366 | } |
@@ -3373,7 +3373,7 @@ discard block |
||
| 3373 | 3373 | try { |
| 3374 | 3374 | $sth = $this->db->prepare($query); |
| 3375 | 3375 | $sth->execute(); |
| 3376 | - } catch(PDOException $e) { |
|
| 3376 | + } catch (PDOException $e) { |
|
| 3377 | 3377 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 3378 | 3378 | } |
| 3379 | 3379 | if ($globalDBdriver == 'mysql') { |
@@ -3384,7 +3384,7 @@ discard block |
||
| 3384 | 3384 | try { |
| 3385 | 3385 | $sth = $this->db->prepare($query); |
| 3386 | 3386 | $sth->execute(); |
| 3387 | - } catch(PDOException $e) { |
|
| 3387 | + } catch (PDOException $e) { |
|
| 3388 | 3388 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 3389 | 3389 | } |
| 3390 | 3390 | if ($globalDBdriver == 'mysql') { |
@@ -3395,15 +3395,15 @@ discard block |
||
| 3395 | 3395 | try { |
| 3396 | 3396 | $sth = $this->db->prepare($query); |
| 3397 | 3397 | $sth->execute(); |
| 3398 | - } catch(PDOException $e) { |
|
| 3398 | + } catch (PDOException $e) { |
|
| 3399 | 3399 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 3400 | 3400 | } |
| 3401 | 3401 | } |
| 3402 | 3402 | if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
| 3403 | 3403 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
| 3404 | - if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
| 3404 | + if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
|
| 3405 | 3405 | $this->deleteOldStats(); |
| 3406 | - $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
| 3406 | + $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
|
| 3407 | 3407 | $lastyearupdate = true; |
| 3408 | 3408 | } |
| 3409 | 3409 | } |
@@ -3425,7 +3425,7 @@ discard block |
||
| 3425 | 3425 | try { |
| 3426 | 3426 | $sth = $this->db->prepare($query); |
| 3427 | 3427 | $sth->execute(); |
| 3428 | - } catch(PDOException $e) { |
|
| 3428 | + } catch (PDOException $e) { |
|
| 3429 | 3429 | return "error : ".$e->getMessage(); |
| 3430 | 3430 | } |
| 3431 | 3431 | echo 'Archive old tracker data...'."\n"; |
@@ -3441,7 +3441,7 @@ discard block |
||
| 3441 | 3441 | try { |
| 3442 | 3442 | $sth = $this->db->prepare($query); |
| 3443 | 3443 | $sth->execute(); |
| 3444 | - } catch(PDOException $e) { |
|
| 3444 | + } catch (PDOException $e) { |
|
| 3445 | 3445 | return "error : ".$e->getMessage(); |
| 3446 | 3446 | } |
| 3447 | 3447 | echo 'Archive old marine data...'."\n"; |
@@ -3457,7 +3457,7 @@ discard block |
||
| 3457 | 3457 | try { |
| 3458 | 3458 | $sth = $this->db->prepare($query); |
| 3459 | 3459 | $sth->execute(); |
| 3460 | - } catch(PDOException $e) { |
|
| 3460 | + } catch (PDOException $e) { |
|
| 3461 | 3461 | return "error : ".$e->getMessage(); |
| 3462 | 3462 | } |
| 3463 | 3463 | } |
@@ -3470,7 +3470,7 @@ discard block |
||
| 3470 | 3470 | try { |
| 3471 | 3471 | $sth = $this->db->prepare($query); |
| 3472 | 3472 | $sth->execute(); |
| 3473 | - } catch(PDOException $e) { |
|
| 3473 | + } catch (PDOException $e) { |
|
| 3474 | 3474 | return "error : ".$e->getMessage(); |
| 3475 | 3475 | } |
| 3476 | 3476 | echo 'Deleting old tracker data...'."\n"; |
@@ -3482,7 +3482,7 @@ discard block |
||
| 3482 | 3482 | try { |
| 3483 | 3483 | $sth = $this->db->prepare($query); |
| 3484 | 3484 | $sth->execute(); |
| 3485 | - } catch(PDOException $e) { |
|
| 3485 | + } catch (PDOException $e) { |
|
| 3486 | 3486 | return "error : ".$e->getMessage(); |
| 3487 | 3487 | } |
| 3488 | 3488 | echo 'Deleting old marine data...'."\n"; |
@@ -3494,14 +3494,14 @@ discard block |
||
| 3494 | 3494 | try { |
| 3495 | 3495 | $sth = $this->db->prepare($query); |
| 3496 | 3496 | $sth->execute(); |
| 3497 | - } catch(PDOException $e) { |
|
| 3497 | + } catch (PDOException $e) { |
|
| 3498 | 3498 | return "error : ".$e->getMessage(); |
| 3499 | 3499 | } |
| 3500 | 3500 | } |
| 3501 | 3501 | if (!isset($lastyearupdate)) { |
| 3502 | 3502 | echo 'Insert last stats update date...'."\n"; |
| 3503 | 3503 | date_default_timezone_set('UTC'); |
| 3504 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
| 3504 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
| 3505 | 3505 | } |
| 3506 | 3506 | if ($globalStatsResetYear) { |
| 3507 | 3507 | require_once(dirname(__FILE__).'/../install/class.settings.php'); |
@@ -22,10 +22,14 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct($dbc = null) { |
| 24 | 24 | global $globalFilterName; |
| 25 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
| 25 | + if (isset($globalFilterName)) { |
|
| 26 | + $this->filter_name = $globalFilterName; |
|
| 27 | + } |
|
| 26 | 28 | $Connection = new Connection($dbc); |
| 27 | 29 | $this->db = $Connection->db(); |
| 28 | - if ($this->db === null) die('Error: No DB connection. (Stats)'); |
|
| 30 | + if ($this->db === null) { |
|
| 31 | + die('Error: No DB connection. (Stats)'); |
|
| 32 | + } |
|
| 29 | 33 | } |
| 30 | 34 | |
| 31 | 35 | public function addLastStatsUpdate($type,$stats_date) { |
@@ -93,7 +97,9 @@ discard block |
||
| 93 | 97 | |
| 94 | 98 | public function getAllAirlineNames($filter_name = '') { |
| 95 | 99 | global $globalStatsFilters; |
| 96 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 100 | + if ($filter_name == '') { |
|
| 101 | + $filter_name = $this->filter_name; |
|
| 102 | + } |
|
| 97 | 103 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
| 98 | 104 | try { |
| 99 | 105 | $sth = $this->db->prepare($query); |
@@ -113,7 +119,9 @@ discard block |
||
| 113 | 119 | return $all; |
| 114 | 120 | } |
| 115 | 121 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
| 116 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 122 | + if ($filter_name == '') { |
|
| 123 | + $filter_name = $this->filter_name; |
|
| 124 | + } |
|
| 117 | 125 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
| 118 | 126 | try { |
| 119 | 127 | $sth = $this->db->prepare($query); |
@@ -125,7 +133,9 @@ discard block |
||
| 125 | 133 | return $all; |
| 126 | 134 | } |
| 127 | 135 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
| 128 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 136 | + if ($filter_name == '') { |
|
| 137 | + $filter_name = $this->filter_name; |
|
| 138 | + } |
|
| 129 | 139 | $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"; |
| 130 | 140 | try { |
| 131 | 141 | $sth = $this->db->prepare($query); |
@@ -137,7 +147,9 @@ discard block |
||
| 137 | 147 | return $all; |
| 138 | 148 | } |
| 139 | 149 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
| 140 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 150 | + if ($filter_name == '') { |
|
| 151 | + $filter_name = $this->filter_name; |
|
| 152 | + } |
|
| 141 | 153 | $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"; |
| 142 | 154 | try { |
| 143 | 155 | $sth = $this->db->prepare($query); |
@@ -150,7 +162,9 @@ discard block |
||
| 150 | 162 | } |
| 151 | 163 | |
| 152 | 164 | public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
| 153 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 165 | + if ($filter_name == '') { |
|
| 166 | + $filter_name = $this->filter_name; |
|
| 167 | + } |
|
| 154 | 168 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
| 155 | 169 | try { |
| 156 | 170 | $sth = $this->db->prepare($query); |
@@ -163,7 +177,9 @@ discard block |
||
| 163 | 177 | } |
| 164 | 178 | |
| 165 | 179 | public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
| 166 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 180 | + if ($filter_name == '') { |
|
| 181 | + $filter_name = $this->filter_name; |
|
| 182 | + } |
|
| 167 | 183 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
| 168 | 184 | try { |
| 169 | 185 | $sth = $this->db->prepare($query); |
@@ -178,7 +194,9 @@ discard block |
||
| 178 | 194 | |
| 179 | 195 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 180 | 196 | global $globalStatsFilters; |
| 181 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 197 | + if ($filter_name == '') { |
|
| 198 | + $filter_name = $this->filter_name; |
|
| 199 | + } |
|
| 182 | 200 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 183 | 201 | $Spotter = new Spotter($this->db); |
| 184 | 202 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -187,8 +205,11 @@ discard block |
||
| 187 | 205 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 188 | 206 | } |
| 189 | 207 | if ($year == '' && $month == '') { |
| 190 | - 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 aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 191 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 208 | + if ($limit) { |
|
| 209 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 210 | + } else { |
|
| 211 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 212 | + } |
|
| 192 | 213 | try { |
| 193 | 214 | $sth = $this->db->prepare($query); |
| 194 | 215 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -196,11 +217,16 @@ discard block |
||
| 196 | 217 | echo "error : ".$e->getMessage(); |
| 197 | 218 | } |
| 198 | 219 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 199 | - } else $all = array(); |
|
| 220 | + } else { |
|
| 221 | + $all = array(); |
|
| 222 | + } |
|
| 200 | 223 | } else { |
| 201 | 224 | if ($year == '' && $month == '') { |
| 202 | - 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 aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 203 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 225 | + if ($limit) { |
|
| 226 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 227 | + } else { |
|
| 228 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 229 | + } |
|
| 204 | 230 | try { |
| 205 | 231 | $sth = $this->db->prepare($query); |
| 206 | 232 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -208,7 +234,9 @@ discard block |
||
| 208 | 234 | echo "error : ".$e->getMessage(); |
| 209 | 235 | } |
| 210 | 236 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 211 | - } else $all = array(); |
|
| 237 | + } else { |
|
| 238 | + $all = array(); |
|
| 239 | + } |
|
| 212 | 240 | } |
| 213 | 241 | if (empty($all)) { |
| 214 | 242 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -227,10 +255,15 @@ discard block |
||
| 227 | 255 | } |
| 228 | 256 | public function countAllMarineTypes($limit = true, $filter_name = '',$year = '', $month = '') { |
| 229 | 257 | global $globalStatsFilters; |
| 230 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 258 | + if ($filter_name == '') { |
|
| 259 | + $filter_name = $this->filter_name; |
|
| 260 | + } |
|
| 231 | 261 | if ($year == '' && $month == '') { |
| 232 | - if ($limit) $query = "SELECT type AS marine_type, cnt AS marine_type_count, type_id AS marine_type_id FROM stats_marine_type WHERE filter_name = :filter_name ORDER BY marine_type_count DESC LIMIT 10 OFFSET 0"; |
|
| 233 | - else $query = "SELECT type AS marine_type, cnt AS marine_type_count, type_id AS marine_type_id FROM stats_marine_type WHERE filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 262 | + if ($limit) { |
|
| 263 | + $query = "SELECT type AS marine_type, cnt AS marine_type_count, type_id AS marine_type_id FROM stats_marine_type WHERE filter_name = :filter_name ORDER BY marine_type_count DESC LIMIT 10 OFFSET 0"; |
|
| 264 | + } else { |
|
| 265 | + $query = "SELECT type AS marine_type, cnt AS marine_type_count, type_id AS marine_type_id FROM stats_marine_type WHERE filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 266 | + } |
|
| 234 | 267 | try { |
| 235 | 268 | $sth = $this->db->prepare($query); |
| 236 | 269 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -238,7 +271,9 @@ discard block |
||
| 238 | 271 | echo "error : ".$e->getMessage(); |
| 239 | 272 | } |
| 240 | 273 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 241 | - } else $all = array(); |
|
| 274 | + } else { |
|
| 275 | + $all = array(); |
|
| 276 | + } |
|
| 242 | 277 | if (empty($all)) { |
| 243 | 278 | $filters = array('year' => $year,'month' => $month); |
| 244 | 279 | if ($filter_name != '') { |
@@ -252,10 +287,15 @@ discard block |
||
| 252 | 287 | } |
| 253 | 288 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
| 254 | 289 | global $globalStatsFilters; |
| 255 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 290 | + if ($filter_name == '') { |
|
| 291 | + $filter_name = $this->filter_name; |
|
| 292 | + } |
|
| 256 | 293 | if ($year == '' && $month == '') { |
| 257 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 258 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
| 294 | + if ($limit) { |
|
| 295 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 296 | + } else { |
|
| 297 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
| 298 | + } |
|
| 259 | 299 | try { |
| 260 | 300 | $sth = $this->db->prepare($query); |
| 261 | 301 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -263,7 +303,9 @@ discard block |
||
| 263 | 303 | echo "error : ".$e->getMessage(); |
| 264 | 304 | } |
| 265 | 305 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 266 | - } else $all = array(); |
|
| 306 | + } else { |
|
| 307 | + $all = array(); |
|
| 308 | + } |
|
| 267 | 309 | if (empty($all)) { |
| 268 | 310 | $Spotter = new Spotter($this->db); |
| 269 | 311 | $filters = array(); |
@@ -278,7 +320,9 @@ discard block |
||
| 278 | 320 | } |
| 279 | 321 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 280 | 322 | global $globalStatsFilters; |
| 281 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 323 | + if ($filter_name == '') { |
|
| 324 | + $filter_name = $this->filter_name; |
|
| 325 | + } |
|
| 282 | 326 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 283 | 327 | $Spotter = new Spotter($this->db); |
| 284 | 328 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -287,8 +331,11 @@ discard block |
||
| 287 | 331 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 288 | 332 | } |
| 289 | 333 | if ($year == '' && $month == '') { |
| 290 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 291 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 334 | + if ($limit) { |
|
| 335 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 336 | + } else { |
|
| 337 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 338 | + } |
|
| 292 | 339 | try { |
| 293 | 340 | $sth = $this->db->prepare($query); |
| 294 | 341 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -296,11 +343,16 @@ discard block |
||
| 296 | 343 | echo "error : ".$e->getMessage(); |
| 297 | 344 | } |
| 298 | 345 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 299 | - } else $all = array(); |
|
| 346 | + } else { |
|
| 347 | + $all = array(); |
|
| 348 | + } |
|
| 300 | 349 | } else { |
| 301 | 350 | if ($year == '' && $month == '') { |
| 302 | - 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"; |
|
| 303 | - 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"; |
|
| 351 | + if ($limit) { |
|
| 352 | + $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"; |
|
| 353 | + } else { |
|
| 354 | + $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"; |
|
| 355 | + } |
|
| 304 | 356 | try { |
| 305 | 357 | $sth = $this->db->prepare($query); |
| 306 | 358 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -308,7 +360,9 @@ discard block |
||
| 308 | 360 | echo "error : ".$e->getMessage(); |
| 309 | 361 | } |
| 310 | 362 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 311 | - } else $all = array(); |
|
| 363 | + } else { |
|
| 364 | + $all = array(); |
|
| 365 | + } |
|
| 312 | 366 | } |
| 313 | 367 | if (empty($all)) { |
| 314 | 368 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -328,7 +382,9 @@ discard block |
||
| 328 | 382 | |
| 329 | 383 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 330 | 384 | global $globalStatsFilters; |
| 331 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 385 | + if ($filter_name == '') { |
|
| 386 | + $filter_name = $this->filter_name; |
|
| 387 | + } |
|
| 332 | 388 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 333 | 389 | $Spotter = new Spotter($this->db); |
| 334 | 390 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -337,8 +393,11 @@ discard block |
||
| 337 | 393 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 338 | 394 | } |
| 339 | 395 | if ($year == '' && $month == '') { |
| 340 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 341 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 396 | + if ($limit) { |
|
| 397 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 398 | + } else { |
|
| 399 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 400 | + } |
|
| 342 | 401 | try { |
| 343 | 402 | $sth = $this->db->prepare($query); |
| 344 | 403 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -346,11 +405,16 @@ discard block |
||
| 346 | 405 | echo "error : ".$e->getMessage(); |
| 347 | 406 | } |
| 348 | 407 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 349 | - } else $all = array(); |
|
| 408 | + } else { |
|
| 409 | + $all = array(); |
|
| 410 | + } |
|
| 350 | 411 | } else { |
| 351 | 412 | if ($year == '' && $month == '') { |
| 352 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 353 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 413 | + if ($limit) { |
|
| 414 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 415 | + } else { |
|
| 416 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 417 | + } |
|
| 354 | 418 | try { |
| 355 | 419 | $sth = $this->db->prepare($query); |
| 356 | 420 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -358,7 +422,9 @@ discard block |
||
| 358 | 422 | echo "error : ".$e->getMessage(); |
| 359 | 423 | } |
| 360 | 424 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 361 | - } else $all = array(); |
|
| 425 | + } else { |
|
| 426 | + $all = array(); |
|
| 427 | + } |
|
| 362 | 428 | } |
| 363 | 429 | if (empty($all)) { |
| 364 | 430 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -377,7 +443,9 @@ discard block |
||
| 377 | 443 | } |
| 378 | 444 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
| 379 | 445 | global $globalStatsFilters; |
| 380 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 446 | + if ($filter_name == '') { |
|
| 447 | + $filter_name = $this->filter_name; |
|
| 448 | + } |
|
| 381 | 449 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 382 | 450 | $Spotter = new Spotter($this->db); |
| 383 | 451 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -385,12 +453,18 @@ discard block |
||
| 385 | 453 | foreach ($airlines as $airline) { |
| 386 | 454 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 387 | 455 | } |
| 388 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 389 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 456 | + if ($limit) { |
|
| 457 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 458 | + } else { |
|
| 459 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 460 | + } |
|
| 390 | 461 | $query_values = array(':filter_name' => $filter_name); |
| 391 | 462 | } else { |
| 392 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 393 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 463 | + if ($limit) { |
|
| 464 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 465 | + } else { |
|
| 466 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 467 | + } |
|
| 394 | 468 | $query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 395 | 469 | } |
| 396 | 470 | try { |
@@ -418,17 +492,29 @@ discard block |
||
| 418 | 492 | |
| 419 | 493 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
| 420 | 494 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
| 421 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 495 | + if ($filter_name == '') { |
|
| 496 | + $filter_name = $this->filter_name; |
|
| 497 | + } |
|
| 422 | 498 | if ($year == '' && $month == '') { |
| 423 | - if ($globalVATSIM) $forsource = 'vatsim'; |
|
| 424 | - if ($globalIVAO) $forsource = 'ivao'; |
|
| 499 | + if ($globalVATSIM) { |
|
| 500 | + $forsource = 'vatsim'; |
|
| 501 | + } |
|
| 502 | + if ($globalIVAO) { |
|
| 503 | + $forsource = 'ivao'; |
|
| 504 | + } |
|
| 425 | 505 | if (isset($forsource)) { |
| 426 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 427 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
| 506 | + if ($limit) { |
|
| 507 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 508 | + } else { |
|
| 509 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
| 510 | + } |
|
| 428 | 511 | $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
| 429 | 512 | } else { |
| 430 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 431 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
| 513 | + if ($limit) { |
|
| 514 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 515 | + } else { |
|
| 516 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
| 517 | + } |
|
| 432 | 518 | $query_values = array(':filter_name' => $filter_name); |
| 433 | 519 | } |
| 434 | 520 | try { |
@@ -438,7 +524,9 @@ discard block |
||
| 438 | 524 | echo "error : ".$e->getMessage(); |
| 439 | 525 | } |
| 440 | 526 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 441 | - } else $all = array(); |
|
| 527 | + } else { |
|
| 528 | + $all = array(); |
|
| 529 | + } |
|
| 442 | 530 | if (empty($all)) { |
| 443 | 531 | $Spotter = new Spotter($this->db); |
| 444 | 532 | $filters = array(); |
@@ -453,7 +541,9 @@ discard block |
||
| 453 | 541 | } |
| 454 | 542 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 455 | 543 | global $globalStatsFilters; |
| 456 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 544 | + if ($filter_name == '') { |
|
| 545 | + $filter_name = $this->filter_name; |
|
| 546 | + } |
|
| 457 | 547 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 458 | 548 | $Spotter = new Spotter($this->db); |
| 459 | 549 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -462,8 +552,11 @@ discard block |
||
| 462 | 552 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 463 | 553 | } |
| 464 | 554 | if ($year == '' && $month == '') { |
| 465 | - 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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 466 | - 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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 555 | + if ($limit) { |
|
| 556 | + $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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 557 | + } else { |
|
| 558 | + $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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 559 | + } |
|
| 467 | 560 | try { |
| 468 | 561 | $sth = $this->db->prepare($query); |
| 469 | 562 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -471,11 +564,16 @@ discard block |
||
| 471 | 564 | echo "error : ".$e->getMessage(); |
| 472 | 565 | } |
| 473 | 566 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 474 | - } else $all = array(); |
|
| 567 | + } else { |
|
| 568 | + $all = array(); |
|
| 569 | + } |
|
| 475 | 570 | } else { |
| 476 | 571 | if ($year == '' && $month == '') { |
| 477 | - 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"; |
|
| 478 | - 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"; |
|
| 572 | + if ($limit) { |
|
| 573 | + $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"; |
|
| 574 | + } else { |
|
| 575 | + $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"; |
|
| 576 | + } |
|
| 479 | 577 | try { |
| 480 | 578 | $sth = $this->db->prepare($query); |
| 481 | 579 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -483,7 +581,9 @@ discard block |
||
| 483 | 581 | echo "error : ".$e->getMessage(); |
| 484 | 582 | } |
| 485 | 583 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 486 | - } else $all = array(); |
|
| 584 | + } else { |
|
| 585 | + $all = array(); |
|
| 586 | + } |
|
| 487 | 587 | } |
| 488 | 588 | if (empty($all)) { |
| 489 | 589 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -502,7 +602,9 @@ discard block |
||
| 502 | 602 | } |
| 503 | 603 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 504 | 604 | global $globalStatsFilters; |
| 505 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 605 | + if ($filter_name == '') { |
|
| 606 | + $filter_name = $this->filter_name; |
|
| 607 | + } |
|
| 506 | 608 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 507 | 609 | $Spotter = new Spotter($this->db); |
| 508 | 610 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -511,8 +613,11 @@ discard block |
||
| 511 | 613 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 512 | 614 | } |
| 513 | 615 | if ($year == '' && $month == '') { |
| 514 | - 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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 515 | - 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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 616 | + if ($limit) { |
|
| 617 | + $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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 618 | + } else { |
|
| 619 | + $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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 620 | + } |
|
| 516 | 621 | try { |
| 517 | 622 | $sth = $this->db->prepare($query); |
| 518 | 623 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -520,11 +625,16 @@ discard block |
||
| 520 | 625 | echo "error : ".$e->getMessage(); |
| 521 | 626 | } |
| 522 | 627 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 523 | - } else $all = array(); |
|
| 628 | + } else { |
|
| 629 | + $all = array(); |
|
| 630 | + } |
|
| 524 | 631 | } else { |
| 525 | 632 | if ($year == '' && $month == '') { |
| 526 | - 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"; |
|
| 527 | - 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"; |
|
| 633 | + if ($limit) { |
|
| 634 | + $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"; |
|
| 635 | + } else { |
|
| 636 | + $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"; |
|
| 637 | + } |
|
| 528 | 638 | try { |
| 529 | 639 | $sth = $this->db->prepare($query); |
| 530 | 640 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -532,7 +642,9 @@ discard block |
||
| 532 | 642 | echo "error : ".$e->getMessage(); |
| 533 | 643 | } |
| 534 | 644 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 535 | - } else $all = array(); |
|
| 645 | + } else { |
|
| 646 | + $all = array(); |
|
| 647 | + } |
|
| 536 | 648 | } |
| 537 | 649 | if (empty($all)) { |
| 538 | 650 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -551,7 +663,9 @@ discard block |
||
| 551 | 663 | } |
| 552 | 664 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 553 | 665 | $Connection = new Connection($this->db); |
| 554 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 666 | + if ($filter_name == '') { |
|
| 667 | + $filter_name = $this->filter_name; |
|
| 668 | + } |
|
| 555 | 669 | if ($Connection->tableExists('countries')) { |
| 556 | 670 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 557 | 671 | $Spotter = new Spotter($this->db); |
@@ -561,8 +675,11 @@ discard block |
||
| 561 | 675 | foreach ($airlines as $airline) { |
| 562 | 676 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 563 | 677 | } |
| 564 | - 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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 565 | - 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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 678 | + if ($limit) { |
|
| 679 | + $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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 680 | + } else { |
|
| 681 | + $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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 682 | + } |
|
| 566 | 683 | try { |
| 567 | 684 | $sth = $this->db->prepare($query); |
| 568 | 685 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -571,11 +688,16 @@ discard block |
||
| 571 | 688 | } |
| 572 | 689 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 573 | 690 | return $all; |
| 574 | - } else return array(); |
|
| 691 | + } else { |
|
| 692 | + return array(); |
|
| 693 | + } |
|
| 575 | 694 | } else { |
| 576 | 695 | if ($year == '' && $month == '') { |
| 577 | - 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"; |
|
| 578 | - 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"; |
|
| 696 | + if ($limit) { |
|
| 697 | + $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"; |
|
| 698 | + } else { |
|
| 699 | + $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"; |
|
| 700 | + } |
|
| 579 | 701 | try { |
| 580 | 702 | $sth = $this->db->prepare($query); |
| 581 | 703 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -584,20 +706,29 @@ discard block |
||
| 584 | 706 | } |
| 585 | 707 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 586 | 708 | return $all; |
| 587 | - } else return array(); |
|
| 709 | + } else { |
|
| 710 | + return array(); |
|
| 711 | + } |
|
| 588 | 712 | } |
| 589 | 713 | $Spotter = new Spotter($this->db); |
| 590 | 714 | return $Spotter->countAllFlightOverCountries($limit); |
| 591 | - } else return array(); |
|
| 715 | + } else { |
|
| 716 | + return array(); |
|
| 717 | + } |
|
| 592 | 718 | } |
| 593 | 719 | public function countAllMarineOverCountries($limit = true, $filter_name = '',$year = '',$month = '') { |
| 594 | 720 | $Connection = new Connection($this->db); |
| 595 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 721 | + if ($filter_name == '') { |
|
| 722 | + $filter_name = $this->filter_name; |
|
| 723 | + } |
|
| 596 | 724 | if ($Connection->tableExists('countries')) { |
| 597 | 725 | $all = array(); |
| 598 | 726 | if ($year == '' && $month == '') { |
| 599 | - if ($limit) $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC LIMIT 20 OFFSET 0"; |
|
| 600 | - else $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC"; |
|
| 727 | + if ($limit) { |
|
| 728 | + $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC LIMIT 20 OFFSET 0"; |
|
| 729 | + } else { |
|
| 730 | + $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC"; |
|
| 731 | + } |
|
| 601 | 732 | try { |
| 602 | 733 | $sth = $this->db->prepare($query); |
| 603 | 734 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -615,17 +746,24 @@ discard block |
||
| 615 | 746 | $all = $Marine->countAllMarineOverCountries($limit,0,'',$filters); |
| 616 | 747 | } |
| 617 | 748 | return $all; |
| 618 | - } else return array(); |
|
| 749 | + } else { |
|
| 750 | + return array(); |
|
| 751 | + } |
|
| 619 | 752 | } |
| 620 | 753 | public function countAllTrackerOverCountries($limit = true, $filter_name = '',$year = '',$month = '') { |
| 621 | 754 | global $globalStatsFilters; |
| 622 | 755 | $Connection = new Connection($this->db); |
| 623 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 756 | + if ($filter_name == '') { |
|
| 757 | + $filter_name = $this->filter_name; |
|
| 758 | + } |
|
| 624 | 759 | if ($Connection->tableExists('countries')) { |
| 625 | 760 | $all = array(); |
| 626 | 761 | if ($year == '' && $month == '') { |
| 627 | - if ($limit) $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC LIMIT 20 OFFSET 0"; |
|
| 628 | - else $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC"; |
|
| 762 | + if ($limit) { |
|
| 763 | + $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC LIMIT 20 OFFSET 0"; |
|
| 764 | + } else { |
|
| 765 | + $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC"; |
|
| 766 | + } |
|
| 629 | 767 | try { |
| 630 | 768 | $sth = $this->db->prepare($query); |
| 631 | 769 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -644,14 +782,21 @@ discard block |
||
| 644 | 782 | $all = $Tracker->countAllTrackerOverCountries($limit,0,'',$filters); |
| 645 | 783 | } |
| 646 | 784 | return $all; |
| 647 | - } else return array(); |
|
| 785 | + } else { |
|
| 786 | + return array(); |
|
| 787 | + } |
|
| 648 | 788 | } |
| 649 | 789 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
| 650 | 790 | global $globalStatsFilters; |
| 651 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 791 | + if ($filter_name == '') { |
|
| 792 | + $filter_name = $this->filter_name; |
|
| 793 | + } |
|
| 652 | 794 | if ($year == '' && $month == '') { |
| 653 | - 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"; |
|
| 654 | - 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"; |
|
| 795 | + if ($limit) { |
|
| 796 | + $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"; |
|
| 797 | + } else { |
|
| 798 | + $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"; |
|
| 799 | + } |
|
| 655 | 800 | try { |
| 656 | 801 | $sth = $this->db->prepare($query); |
| 657 | 802 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -659,7 +804,9 @@ discard block |
||
| 659 | 804 | echo "error : ".$e->getMessage(); |
| 660 | 805 | } |
| 661 | 806 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 662 | - } else $all = array(); |
|
| 807 | + } else { |
|
| 808 | + $all = array(); |
|
| 809 | + } |
|
| 663 | 810 | if (empty($all)) { |
| 664 | 811 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 665 | 812 | if ($filter_name != '') { |
@@ -674,7 +821,9 @@ discard block |
||
| 674 | 821 | |
| 675 | 822 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 676 | 823 | global $globalStatsFilters; |
| 677 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 824 | + if ($filter_name == '') { |
|
| 825 | + $filter_name = $this->filter_name; |
|
| 826 | + } |
|
| 678 | 827 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 679 | 828 | $Spotter = new Spotter($this->db); |
| 680 | 829 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -683,8 +832,11 @@ discard block |
||
| 683 | 832 | foreach ($airlines as $airline) { |
| 684 | 833 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 685 | 834 | } |
| 686 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 687 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 835 | + if ($limit) { |
|
| 836 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 837 | + } else { |
|
| 838 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 839 | + } |
|
| 688 | 840 | try { |
| 689 | 841 | $sth = $this->db->prepare($query); |
| 690 | 842 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -692,11 +844,16 @@ discard block |
||
| 692 | 844 | echo "error : ".$e->getMessage(); |
| 693 | 845 | } |
| 694 | 846 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 695 | - } else $all = array(); |
|
| 847 | + } else { |
|
| 848 | + $all = array(); |
|
| 849 | + } |
|
| 696 | 850 | } else { |
| 697 | 851 | if ($year == '' && $month == '') { |
| 698 | - 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"; |
|
| 699 | - 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"; |
|
| 852 | + if ($limit) { |
|
| 853 | + $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"; |
|
| 854 | + } else { |
|
| 855 | + $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"; |
|
| 856 | + } |
|
| 700 | 857 | try { |
| 701 | 858 | $sth = $this->db->prepare($query); |
| 702 | 859 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -704,7 +861,9 @@ discard block |
||
| 704 | 861 | echo "error : ".$e->getMessage(); |
| 705 | 862 | } |
| 706 | 863 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 707 | - } else $all = array(); |
|
| 864 | + } else { |
|
| 865 | + $all = array(); |
|
| 866 | + } |
|
| 708 | 867 | } |
| 709 | 868 | if (empty($all)) { |
| 710 | 869 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -723,7 +882,9 @@ discard block |
||
| 723 | 882 | } |
| 724 | 883 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 725 | 884 | global $globalStatsFilters; |
| 726 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 885 | + if ($filter_name == '') { |
|
| 886 | + $filter_name = $this->filter_name; |
|
| 887 | + } |
|
| 727 | 888 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 728 | 889 | $Spotter = new Spotter($this->db); |
| 729 | 890 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -732,8 +893,11 @@ discard block |
||
| 732 | 893 | foreach ($airlines as $airline) { |
| 733 | 894 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 734 | 895 | } |
| 735 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 736 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 896 | + if ($limit) { |
|
| 897 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 898 | + } else { |
|
| 899 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 900 | + } |
|
| 737 | 901 | try { |
| 738 | 902 | $sth = $this->db->prepare($query); |
| 739 | 903 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -741,11 +905,16 @@ discard block |
||
| 741 | 905 | echo "error : ".$e->getMessage(); |
| 742 | 906 | } |
| 743 | 907 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 744 | - } else $all = array(); |
|
| 908 | + } else { |
|
| 909 | + $all = array(); |
|
| 910 | + } |
|
| 745 | 911 | } else { |
| 746 | 912 | if ($year == '' && $month == '') { |
| 747 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 748 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 913 | + if ($limit) { |
|
| 914 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 915 | + } else { |
|
| 916 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 917 | + } |
|
| 749 | 918 | try { |
| 750 | 919 | $sth = $this->db->prepare($query); |
| 751 | 920 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -753,7 +922,9 @@ discard block |
||
| 753 | 922 | echo "error : ".$e->getMessage(); |
| 754 | 923 | } |
| 755 | 924 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 756 | - } else $all = array(); |
|
| 925 | + } else { |
|
| 926 | + $all = array(); |
|
| 927 | + } |
|
| 757 | 928 | } |
| 758 | 929 | if (empty($all)) { |
| 759 | 930 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -778,7 +949,9 @@ discard block |
||
| 778 | 949 | $icao = $value['airport_departure_icao']; |
| 779 | 950 | if (isset($all[$icao])) { |
| 780 | 951 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 781 | - } else $all[$icao] = $value; |
|
| 952 | + } else { |
|
| 953 | + $all[$icao] = $value; |
|
| 954 | + } |
|
| 782 | 955 | } |
| 783 | 956 | $count = array(); |
| 784 | 957 | foreach ($all as $key => $row) { |
@@ -790,7 +963,9 @@ discard block |
||
| 790 | 963 | } |
| 791 | 964 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 792 | 965 | global $globalStatsFilters; |
| 793 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 966 | + if ($filter_name == '') { |
|
| 967 | + $filter_name = $this->filter_name; |
|
| 968 | + } |
|
| 794 | 969 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 795 | 970 | $Spotter = new Spotter($this->db); |
| 796 | 971 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -799,8 +974,11 @@ discard block |
||
| 799 | 974 | foreach ($airlines as $airline) { |
| 800 | 975 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 801 | 976 | } |
| 802 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 803 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 977 | + if ($limit) { |
|
| 978 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 979 | + } else { |
|
| 980 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 981 | + } |
|
| 804 | 982 | try { |
| 805 | 983 | $sth = $this->db->prepare($query); |
| 806 | 984 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -808,11 +986,16 @@ discard block |
||
| 808 | 986 | echo "error : ".$e->getMessage(); |
| 809 | 987 | } |
| 810 | 988 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 811 | - } else $all = array(); |
|
| 989 | + } else { |
|
| 990 | + $all = array(); |
|
| 991 | + } |
|
| 812 | 992 | } else { |
| 813 | 993 | if ($year == '' && $month == '') { |
| 814 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 815 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 994 | + if ($limit) { |
|
| 995 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 996 | + } else { |
|
| 997 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 998 | + } |
|
| 816 | 999 | try { |
| 817 | 1000 | $sth = $this->db->prepare($query); |
| 818 | 1001 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -820,7 +1003,9 @@ discard block |
||
| 820 | 1003 | echo "error : ".$e->getMessage(); |
| 821 | 1004 | } |
| 822 | 1005 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 823 | - } else $all = array(); |
|
| 1006 | + } else { |
|
| 1007 | + $all = array(); |
|
| 1008 | + } |
|
| 824 | 1009 | } |
| 825 | 1010 | if (empty($all)) { |
| 826 | 1011 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -845,7 +1030,9 @@ discard block |
||
| 845 | 1030 | $icao = $value['airport_arrival_icao']; |
| 846 | 1031 | if (isset($all[$icao])) { |
| 847 | 1032 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 848 | - } else $all[$icao] = $value; |
|
| 1033 | + } else { |
|
| 1034 | + $all[$icao] = $value; |
|
| 1035 | + } |
|
| 849 | 1036 | } |
| 850 | 1037 | $count = array(); |
| 851 | 1038 | foreach ($all as $key => $row) { |
@@ -857,7 +1044,9 @@ discard block |
||
| 857 | 1044 | } |
| 858 | 1045 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
| 859 | 1046 | global $globalDBdriver, $globalStatsFilters; |
| 860 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1047 | + if ($filter_name == '') { |
|
| 1048 | + $filter_name = $this->filter_name; |
|
| 1049 | + } |
|
| 861 | 1050 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 862 | 1051 | $Spotter = new Spotter($this->db); |
| 863 | 1052 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -866,20 +1055,32 @@ discard block |
||
| 866 | 1055 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 867 | 1056 | } |
| 868 | 1057 | if ($globalDBdriver == 'mysql') { |
| 869 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 870 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 1058 | + if ($limit) { |
|
| 1059 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 1060 | + } else { |
|
| 1061 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 1062 | + } |
|
| 871 | 1063 | } else { |
| 872 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 873 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 1064 | + if ($limit) { |
|
| 1065 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 1066 | + } else { |
|
| 1067 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 1068 | + } |
|
| 874 | 1069 | } |
| 875 | 1070 | $query_data = array(':filter_name' => $filter_name); |
| 876 | 1071 | } else { |
| 877 | 1072 | if ($globalDBdriver == 'mysql') { |
| 878 | - 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"; |
|
| 879 | - 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"; |
|
| 1073 | + if ($limit) { |
|
| 1074 | + $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"; |
|
| 1075 | + } else { |
|
| 1076 | + $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"; |
|
| 1077 | + } |
|
| 880 | 1078 | } else { |
| 881 | - 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"; |
|
| 882 | - 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"; |
|
| 1079 | + if ($limit) { |
|
| 1080 | + $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"; |
|
| 1081 | + } else { |
|
| 1082 | + $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"; |
|
| 1083 | + } |
|
| 883 | 1084 | } |
| 884 | 1085 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 885 | 1086 | } |
@@ -907,13 +1108,21 @@ discard block |
||
| 907 | 1108 | |
| 908 | 1109 | public function countAllMarineMonthsLastYear($limit = true,$filter_name = '') { |
| 909 | 1110 | global $globalDBdriver, $globalStatsFilters; |
| 910 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1111 | + if ($filter_name == '') { |
|
| 1112 | + $filter_name = $this->filter_name; |
|
| 1113 | + } |
|
| 911 | 1114 | if ($globalDBdriver == 'mysql') { |
| 912 | - 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 = 'marine_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND filter_name = :filter_name"; |
|
| 913 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND filter_name = :filter_name"; |
|
| 1115 | + if ($limit) { |
|
| 1116 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND filter_name = :filter_name"; |
|
| 1117 | + } else { |
|
| 1118 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND filter_name = :filter_name"; |
|
| 1119 | + } |
|
| 914 | 1120 | } else { |
| 915 | - 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 = 'marine_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND filter_name = :filter_name"; |
|
| 916 | - 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 = 'marine_bymonth' AND filter_name = :filter_name"; |
|
| 1121 | + if ($limit) { |
|
| 1122 | + $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 = 'marine_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND filter_name = :filter_name"; |
|
| 1123 | + } else { |
|
| 1124 | + $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 = 'marine_bymonth' AND filter_name = :filter_name"; |
|
| 1125 | + } |
|
| 917 | 1126 | } |
| 918 | 1127 | $query_data = array(':filter_name' => $filter_name); |
| 919 | 1128 | try { |
@@ -936,13 +1145,21 @@ discard block |
||
| 936 | 1145 | |
| 937 | 1146 | public function countAllTrackerMonthsLastYear($limit = true,$filter_name = '') { |
| 938 | 1147 | global $globalDBdriver, $globalStatsFilters; |
| 939 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1148 | + if ($filter_name == '') { |
|
| 1149 | + $filter_name = $this->filter_name; |
|
| 1150 | + } |
|
| 940 | 1151 | if ($globalDBdriver == 'mysql') { |
| 941 | - 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 = 'tracker_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND filter_name = :filter_name"; |
|
| 942 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND filter_name = :filter_name"; |
|
| 1152 | + if ($limit) { |
|
| 1153 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND filter_name = :filter_name"; |
|
| 1154 | + } else { |
|
| 1155 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND filter_name = :filter_name"; |
|
| 1156 | + } |
|
| 943 | 1157 | } else { |
| 944 | - 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 = 'tracker_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND filter_name = :filter_name"; |
|
| 945 | - 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 = 'tracker_bymonth' AND filter_name = :filter_name"; |
|
| 1158 | + if ($limit) { |
|
| 1159 | + $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 = 'tracker_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND filter_name = :filter_name"; |
|
| 1160 | + } else { |
|
| 1161 | + $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 = 'tracker_bymonth' AND filter_name = :filter_name"; |
|
| 1162 | + } |
|
| 946 | 1163 | } |
| 947 | 1164 | $query_data = array(':filter_name' => $filter_name); |
| 948 | 1165 | try { |
@@ -965,7 +1182,9 @@ discard block |
||
| 965 | 1182 | |
| 966 | 1183 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
| 967 | 1184 | global $globalStatsFilters; |
| 968 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1185 | + if ($filter_name == '') { |
|
| 1186 | + $filter_name = $this->filter_name; |
|
| 1187 | + } |
|
| 969 | 1188 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 970 | 1189 | $Spotter = new Spotter($this->db); |
| 971 | 1190 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1002,7 +1221,9 @@ discard block |
||
| 1002 | 1221 | } |
| 1003 | 1222 | public function countAllMarineDatesLastMonth($filter_name = '') { |
| 1004 | 1223 | global $globalStatsFilters; |
| 1005 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1224 | + if ($filter_name == '') { |
|
| 1225 | + $filter_name = $this->filter_name; |
|
| 1226 | + } |
|
| 1006 | 1227 | $query = "SELECT marine_date as date_name, cnt as date_count FROM stats_marine WHERE stats_type = 'month' AND filter_name = :filter_name"; |
| 1007 | 1228 | $query_data = array(':filter_name' => $filter_name); |
| 1008 | 1229 | try { |
@@ -1024,7 +1245,9 @@ discard block |
||
| 1024 | 1245 | } |
| 1025 | 1246 | public function countAllTrackerDatesLastMonth($filter_name = '') { |
| 1026 | 1247 | global $globalStatsFilters; |
| 1027 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1248 | + if ($filter_name == '') { |
|
| 1249 | + $filter_name = $this->filter_name; |
|
| 1250 | + } |
|
| 1028 | 1251 | $query = "SELECT tracker_date as date_name, cnt as date_count FROM stats_tracker WHERE stats_type = 'month' AND filter_name = :filter_name"; |
| 1029 | 1252 | $query_data = array(':filter_name' => $filter_name); |
| 1030 | 1253 | try { |
@@ -1046,7 +1269,9 @@ discard block |
||
| 1046 | 1269 | } |
| 1047 | 1270 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
| 1048 | 1271 | global $globalDBdriver, $globalStatsFilters; |
| 1049 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1272 | + if ($filter_name == '') { |
|
| 1273 | + $filter_name = $this->filter_name; |
|
| 1274 | + } |
|
| 1050 | 1275 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1051 | 1276 | $Spotter = new Spotter($this->db); |
| 1052 | 1277 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1091,7 +1316,9 @@ discard block |
||
| 1091 | 1316 | } |
| 1092 | 1317 | public function countAllMarineDatesLast7Days($filter_name = '') { |
| 1093 | 1318 | global $globalDBdriver, $globalStatsFilters; |
| 1094 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1319 | + if ($filter_name == '') { |
|
| 1320 | + $filter_name = $this->filter_name; |
|
| 1321 | + } |
|
| 1095 | 1322 | if ($globalDBdriver == 'mysql') { |
| 1096 | 1323 | $query = "SELECT marine_date as date_name, cnt as date_count FROM stats_marine WHERE stats_type = 'month' AND marine_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND filter_name = :filter_name"; |
| 1097 | 1324 | } else { |
@@ -1117,7 +1344,9 @@ discard block |
||
| 1117 | 1344 | } |
| 1118 | 1345 | public function countAllTrackerDatesLast7Days($filter_name = '') { |
| 1119 | 1346 | global $globalDBdriver, $globalStatsFilters; |
| 1120 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1347 | + if ($filter_name == '') { |
|
| 1348 | + $filter_name = $this->filter_name; |
|
| 1349 | + } |
|
| 1121 | 1350 | if ($globalDBdriver == 'mysql') { |
| 1122 | 1351 | $query = "SELECT tracker_date as date_name, cnt as date_count FROM stats_tracker WHERE stats_type = 'month' AND tracker_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND filter_name = :filter_name"; |
| 1123 | 1352 | } else { |
@@ -1143,7 +1372,9 @@ discard block |
||
| 1143 | 1372 | } |
| 1144 | 1373 | public function countAllDates($stats_airline = '',$filter_name = '') { |
| 1145 | 1374 | global $globalStatsFilters; |
| 1146 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1375 | + if ($filter_name == '') { |
|
| 1376 | + $filter_name = $this->filter_name; |
|
| 1377 | + } |
|
| 1147 | 1378 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1148 | 1379 | $Spotter = new Spotter($this->db); |
| 1149 | 1380 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1180,7 +1411,9 @@ discard block |
||
| 1180 | 1411 | } |
| 1181 | 1412 | public function countAllDatesMarine($filter_name = '') { |
| 1182 | 1413 | global $globalStatsFilters; |
| 1183 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1414 | + if ($filter_name == '') { |
|
| 1415 | + $filter_name = $this->filter_name; |
|
| 1416 | + } |
|
| 1184 | 1417 | $query = "SELECT marine_date as date_name, cnt as date_count FROM stats_marine WHERE stats_type = 'date' AND filter_name = :filter_name ORDER BY date_count DESC"; |
| 1185 | 1418 | $query_data = array(':filter_name' => $filter_name); |
| 1186 | 1419 | try { |
@@ -1202,7 +1435,9 @@ discard block |
||
| 1202 | 1435 | } |
| 1203 | 1436 | public function countAllDatesTracker($filter_name = '') { |
| 1204 | 1437 | global $globalStatsFilters; |
| 1205 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1438 | + if ($filter_name == '') { |
|
| 1439 | + $filter_name = $this->filter_name; |
|
| 1440 | + } |
|
| 1206 | 1441 | $query = "SELECT tracker_date as date_name, cnt as date_count FROM stats_tracker WHERE stats_type = 'date' AND filter_name = :filter_name ORDER BY date_count DESC"; |
| 1207 | 1442 | $query_data = array(':filter_name' => $filter_name); |
| 1208 | 1443 | try { |
@@ -1224,7 +1459,9 @@ discard block |
||
| 1224 | 1459 | } |
| 1225 | 1460 | public function countAllDatesByAirlines($filter_name = '') { |
| 1226 | 1461 | global $globalStatsFilters; |
| 1227 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1462 | + if ($filter_name == '') { |
|
| 1463 | + $filter_name = $this->filter_name; |
|
| 1464 | + } |
|
| 1228 | 1465 | $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"; |
| 1229 | 1466 | $query_data = array('filter_name' => $filter_name); |
| 1230 | 1467 | try { |
@@ -1246,7 +1483,9 @@ discard block |
||
| 1246 | 1483 | } |
| 1247 | 1484 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
| 1248 | 1485 | global $globalStatsFilters, $globalDBdriver; |
| 1249 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1486 | + if ($filter_name == '') { |
|
| 1487 | + $filter_name = $this->filter_name; |
|
| 1488 | + } |
|
| 1250 | 1489 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1251 | 1490 | $Spotter = new Spotter($this->db); |
| 1252 | 1491 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1331,7 +1570,9 @@ discard block |
||
| 1331 | 1570 | } |
| 1332 | 1571 | public function countAllMilitaryMonths($filter_name = '') { |
| 1333 | 1572 | global $globalStatsFilters; |
| 1334 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1573 | + if ($filter_name == '') { |
|
| 1574 | + $filter_name = $this->filter_name; |
|
| 1575 | + } |
|
| 1335 | 1576 | $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"; |
| 1336 | 1577 | try { |
| 1337 | 1578 | $sth = $this->db->prepare($query); |
@@ -1352,7 +1593,9 @@ discard block |
||
| 1352 | 1593 | } |
| 1353 | 1594 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
| 1354 | 1595 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 1355 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1596 | + if ($filter_name == '') { |
|
| 1597 | + $filter_name = $this->filter_name; |
|
| 1598 | + } |
|
| 1356 | 1599 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1357 | 1600 | $Spotter = new Spotter($this->db); |
| 1358 | 1601 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1360,12 +1603,18 @@ discard block |
||
| 1360 | 1603 | foreach ($airlines as $airline) { |
| 1361 | 1604 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 1362 | 1605 | } |
| 1363 | - if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1364 | - else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1606 | + if ($limit) { |
|
| 1607 | + $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1608 | + } else { |
|
| 1609 | + $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1610 | + } |
|
| 1365 | 1611 | $query_data = array(':filter_name' => $filter_name); |
| 1366 | 1612 | } else { |
| 1367 | - 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"; |
|
| 1368 | - 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"; |
|
| 1613 | + if ($limit) { |
|
| 1614 | + $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"; |
|
| 1615 | + } else { |
|
| 1616 | + $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"; |
|
| 1617 | + } |
|
| 1369 | 1618 | $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
| 1370 | 1619 | } |
| 1371 | 1620 | if ($orderby == 'hour') { |
@@ -1375,7 +1624,9 @@ discard block |
||
| 1375 | 1624 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
| 1376 | 1625 | } |
| 1377 | 1626 | } |
| 1378 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
| 1627 | + if ($orderby == 'count') { |
|
| 1628 | + $query .= " ORDER BY hour_count DESC"; |
|
| 1629 | + } |
|
| 1379 | 1630 | try { |
| 1380 | 1631 | $sth = $this->db->prepare($query); |
| 1381 | 1632 | $sth->execute($query_data); |
@@ -1399,9 +1650,14 @@ discard block |
||
| 1399 | 1650 | } |
| 1400 | 1651 | public function countAllMarineHours($orderby = 'hour',$limit = true,$filter_name = '') { |
| 1401 | 1652 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 1402 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1403 | - if ($limit) $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1404 | - else $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1653 | + if ($filter_name == '') { |
|
| 1654 | + $filter_name = $this->filter_name; |
|
| 1655 | + } |
|
| 1656 | + if ($limit) { |
|
| 1657 | + $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1658 | + } else { |
|
| 1659 | + $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1660 | + } |
|
| 1405 | 1661 | $query_data = array(':filter_name' => $filter_name); |
| 1406 | 1662 | if ($orderby == 'hour') { |
| 1407 | 1663 | if ($globalDBdriver == 'mysql') { |
@@ -1410,7 +1666,9 @@ discard block |
||
| 1410 | 1666 | $query .= " ORDER BY CAST(marine_date AS integer) ASC"; |
| 1411 | 1667 | } |
| 1412 | 1668 | } |
| 1413 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
| 1669 | + if ($orderby == 'count') { |
|
| 1670 | + $query .= " ORDER BY hour_count DESC"; |
|
| 1671 | + } |
|
| 1414 | 1672 | try { |
| 1415 | 1673 | $sth = $this->db->prepare($query); |
| 1416 | 1674 | $sth->execute($query_data); |
@@ -1430,9 +1688,14 @@ discard block |
||
| 1430 | 1688 | } |
| 1431 | 1689 | public function countAllTrackerHours($orderby = 'hour',$limit = true,$filter_name = '') { |
| 1432 | 1690 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 1433 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1434 | - if ($limit) $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1435 | - else $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1691 | + if ($filter_name == '') { |
|
| 1692 | + $filter_name = $this->filter_name; |
|
| 1693 | + } |
|
| 1694 | + if ($limit) { |
|
| 1695 | + $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1696 | + } else { |
|
| 1697 | + $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1698 | + } |
|
| 1436 | 1699 | $query_data = array(':filter_name' => $filter_name); |
| 1437 | 1700 | if ($orderby == 'hour') { |
| 1438 | 1701 | if ($globalDBdriver == 'mysql') { |
@@ -1441,7 +1704,9 @@ discard block |
||
| 1441 | 1704 | $query .= " ORDER BY CAST(tracker_date AS integer) ASC"; |
| 1442 | 1705 | } |
| 1443 | 1706 | } |
| 1444 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
| 1707 | + if ($orderby == 'count') { |
|
| 1708 | + $query .= " ORDER BY hour_count DESC"; |
|
| 1709 | + } |
|
| 1445 | 1710 | try { |
| 1446 | 1711 | $sth = $this->db->prepare($query); |
| 1447 | 1712 | $sth->execute($query_data); |
@@ -1461,8 +1726,12 @@ discard block |
||
| 1461 | 1726 | } |
| 1462 | 1727 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 1463 | 1728 | global $globalStatsFilters; |
| 1464 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1465 | - if ($year == '') $year = date('Y'); |
|
| 1729 | + if ($filter_name == '') { |
|
| 1730 | + $filter_name = $this->filter_name; |
|
| 1731 | + } |
|
| 1732 | + if ($year == '') { |
|
| 1733 | + $year = date('Y'); |
|
| 1734 | + } |
|
| 1466 | 1735 | $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
| 1467 | 1736 | if (empty($all)) { |
| 1468 | 1737 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1481,8 +1750,12 @@ discard block |
||
| 1481 | 1750 | } |
| 1482 | 1751 | public function countOverallMarine($filter_name = '',$year = '',$month = '') { |
| 1483 | 1752 | global $globalStatsFilters; |
| 1484 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1485 | - if ($year == '') $year = date('Y'); |
|
| 1753 | + if ($filter_name == '') { |
|
| 1754 | + $filter_name = $this->filter_name; |
|
| 1755 | + } |
|
| 1756 | + if ($year == '') { |
|
| 1757 | + $year = date('Y'); |
|
| 1758 | + } |
|
| 1486 | 1759 | $all = $this->getSumStats('marine_bymonth',$year,'',$filter_name,$month); |
| 1487 | 1760 | if (empty($all)) { |
| 1488 | 1761 | $filters = array('year' => $year,'month' => $month); |
@@ -1497,8 +1770,12 @@ discard block |
||
| 1497 | 1770 | } |
| 1498 | 1771 | public function countOverallTracker($filter_name = '',$year = '',$month = '') { |
| 1499 | 1772 | global $globalStatsFilters; |
| 1500 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1501 | - if ($year == '') $year = date('Y'); |
|
| 1773 | + if ($filter_name == '') { |
|
| 1774 | + $filter_name = $this->filter_name; |
|
| 1775 | + } |
|
| 1776 | + if ($year == '') { |
|
| 1777 | + $year = date('Y'); |
|
| 1778 | + } |
|
| 1502 | 1779 | $all = $this->getSumStats('tracker_bymonth',$year,'',$filter_name,$month); |
| 1503 | 1780 | if (empty($all)) { |
| 1504 | 1781 | $filters = array('year' => $year,'month' => $month); |
@@ -1513,8 +1790,12 @@ discard block |
||
| 1513 | 1790 | } |
| 1514 | 1791 | public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
| 1515 | 1792 | global $globalStatsFilters; |
| 1516 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1517 | - if ($year == '') $year = date('Y'); |
|
| 1793 | + if ($filter_name == '') { |
|
| 1794 | + $filter_name = $this->filter_name; |
|
| 1795 | + } |
|
| 1796 | + if ($year == '') { |
|
| 1797 | + $year = date('Y'); |
|
| 1798 | + } |
|
| 1518 | 1799 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
| 1519 | 1800 | if (empty($all)) { |
| 1520 | 1801 | $filters = array(); |
@@ -1530,8 +1811,12 @@ discard block |
||
| 1530 | 1811 | } |
| 1531 | 1812 | public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
| 1532 | 1813 | global $globalStatsFilters; |
| 1533 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1534 | - if ($year == '') $year = date('Y'); |
|
| 1814 | + if ($filter_name == '') { |
|
| 1815 | + $filter_name = $this->filter_name; |
|
| 1816 | + } |
|
| 1817 | + if ($year == '') { |
|
| 1818 | + $year = date('Y'); |
|
| 1819 | + } |
|
| 1535 | 1820 | $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
| 1536 | 1821 | if (empty($all)) { |
| 1537 | 1822 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1550,7 +1835,9 @@ discard block |
||
| 1550 | 1835 | } |
| 1551 | 1836 | public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 1552 | 1837 | global $globalStatsFilters; |
| 1553 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1838 | + if ($filter_name == '') { |
|
| 1839 | + $filter_name = $this->filter_name; |
|
| 1840 | + } |
|
| 1554 | 1841 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1555 | 1842 | $Spotter = new Spotter($this->db); |
| 1556 | 1843 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1568,7 +1855,9 @@ discard block |
||
| 1568 | 1855 | } |
| 1569 | 1856 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1570 | 1857 | $all = $result[0]['nb']; |
| 1571 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1858 | + } else { |
|
| 1859 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1860 | + } |
|
| 1572 | 1861 | } else { |
| 1573 | 1862 | if ($year == '' && $month == '') { |
| 1574 | 1863 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1580,7 +1869,9 @@ discard block |
||
| 1580 | 1869 | } |
| 1581 | 1870 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1582 | 1871 | $all = $result[0]['nb']; |
| 1583 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1872 | + } else { |
|
| 1873 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1874 | + } |
|
| 1584 | 1875 | } |
| 1585 | 1876 | if (empty($all)) { |
| 1586 | 1877 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1599,7 +1890,9 @@ discard block |
||
| 1599 | 1890 | } |
| 1600 | 1891 | public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
| 1601 | 1892 | global $globalStatsFilters; |
| 1602 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1893 | + if ($filter_name == '') { |
|
| 1894 | + $filter_name = $this->filter_name; |
|
| 1895 | + } |
|
| 1603 | 1896 | if ($year == '' && $month == '') { |
| 1604 | 1897 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
| 1605 | 1898 | try { |
@@ -1610,7 +1903,9 @@ discard block |
||
| 1610 | 1903 | } |
| 1611 | 1904 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1612 | 1905 | $all = $result[0]['nb_airline']; |
| 1613 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 1906 | + } else { |
|
| 1907 | + $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 1908 | + } |
|
| 1614 | 1909 | if (empty($all)) { |
| 1615 | 1910 | $filters = array(); |
| 1616 | 1911 | $filters = array('year' => $year,'month' => $month); |
@@ -1625,7 +1920,9 @@ discard block |
||
| 1625 | 1920 | } |
| 1626 | 1921 | public function countOverallMarineTypes($filter_name = '',$year = '',$month = '') { |
| 1627 | 1922 | global $globalStatsFilters; |
| 1628 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1923 | + if ($filter_name == '') { |
|
| 1924 | + $filter_name = $this->filter_name; |
|
| 1925 | + } |
|
| 1629 | 1926 | $all = array(); |
| 1630 | 1927 | if ($year == '' && $month == '') { |
| 1631 | 1928 | $query = "SELECT COUNT(*) AS nb_type FROM stats_marine_type WHERE filter_name = :filter_name"; |
@@ -1652,7 +1949,9 @@ discard block |
||
| 1652 | 1949 | } |
| 1653 | 1950 | public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 1654 | 1951 | global $globalStatsFilters; |
| 1655 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1952 | + if ($filter_name == '') { |
|
| 1953 | + $filter_name = $this->filter_name; |
|
| 1954 | + } |
|
| 1656 | 1955 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1657 | 1956 | $Spotter = new Spotter($this->db); |
| 1658 | 1957 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1707,7 +2006,9 @@ discard block |
||
| 1707 | 2006 | } |
| 1708 | 2007 | public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 1709 | 2008 | global $globalStatsFilters; |
| 1710 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2009 | + if ($filter_name == '') { |
|
| 2010 | + $filter_name = $this->filter_name; |
|
| 2011 | + } |
|
| 1711 | 2012 | //if ($year == '') $year = date('Y'); |
| 1712 | 2013 | if ($year == '' && $month == '') { |
| 1713 | 2014 | $query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1736,7 +2037,9 @@ discard block |
||
| 1736 | 2037 | } |
| 1737 | 2038 | |
| 1738 | 2039 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
| 1739 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2040 | + if ($filter_name == '') { |
|
| 2041 | + $filter_name = $this->filter_name; |
|
| 2042 | + } |
|
| 1740 | 2043 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1741 | 2044 | $Spotter = new Spotter($this->db); |
| 1742 | 2045 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1760,7 +2063,9 @@ discard block |
||
| 1760 | 2063 | return $all; |
| 1761 | 2064 | } |
| 1762 | 2065 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
| 1763 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2066 | + if ($filter_name == '') { |
|
| 2067 | + $filter_name = $this->filter_name; |
|
| 2068 | + } |
|
| 1764 | 2069 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
| 1765 | 2070 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 1766 | 2071 | try { |
@@ -1773,7 +2078,9 @@ discard block |
||
| 1773 | 2078 | return $all; |
| 1774 | 2079 | } |
| 1775 | 2080 | public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
| 1776 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2081 | + if ($filter_name == '') { |
|
| 2082 | + $filter_name = $this->filter_name; |
|
| 2083 | + } |
|
| 1777 | 2084 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1778 | 2085 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 1779 | 2086 | try { |
@@ -1784,7 +2091,9 @@ discard block |
||
| 1784 | 2091 | } |
| 1785 | 2092 | } |
| 1786 | 2093 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
| 1787 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2094 | + if ($filter_name == '') { |
|
| 2095 | + $filter_name = $this->filter_name; |
|
| 2096 | + } |
|
| 1788 | 2097 | global $globalArchiveMonths, $globalDBdriver; |
| 1789 | 2098 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1790 | 2099 | $Spotter = new Spotter($this->db); |
@@ -1840,7 +2149,9 @@ discard block |
||
| 1840 | 2149 | } |
| 1841 | 2150 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
| 1842 | 2151 | global $globalArchiveMonths, $globalDBdriver; |
| 1843 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2152 | + if ($filter_name == '') { |
|
| 2153 | + $filter_name = $this->filter_name; |
|
| 2154 | + } |
|
| 1844 | 2155 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1845 | 2156 | $Spotter = new Spotter($this->db); |
| 1846 | 2157 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1873,7 +2184,9 @@ discard block |
||
| 1873 | 2184 | } |
| 1874 | 2185 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
| 1875 | 2186 | global $globalArchiveMonths, $globalDBdriver; |
| 1876 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2187 | + if ($filter_name == '') { |
|
| 2188 | + $filter_name = $this->filter_name; |
|
| 2189 | + } |
|
| 1877 | 2190 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1878 | 2191 | $Spotter = new Spotter($this->db); |
| 1879 | 2192 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1904,7 +2217,9 @@ discard block |
||
| 1904 | 2217 | } |
| 1905 | 2218 | public function getStatsAirlineTotal($filter_name = '') { |
| 1906 | 2219 | global $globalArchiveMonths, $globalDBdriver; |
| 1907 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2220 | + if ($filter_name == '') { |
|
| 2221 | + $filter_name = $this->filter_name; |
|
| 2222 | + } |
|
| 1908 | 2223 | if ($globalDBdriver == 'mysql') { |
| 1909 | 2224 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 1910 | 2225 | } else { |
@@ -1921,7 +2236,9 @@ discard block |
||
| 1921 | 2236 | } |
| 1922 | 2237 | public function getStatsOwnerTotal($filter_name = '') { |
| 1923 | 2238 | global $globalArchiveMonths, $globalDBdriver; |
| 1924 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2239 | + if ($filter_name == '') { |
|
| 2240 | + $filter_name = $this->filter_name; |
|
| 2241 | + } |
|
| 1925 | 2242 | if ($globalDBdriver == 'mysql') { |
| 1926 | 2243 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 1927 | 2244 | } else { |
@@ -1938,7 +2255,9 @@ discard block |
||
| 1938 | 2255 | } |
| 1939 | 2256 | public function getStatsOwner($owner_name,$filter_name = '') { |
| 1940 | 2257 | global $globalArchiveMonths, $globalDBdriver; |
| 1941 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2258 | + if ($filter_name == '') { |
|
| 2259 | + $filter_name = $this->filter_name; |
|
| 2260 | + } |
|
| 1942 | 2261 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
| 1943 | 2262 | try { |
| 1944 | 2263 | $sth = $this->db->prepare($query); |
@@ -1947,12 +2266,17 @@ discard block |
||
| 1947 | 2266 | echo "error : ".$e->getMessage(); |
| 1948 | 2267 | } |
| 1949 | 2268 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1950 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1951 | - else return 0; |
|
| 2269 | + if (isset($all[0]['cnt'])) { |
|
| 2270 | + return $all[0]['cnt']; |
|
| 2271 | + } else { |
|
| 2272 | + return 0; |
|
| 2273 | + } |
|
| 1952 | 2274 | } |
| 1953 | 2275 | public function getStatsPilotTotal($filter_name = '') { |
| 1954 | 2276 | global $globalArchiveMonths, $globalDBdriver; |
| 1955 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2277 | + if ($filter_name == '') { |
|
| 2278 | + $filter_name = $this->filter_name; |
|
| 2279 | + } |
|
| 1956 | 2280 | if ($globalDBdriver == 'mysql') { |
| 1957 | 2281 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
| 1958 | 2282 | } else { |
@@ -1969,7 +2293,9 @@ discard block |
||
| 1969 | 2293 | } |
| 1970 | 2294 | public function getStatsPilot($pilot,$filter_name = '') { |
| 1971 | 2295 | global $globalArchiveMonths, $globalDBdriver; |
| 1972 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2296 | + if ($filter_name == '') { |
|
| 2297 | + $filter_name = $this->filter_name; |
|
| 2298 | + } |
|
| 1973 | 2299 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
| 1974 | 2300 | try { |
| 1975 | 2301 | $sth = $this->db->prepare($query); |
@@ -1978,13 +2304,18 @@ discard block |
||
| 1978 | 2304 | echo "error : ".$e->getMessage(); |
| 1979 | 2305 | } |
| 1980 | 2306 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1981 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1982 | - else return 0; |
|
| 2307 | + if (isset($all[0]['cnt'])) { |
|
| 2308 | + return $all[0]['cnt']; |
|
| 2309 | + } else { |
|
| 2310 | + return 0; |
|
| 2311 | + } |
|
| 1983 | 2312 | } |
| 1984 | 2313 | |
| 1985 | 2314 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 1986 | 2315 | global $globalDBdriver; |
| 1987 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2316 | + if ($filter_name == '') { |
|
| 2317 | + $filter_name = $this->filter_name; |
|
| 2318 | + } |
|
| 1988 | 2319 | if ($globalDBdriver == 'mysql') { |
| 1989 | 2320 | $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"; |
| 1990 | 2321 | } else { |
@@ -2000,7 +2331,9 @@ discard block |
||
| 2000 | 2331 | } |
| 2001 | 2332 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 2002 | 2333 | global $globalDBdriver; |
| 2003 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2334 | + if ($filter_name == '') { |
|
| 2335 | + $filter_name = $this->filter_name; |
|
| 2336 | + } |
|
| 2004 | 2337 | if ($globalDBdriver == 'mysql') { |
| 2005 | 2338 | $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"; |
| 2006 | 2339 | } else { |
@@ -2519,27 +2852,37 @@ discard block |
||
| 2519 | 2852 | date_default_timezone_set('UTC'); |
| 2520 | 2853 | if ((isset($globalMarine) && $globalMarine) || (isset($globalMasterServer) && $globalMasterServer)) { |
| 2521 | 2854 | $last_update = $this->getLastStatsUpdate('last_update_stats_marine'); |
| 2522 | - if ($globalDebug) echo '!!! Update Marine stats !!!'."\n"; |
|
| 2855 | + if ($globalDebug) { |
|
| 2856 | + echo '!!! Update Marine stats !!!'."\n"; |
|
| 2857 | + } |
|
| 2523 | 2858 | if (isset($last_update[0]['value'])) { |
| 2524 | 2859 | $last_update_day = $last_update[0]['value']; |
| 2525 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 2860 | + } else { |
|
| 2861 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 2862 | + } |
|
| 2526 | 2863 | $reset = false; |
| 2527 | 2864 | $Marine = new Marine($this->db); |
| 2528 | 2865 | $filtername = 'marine'; |
| 2529 | 2866 | if ($Connection->tableExists('countries')) { |
| 2530 | - if ($globalDebug) echo 'Count all vessels by countries...'."\n"; |
|
| 2867 | + if ($globalDebug) { |
|
| 2868 | + echo 'Count all vessels by countries...'."\n"; |
|
| 2869 | + } |
|
| 2531 | 2870 | $alldata = $Marine->countAllMarineOverCountries(false,0,$last_update_day); |
| 2532 | 2871 | foreach ($alldata as $number) { |
| 2533 | 2872 | echo $this->addStatCountryMarine($number['marine_country_iso2'],$number['marine_country_iso3'],$number['marine_country'],$number['marine_count'],'','',$reset); |
| 2534 | 2873 | } |
| 2535 | 2874 | } |
| 2536 | - if ($globalDebug) echo 'Count all vessels by months...'."\n"; |
|
| 2875 | + if ($globalDebug) { |
|
| 2876 | + echo 'Count all vessels by months...'."\n"; |
|
| 2877 | + } |
|
| 2537 | 2878 | $last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
| 2538 | 2879 | $filter_last_month = array('since_date' => $last_month); |
| 2539 | 2880 | $alldata = $Marine->countAllMonths($filter_last_month); |
| 2540 | 2881 | $lastyear = false; |
| 2541 | 2882 | foreach ($alldata as $number) { |
| 2542 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 2883 | + if ($number['year_name'] != date('Y')) { |
|
| 2884 | + $lastyear = true; |
|
| 2885 | + } |
|
| 2543 | 2886 | $this->addStat('marine_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 2544 | 2887 | } |
| 2545 | 2888 | echo 'Marine data...'."\n"; |
@@ -2569,7 +2912,9 @@ discard block |
||
| 2569 | 2912 | foreach ($alldata as $number) { |
| 2570 | 2913 | $this->addStatMarine('hour',$number['hour_name'],$number['hour_count']); |
| 2571 | 2914 | } |
| 2572 | - if ($globalDebug) echo 'Count all types...'."\n"; |
|
| 2915 | + if ($globalDebug) { |
|
| 2916 | + echo 'Count all types...'."\n"; |
|
| 2917 | + } |
|
| 2573 | 2918 | $alldata = $Marine->countAllMarineTypes(false,0,$last_update_day); |
| 2574 | 2919 | foreach ($alldata as $number) { |
| 2575 | 2920 | $this->addStatMarineType($number['marine_type'],$number['marine_type_id'],$number['marine_type_count'],'',$reset); |
@@ -2581,26 +2926,36 @@ discard block |
||
| 2581 | 2926 | } |
| 2582 | 2927 | if ((isset($globalTracker) && $globalTracker) || (isset($globalMasterServer) && $globalMasterServer)) { |
| 2583 | 2928 | $last_update = $this->getLastStatsUpdate('last_update_stats_tracker'); |
| 2584 | - if ($globalDebug) echo '!!! Update tracker stats !!!'."\n"; |
|
| 2929 | + if ($globalDebug) { |
|
| 2930 | + echo '!!! Update tracker stats !!!'."\n"; |
|
| 2931 | + } |
|
| 2585 | 2932 | if (isset($last_update[0]['value'])) { |
| 2586 | 2933 | $last_update_day = $last_update[0]['value']; |
| 2587 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 2934 | + } else { |
|
| 2935 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 2936 | + } |
|
| 2588 | 2937 | $reset = false; |
| 2589 | 2938 | $Tracker = new Tracker($this->db); |
| 2590 | 2939 | if ($Connection->tableExists('countries')) { |
| 2591 | - if ($globalDebug) echo 'Count all trackers by countries...'."\n"; |
|
| 2940 | + if ($globalDebug) { |
|
| 2941 | + echo 'Count all trackers by countries...'."\n"; |
|
| 2942 | + } |
|
| 2592 | 2943 | $alldata = $Tracker->countAllTrackerOverCountries(false,0,$last_update_day); |
| 2593 | 2944 | foreach ($alldata as $number) { |
| 2594 | 2945 | $this->addStatCountryTracker($number['tracker_country_iso2'],$number['tracker_country_iso3'],$number['tracker_country'],$number['tracker_count'],'','',$reset); |
| 2595 | 2946 | } |
| 2596 | 2947 | } |
| 2597 | - if ($globalDebug) echo 'Count all vessels by months...'."\n"; |
|
| 2948 | + if ($globalDebug) { |
|
| 2949 | + echo 'Count all vessels by months...'."\n"; |
|
| 2950 | + } |
|
| 2598 | 2951 | $last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
| 2599 | 2952 | $filter_last_month = array('since_date' => $last_month); |
| 2600 | 2953 | $alldata = $Tracker->countAllMonths($filter_last_month); |
| 2601 | 2954 | $lastyear = false; |
| 2602 | 2955 | foreach ($alldata as $number) { |
| 2603 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 2956 | + if ($number['year_name'] != date('Y')) { |
|
| 2957 | + $lastyear = true; |
|
| 2958 | + } |
|
| 2604 | 2959 | $this->addStat('tracker_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 2605 | 2960 | } |
| 2606 | 2961 | echo 'Tracker data...'."\n"; |
@@ -2630,7 +2985,9 @@ discard block |
||
| 2630 | 2985 | foreach ($alldata as $number) { |
| 2631 | 2986 | $this->addStatTracker('hour',$number['hour_name'],$number['hour_count']); |
| 2632 | 2987 | } |
| 2633 | - if ($globalDebug) echo 'Count all types...'."\n"; |
|
| 2988 | + if ($globalDebug) { |
|
| 2989 | + echo 'Count all types...'."\n"; |
|
| 2990 | + } |
|
| 2634 | 2991 | $alldata = $Tracker->countAllTrackerTypes(false,0,$last_update_day); |
| 2635 | 2992 | foreach ($alldata as $number) { |
| 2636 | 2993 | $this->addStatTrackerType($number['tracker_type'],$number['tracker_type_count'],'',$reset); |
@@ -2642,10 +2999,14 @@ discard block |
||
| 2642 | 2999 | |
| 2643 | 3000 | if (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft) || (isset($globalMasterServer) && $globalMasterServer)) { |
| 2644 | 3001 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
| 2645 | - if ($globalDebug) echo '!!! Update aicraft stats !!!'."\n"; |
|
| 3002 | + if ($globalDebug) { |
|
| 3003 | + echo '!!! Update aicraft stats !!!'."\n"; |
|
| 3004 | + } |
|
| 2646 | 3005 | if (isset($last_update[0]['value'])) { |
| 2647 | 3006 | $last_update_day = $last_update[0]['value']; |
| 2648 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 3007 | + } else { |
|
| 3008 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 3009 | + } |
|
| 2649 | 3010 | $reset = false; |
| 2650 | 3011 | //if ($globalStatsResetYear && date('Y',strtotime($last_update_day)) != date('Y')) { |
| 2651 | 3012 | if ($globalStatsResetYear) { |
@@ -2654,43 +3015,63 @@ discard block |
||
| 2654 | 3015 | } |
| 2655 | 3016 | $Spotter = new Spotter($this->db); |
| 2656 | 3017 | |
| 2657 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
| 3018 | + if ($globalDebug) { |
|
| 3019 | + echo 'Count all aircraft types...'."\n"; |
|
| 3020 | + } |
|
| 2658 | 3021 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
| 2659 | 3022 | foreach ($alldata as $number) { |
| 2660 | 3023 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
| 2661 | 3024 | } |
| 2662 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
| 3025 | + if ($globalDebug) { |
|
| 3026 | + echo 'Count all airlines...'."\n"; |
|
| 3027 | + } |
|
| 2663 | 3028 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
| 2664 | 3029 | foreach ($alldata as $number) { |
| 2665 | 3030 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
| 2666 | 3031 | } |
| 2667 | - if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
| 3032 | + if ($globalDebug) { |
|
| 3033 | + echo 'Count all registrations...'."\n"; |
|
| 3034 | + } |
|
| 2668 | 3035 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
| 2669 | 3036 | foreach ($alldata as $number) { |
| 2670 | 3037 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
| 2671 | 3038 | } |
| 2672 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
| 3039 | + if ($globalDebug) { |
|
| 3040 | + echo 'Count all callsigns...'."\n"; |
|
| 3041 | + } |
|
| 2673 | 3042 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
| 2674 | 3043 | foreach ($alldata as $number) { |
| 2675 | 3044 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 2676 | 3045 | } |
| 2677 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
| 3046 | + if ($globalDebug) { |
|
| 3047 | + echo 'Count all owners...'."\n"; |
|
| 3048 | + } |
|
| 2678 | 3049 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
| 2679 | 3050 | foreach ($alldata as $number) { |
| 2680 | 3051 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
| 2681 | 3052 | } |
| 2682 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
| 3053 | + if ($globalDebug) { |
|
| 3054 | + echo 'Count all pilots...'."\n"; |
|
| 3055 | + } |
|
| 2683 | 3056 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
| 2684 | 3057 | foreach ($alldata as $number) { |
| 2685 | - if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name']; |
|
| 3058 | + if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') { |
|
| 3059 | + $number['pilot_id'] = $number['pilot_name']; |
|
| 3060 | + } |
|
| 2686 | 3061 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
| 2687 | 3062 | } |
| 2688 | 3063 | |
| 2689 | - if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
| 3064 | + if ($globalDebug) { |
|
| 3065 | + echo 'Count all departure airports...'."\n"; |
|
| 3066 | + } |
|
| 2690 | 3067 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
| 2691 | - if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
| 3068 | + if ($globalDebug) { |
|
| 3069 | + echo 'Count all detected departure airports...'."\n"; |
|
| 3070 | + } |
|
| 2692 | 3071 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
| 2693 | - if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
| 3072 | + if ($globalDebug) { |
|
| 3073 | + echo 'Order departure airports...'."\n"; |
|
| 3074 | + } |
|
| 2694 | 3075 | $alldata = array(); |
| 2695 | 3076 | foreach ($pall as $value) { |
| 2696 | 3077 | $icao = $value['airport_departure_icao']; |
@@ -2700,7 +3081,9 @@ discard block |
||
| 2700 | 3081 | $icao = $value['airport_departure_icao']; |
| 2701 | 3082 | if (isset($alldata[$icao])) { |
| 2702 | 3083 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 2703 | - } else $alldata[$icao] = $value; |
|
| 3084 | + } else { |
|
| 3085 | + $alldata[$icao] = $value; |
|
| 3086 | + } |
|
| 2704 | 3087 | } |
| 2705 | 3088 | $count = array(); |
| 2706 | 3089 | foreach ($alldata as $key => $row) { |
@@ -2710,11 +3093,17 @@ discard block |
||
| 2710 | 3093 | foreach ($alldata as $number) { |
| 2711 | 3094 | 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); |
| 2712 | 3095 | } |
| 2713 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
| 3096 | + if ($globalDebug) { |
|
| 3097 | + echo 'Count all arrival airports...'."\n"; |
|
| 3098 | + } |
|
| 2714 | 3099 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
| 2715 | - if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
| 3100 | + if ($globalDebug) { |
|
| 3101 | + echo 'Count all detected arrival airports...'."\n"; |
|
| 3102 | + } |
|
| 2716 | 3103 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
| 2717 | - if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
| 3104 | + if ($globalDebug) { |
|
| 3105 | + echo 'Order arrival airports...'."\n"; |
|
| 3106 | + } |
|
| 2718 | 3107 | $alldata = array(); |
| 2719 | 3108 | foreach ($pall as $value) { |
| 2720 | 3109 | $icao = $value['airport_arrival_icao']; |
@@ -2724,7 +3113,9 @@ discard block |
||
| 2724 | 3113 | $icao = $value['airport_arrival_icao']; |
| 2725 | 3114 | if (isset($alldata[$icao])) { |
| 2726 | 3115 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 2727 | - } else $alldata[$icao] = $value; |
|
| 3116 | + } else { |
|
| 3117 | + $alldata[$icao] = $value; |
|
| 3118 | + } |
|
| 2728 | 3119 | } |
| 2729 | 3120 | $count = array(); |
| 2730 | 3121 | foreach ($alldata as $key => $row) { |
@@ -2735,7 +3126,9 @@ discard block |
||
| 2735 | 3126 | 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); |
| 2736 | 3127 | } |
| 2737 | 3128 | if ($Connection->tableExists('countries')) { |
| 2738 | - if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
| 3129 | + if ($globalDebug) { |
|
| 3130 | + echo 'Count all flights by countries...'."\n"; |
|
| 3131 | + } |
|
| 2739 | 3132 | //$SpotterArchive = new SpotterArchive(); |
| 2740 | 3133 | //$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
| 2741 | 3134 | $Spotter = new Spotter($this->db); |
@@ -2746,7 +3139,9 @@ discard block |
||
| 2746 | 3139 | } |
| 2747 | 3140 | |
| 2748 | 3141 | if (isset($globalAccidents) && $globalAccidents) { |
| 2749 | - if ($globalDebug) echo 'Count fatalities stats...'."\n"; |
|
| 3142 | + if ($globalDebug) { |
|
| 3143 | + echo 'Count fatalities stats...'."\n"; |
|
| 3144 | + } |
|
| 2750 | 3145 | $Accident = new Accident($this->db); |
| 2751 | 3146 | $this->deleteStatsByType('fatalities_byyear'); |
| 2752 | 3147 | $alldata = $Accident->countFatalitiesByYear(); |
@@ -2762,48 +3157,68 @@ discard block |
||
| 2762 | 3157 | |
| 2763 | 3158 | // Add by month using getstat if month finish... |
| 2764 | 3159 | //if (date('m',strtotime($last_update_day)) != date('m')) { |
| 2765 | - if ($globalDebug) echo 'Count all flights by months...'."\n"; |
|
| 3160 | + if ($globalDebug) { |
|
| 3161 | + echo 'Count all flights by months...'."\n"; |
|
| 3162 | + } |
|
| 2766 | 3163 | $last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
| 2767 | 3164 | $filter_last_month = array('since_date' => $last_month); |
| 2768 | 3165 | $Spotter = new Spotter($this->db); |
| 2769 | 3166 | $alldata = $Spotter->countAllMonths($filter_last_month); |
| 2770 | 3167 | $lastyear = false; |
| 2771 | 3168 | foreach ($alldata as $number) { |
| 2772 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 3169 | + if ($number['year_name'] != date('Y')) { |
|
| 3170 | + $lastyear = true; |
|
| 3171 | + } |
|
| 2773 | 3172 | $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']))); |
| 2774 | 3173 | } |
| 2775 | - if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
| 3174 | + if ($globalDebug) { |
|
| 3175 | + echo 'Count all military flights by months...'."\n"; |
|
| 3176 | + } |
|
| 2776 | 3177 | $alldata = $Spotter->countAllMilitaryMonths($filter_last_month); |
| 2777 | 3178 | foreach ($alldata as $number) { |
| 2778 | 3179 | $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']))); |
| 2779 | 3180 | } |
| 2780 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
| 3181 | + if ($globalDebug) { |
|
| 3182 | + echo 'Count all owners by months...'."\n"; |
|
| 3183 | + } |
|
| 2781 | 3184 | $alldata = $Spotter->countAllMonthsOwners($filter_last_month); |
| 2782 | 3185 | foreach ($alldata as $number) { |
| 2783 | 3186 | $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']))); |
| 2784 | 3187 | } |
| 2785 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
| 3188 | + if ($globalDebug) { |
|
| 3189 | + echo 'Count all pilots by months...'."\n"; |
|
| 3190 | + } |
|
| 2786 | 3191 | $alldata = $Spotter->countAllMonthsPilots($filter_last_month); |
| 2787 | 3192 | foreach ($alldata as $number) { |
| 2788 | 3193 | $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']))); |
| 2789 | 3194 | } |
| 2790 | - if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
| 3195 | + if ($globalDebug) { |
|
| 3196 | + echo 'Count all airlines by months...'."\n"; |
|
| 3197 | + } |
|
| 2791 | 3198 | $alldata = $Spotter->countAllMonthsAirlines($filter_last_month); |
| 2792 | 3199 | foreach ($alldata as $number) { |
| 2793 | 3200 | $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']))); |
| 2794 | 3201 | } |
| 2795 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
| 3202 | + if ($globalDebug) { |
|
| 3203 | + echo 'Count all aircrafts by months...'."\n"; |
|
| 3204 | + } |
|
| 2796 | 3205 | $alldata = $Spotter->countAllMonthsAircrafts($filter_last_month); |
| 2797 | 3206 | foreach ($alldata as $number) { |
| 2798 | 3207 | $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']))); |
| 2799 | 3208 | } |
| 2800 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
| 3209 | + if ($globalDebug) { |
|
| 3210 | + echo 'Count all real arrivals by months...'."\n"; |
|
| 3211 | + } |
|
| 2801 | 3212 | $alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month); |
| 2802 | 3213 | foreach ($alldata as $number) { |
| 2803 | 3214 | $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']))); |
| 2804 | 3215 | } |
| 2805 | - if ($globalDebug) echo 'Airports data...'."\n"; |
|
| 2806 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 3216 | + if ($globalDebug) { |
|
| 3217 | + echo 'Airports data...'."\n"; |
|
| 3218 | + } |
|
| 3219 | + if ($globalDebug) { |
|
| 3220 | + echo '...Departure'."\n"; |
|
| 3221 | + } |
|
| 2807 | 3222 | $this->deleteStatAirport('daily'); |
| 2808 | 3223 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 2809 | 3224 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
@@ -2921,7 +3336,9 @@ discard block |
||
| 2921 | 3336 | // Count by airlines |
| 2922 | 3337 | echo '--- Stats by airlines ---'."\n"; |
| 2923 | 3338 | if ($Connection->tableExists('countries')) { |
| 2924 | - if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
|
| 3339 | + if ($globalDebug) { |
|
| 3340 | + echo 'Count all flights by countries by airlines...'."\n"; |
|
| 3341 | + } |
|
| 2925 | 3342 | $SpotterArchive = new SpotterArchive($this->db); |
| 2926 | 3343 | //$Spotter = new Spotter($this->db); |
| 2927 | 3344 | $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
@@ -2930,37 +3347,53 @@ discard block |
||
| 2930 | 3347 | $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
| 2931 | 3348 | } |
| 2932 | 3349 | } |
| 2933 | - if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
| 3350 | + if ($globalDebug) { |
|
| 3351 | + echo 'Count all aircraft types by airlines...'."\n"; |
|
| 3352 | + } |
|
| 2934 | 3353 | $Spotter = new Spotter($this->db); |
| 2935 | 3354 | $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
| 2936 | 3355 | foreach ($alldata as $number) { |
| 2937 | 3356 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
| 2938 | 3357 | } |
| 2939 | - if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 3358 | + if ($globalDebug) { |
|
| 3359 | + echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 3360 | + } |
|
| 2940 | 3361 | $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
| 2941 | 3362 | foreach ($alldata as $number) { |
| 2942 | 3363 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
| 2943 | 3364 | } |
| 2944 | - if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
| 3365 | + if ($globalDebug) { |
|
| 3366 | + echo 'Count all callsigns by airlines...'."\n"; |
|
| 3367 | + } |
|
| 2945 | 3368 | $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
| 2946 | 3369 | foreach ($alldata as $number) { |
| 2947 | 3370 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 2948 | 3371 | } |
| 2949 | - if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
| 3372 | + if ($globalDebug) { |
|
| 3373 | + echo 'Count all owners by airlines...'."\n"; |
|
| 3374 | + } |
|
| 2950 | 3375 | $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
| 2951 | 3376 | foreach ($alldata as $number) { |
| 2952 | 3377 | $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
| 2953 | 3378 | } |
| 2954 | - if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
| 3379 | + if ($globalDebug) { |
|
| 3380 | + echo 'Count all pilots by airlines...'."\n"; |
|
| 3381 | + } |
|
| 2955 | 3382 | $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
| 2956 | 3383 | foreach ($alldata as $number) { |
| 2957 | 3384 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
| 2958 | 3385 | } |
| 2959 | - if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
| 3386 | + if ($globalDebug) { |
|
| 3387 | + echo 'Count all departure airports by airlines...'."\n"; |
|
| 3388 | + } |
|
| 2960 | 3389 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
| 2961 | - if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 3390 | + if ($globalDebug) { |
|
| 3391 | + echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 3392 | + } |
|
| 2962 | 3393 | $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
| 2963 | - if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
| 3394 | + if ($globalDebug) { |
|
| 3395 | + echo 'Order detected departure airports by airlines...'."\n"; |
|
| 3396 | + } |
|
| 2964 | 3397 | //$alldata = array(); |
| 2965 | 3398 | foreach ($dall as $value) { |
| 2966 | 3399 | $icao = $value['airport_departure_icao']; |
@@ -2981,11 +3414,17 @@ discard block |
||
| 2981 | 3414 | foreach ($alldata as $number) { |
| 2982 | 3415 | 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); |
| 2983 | 3416 | } |
| 2984 | - if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
| 3417 | + if ($globalDebug) { |
|
| 3418 | + echo 'Count all arrival airports by airlines...'."\n"; |
|
| 3419 | + } |
|
| 2985 | 3420 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
| 2986 | - if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 3421 | + if ($globalDebug) { |
|
| 3422 | + echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 3423 | + } |
|
| 2987 | 3424 | $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
| 2988 | - if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
| 3425 | + if ($globalDebug) { |
|
| 3426 | + echo 'Order arrival airports by airlines...'."\n"; |
|
| 3427 | + } |
|
| 2989 | 3428 | //$alldata = array(); |
| 2990 | 3429 | foreach ($dall as $value) { |
| 2991 | 3430 | $icao = $value['airport_arrival_icao']; |
@@ -3004,37 +3443,53 @@ discard block |
||
| 3004 | 3443 | } |
| 3005 | 3444 | $alldata = $pall; |
| 3006 | 3445 | foreach ($alldata as $number) { |
| 3007 | - 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); |
|
| 3446 | + if ($number['airline_icao'] != '') { |
|
| 3447 | + 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); |
|
| 3448 | + } |
|
| 3449 | + } |
|
| 3450 | + if ($globalDebug) { |
|
| 3451 | + echo 'Count all flights by months by airlines...'."\n"; |
|
| 3008 | 3452 | } |
| 3009 | - if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
| 3010 | 3453 | $Spotter = new Spotter($this->db); |
| 3011 | 3454 | $alldata = $Spotter->countAllMonthsByAirlines($filter_last_month); |
| 3012 | 3455 | $lastyear = false; |
| 3013 | 3456 | foreach ($alldata as $number) { |
| 3014 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 3457 | + if ($number['year_name'] != date('Y')) { |
|
| 3458 | + $lastyear = true; |
|
| 3459 | + } |
|
| 3015 | 3460 | $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']); |
| 3016 | 3461 | } |
| 3017 | - if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
| 3462 | + if ($globalDebug) { |
|
| 3463 | + echo 'Count all owners by months by airlines...'."\n"; |
|
| 3464 | + } |
|
| 3018 | 3465 | $alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month); |
| 3019 | 3466 | foreach ($alldata as $number) { |
| 3020 | 3467 | $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']); |
| 3021 | 3468 | } |
| 3022 | - if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
| 3469 | + if ($globalDebug) { |
|
| 3470 | + echo 'Count all pilots by months by airlines...'."\n"; |
|
| 3471 | + } |
|
| 3023 | 3472 | $alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month); |
| 3024 | 3473 | foreach ($alldata as $number) { |
| 3025 | 3474 | $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']); |
| 3026 | 3475 | } |
| 3027 | - if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 3476 | + if ($globalDebug) { |
|
| 3477 | + echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 3478 | + } |
|
| 3028 | 3479 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month); |
| 3029 | 3480 | foreach ($alldata as $number) { |
| 3030 | 3481 | $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']); |
| 3031 | 3482 | } |
| 3032 | - if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 3483 | + if ($globalDebug) { |
|
| 3484 | + echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 3485 | + } |
|
| 3033 | 3486 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month); |
| 3034 | 3487 | foreach ($alldata as $number) { |
| 3035 | 3488 | $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']); |
| 3036 | 3489 | } |
| 3037 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 3490 | + if ($globalDebug) { |
|
| 3491 | + echo '...Departure'."\n"; |
|
| 3492 | + } |
|
| 3038 | 3493 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
| 3039 | 3494 | $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
| 3040 | 3495 | foreach ($dall as $value) { |
@@ -3057,7 +3512,9 @@ discard block |
||
| 3057 | 3512 | foreach ($alldata as $number) { |
| 3058 | 3513 | $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']); |
| 3059 | 3514 | } |
| 3060 | - if ($globalDebug) echo '...Arrival'."\n"; |
|
| 3515 | + if ($globalDebug) { |
|
| 3516 | + echo '...Arrival'."\n"; |
|
| 3517 | + } |
|
| 3061 | 3518 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
| 3062 | 3519 | $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
| 3063 | 3520 | foreach ($dall as $value) { |
@@ -3081,13 +3538,19 @@ discard block |
||
| 3081 | 3538 | $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']); |
| 3082 | 3539 | } |
| 3083 | 3540 | |
| 3084 | - if ($globalDebug) echo 'Flights data...'."\n"; |
|
| 3085 | - if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
| 3541 | + if ($globalDebug) { |
|
| 3542 | + echo 'Flights data...'."\n"; |
|
| 3543 | + } |
|
| 3544 | + if ($globalDebug) { |
|
| 3545 | + echo '-> countAllDatesLastMonth...'."\n"; |
|
| 3546 | + } |
|
| 3086 | 3547 | $alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month); |
| 3087 | 3548 | foreach ($alldata as $number) { |
| 3088 | 3549 | $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
| 3089 | 3550 | } |
| 3090 | - if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
| 3551 | + if ($globalDebug) { |
|
| 3552 | + echo '-> countAllDates...'."\n"; |
|
| 3553 | + } |
|
| 3091 | 3554 | //$previousdata = $this->countAllDatesByAirlines(); |
| 3092 | 3555 | $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month)); |
| 3093 | 3556 | $values = array(); |
@@ -3100,14 +3563,18 @@ discard block |
||
| 3100 | 3563 | $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
| 3101 | 3564 | } |
| 3102 | 3565 | |
| 3103 | - if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
| 3566 | + if ($globalDebug) { |
|
| 3567 | + echo '-> countAllHours...'."\n"; |
|
| 3568 | + } |
|
| 3104 | 3569 | $alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month); |
| 3105 | 3570 | foreach ($alldata as $number) { |
| 3106 | 3571 | $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
| 3107 | 3572 | } |
| 3108 | 3573 | |
| 3109 | 3574 | // Stats by filters |
| 3110 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
| 3575 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
| 3576 | + $globalStatsFilters = array(); |
|
| 3577 | + } |
|
| 3111 | 3578 | foreach ($globalStatsFilters as $name => $filter) { |
| 3112 | 3579 | if (!empty($filter)) { |
| 3113 | 3580 | //$filter_name = $filter['name']; |
@@ -3115,7 +3582,9 @@ discard block |
||
| 3115 | 3582 | $reset = false; |
| 3116 | 3583 | $last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name); |
| 3117 | 3584 | if (isset($filter['resetall']) && isset($last_update[0]['value']) && strtotime($filter['resetall']) > strtotime($last_update[0]['value'])) { |
| 3118 | - if ($globalDebug) echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
| 3585 | + if ($globalDebug) { |
|
| 3586 | + echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
| 3587 | + } |
|
| 3119 | 3588 | $this->deleteOldStats($filter_name); |
| 3120 | 3589 | unset($last_update); |
| 3121 | 3590 | } |
@@ -3132,39 +3601,55 @@ discard block |
||
| 3132 | 3601 | $reset = true; |
| 3133 | 3602 | } |
| 3134 | 3603 | // Count by filter |
| 3135 | - if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 3604 | + if ($globalDebug) { |
|
| 3605 | + echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 3606 | + } |
|
| 3136 | 3607 | $Spotter = new Spotter($this->db); |
| 3137 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
| 3608 | + if ($globalDebug) { |
|
| 3609 | + echo 'Count all aircraft types...'."\n"; |
|
| 3610 | + } |
|
| 3138 | 3611 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
| 3139 | 3612 | foreach ($alldata as $number) { |
| 3140 | 3613 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
| 3141 | 3614 | } |
| 3142 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
| 3615 | + if ($globalDebug) { |
|
| 3616 | + echo 'Count all airlines...'."\n"; |
|
| 3617 | + } |
|
| 3143 | 3618 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
| 3144 | 3619 | foreach ($alldata as $number) { |
| 3145 | 3620 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
| 3146 | 3621 | } |
| 3147 | - if ($globalDebug) echo 'Count all aircraft registrations...'."\n"; |
|
| 3622 | + if ($globalDebug) { |
|
| 3623 | + echo 'Count all aircraft registrations...'."\n"; |
|
| 3624 | + } |
|
| 3148 | 3625 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
| 3149 | 3626 | foreach ($alldata as $number) { |
| 3150 | 3627 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
| 3151 | 3628 | } |
| 3152 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
| 3629 | + if ($globalDebug) { |
|
| 3630 | + echo 'Count all callsigns...'."\n"; |
|
| 3631 | + } |
|
| 3153 | 3632 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
| 3154 | 3633 | foreach ($alldata as $number) { |
| 3155 | 3634 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
| 3156 | 3635 | } |
| 3157 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
| 3636 | + if ($globalDebug) { |
|
| 3637 | + echo 'Count all owners...'."\n"; |
|
| 3638 | + } |
|
| 3158 | 3639 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
| 3159 | 3640 | foreach ($alldata as $number) { |
| 3160 | 3641 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
| 3161 | 3642 | } |
| 3162 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
| 3643 | + if ($globalDebug) { |
|
| 3644 | + echo 'Count all pilots...'."\n"; |
|
| 3645 | + } |
|
| 3163 | 3646 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
| 3164 | 3647 | foreach ($alldata as $number) { |
| 3165 | 3648 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
| 3166 | 3649 | } |
| 3167 | - if ($globalDebug) echo 'Count departure airports...'."\n"; |
|
| 3650 | + if ($globalDebug) { |
|
| 3651 | + echo 'Count departure airports...'."\n"; |
|
| 3652 | + } |
|
| 3168 | 3653 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
| 3169 | 3654 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
| 3170 | 3655 | $alldata = array(); |
@@ -3176,7 +3661,9 @@ discard block |
||
| 3176 | 3661 | $icao = $value['airport_departure_icao']; |
| 3177 | 3662 | if (isset($alldata[$icao])) { |
| 3178 | 3663 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 3179 | - } else $alldata[$icao] = $value; |
|
| 3664 | + } else { |
|
| 3665 | + $alldata[$icao] = $value; |
|
| 3666 | + } |
|
| 3180 | 3667 | } |
| 3181 | 3668 | $count = array(); |
| 3182 | 3669 | foreach ($alldata as $key => $row) { |
@@ -3186,7 +3673,9 @@ discard block |
||
| 3186 | 3673 | foreach ($alldata as $number) { |
| 3187 | 3674 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
| 3188 | 3675 | } |
| 3189 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
| 3676 | + if ($globalDebug) { |
|
| 3677 | + echo 'Count all arrival airports...'."\n"; |
|
| 3678 | + } |
|
| 3190 | 3679 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
| 3191 | 3680 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
| 3192 | 3681 | $alldata = array(); |
@@ -3198,7 +3687,9 @@ discard block |
||
| 3198 | 3687 | $icao = $value['airport_arrival_icao']; |
| 3199 | 3688 | if (isset($alldata[$icao])) { |
| 3200 | 3689 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 3201 | - } else $alldata[$icao] = $value; |
|
| 3690 | + } else { |
|
| 3691 | + $alldata[$icao] = $value; |
|
| 3692 | + } |
|
| 3202 | 3693 | } |
| 3203 | 3694 | $count = array(); |
| 3204 | 3695 | foreach ($alldata as $key => $row) { |
@@ -3208,35 +3699,49 @@ discard block |
||
| 3208 | 3699 | foreach ($alldata as $number) { |
| 3209 | 3700 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset); |
| 3210 | 3701 | } |
| 3211 | - if ($globalDebug) echo 'Count all months...'."\n"; |
|
| 3702 | + if ($globalDebug) { |
|
| 3703 | + echo 'Count all months...'."\n"; |
|
| 3704 | + } |
|
| 3212 | 3705 | $Spotter = new Spotter($this->db); |
| 3213 | 3706 | $alldata = $Spotter->countAllMonths($filter); |
| 3214 | 3707 | $lastyear = false; |
| 3215 | 3708 | foreach ($alldata as $number) { |
| 3216 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 3709 | + if ($number['year_name'] != date('Y')) { |
|
| 3710 | + $lastyear = true; |
|
| 3711 | + } |
|
| 3217 | 3712 | $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); |
| 3218 | 3713 | } |
| 3219 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
| 3714 | + if ($globalDebug) { |
|
| 3715 | + echo 'Count all owners by months...'."\n"; |
|
| 3716 | + } |
|
| 3220 | 3717 | $alldata = $Spotter->countAllMonthsOwners($filter); |
| 3221 | 3718 | foreach ($alldata as $number) { |
| 3222 | 3719 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 3223 | 3720 | } |
| 3224 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
| 3721 | + if ($globalDebug) { |
|
| 3722 | + echo 'Count all pilots by months...'."\n"; |
|
| 3723 | + } |
|
| 3225 | 3724 | $alldata = $Spotter->countAllMonthsPilots($filter); |
| 3226 | 3725 | foreach ($alldata as $number) { |
| 3227 | 3726 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 3228 | 3727 | } |
| 3229 | - if ($globalDebug) echo 'Count all military by months...'."\n"; |
|
| 3728 | + if ($globalDebug) { |
|
| 3729 | + echo 'Count all military by months...'."\n"; |
|
| 3730 | + } |
|
| 3230 | 3731 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
| 3231 | 3732 | foreach ($alldata as $number) { |
| 3232 | 3733 | $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 3233 | 3734 | } |
| 3234 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
| 3735 | + if ($globalDebug) { |
|
| 3736 | + echo 'Count all aircrafts by months...'."\n"; |
|
| 3737 | + } |
|
| 3235 | 3738 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
| 3236 | 3739 | foreach ($alldata as $number) { |
| 3237 | 3740 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 3238 | 3741 | } |
| 3239 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
| 3742 | + if ($globalDebug) { |
|
| 3743 | + echo 'Count all real arrivals by months...'."\n"; |
|
| 3744 | + } |
|
| 3240 | 3745 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
| 3241 | 3746 | foreach ($alldata as $number) { |
| 3242 | 3747 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |