@@ -29,18 +29,18 @@ discard block |
||
| 29 | 29 | $currentdate = date('Y-m-d'); |
| 30 | 30 | $sourcestat = $Stats->getStatsSource($currentdate); |
| 31 | 31 | if (!empty($sourcestat)) { |
| 32 | - foreach($sourcestat as $srcst) { |
|
| 32 | + foreach ($sourcestat as $srcst) { |
|
| 33 | 33 | $type = $srcst['stats_type']; |
| 34 | 34 | if ($type == 'polar' || $type == 'hist') { |
| 35 | 35 | $source = $srcst['source_name']; |
| 36 | 36 | $data = $srcst['source_data']; |
| 37 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 37 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function get_Schedule($id,$ident) { |
|
| 43 | + public function get_Schedule($id, $ident) { |
|
| 44 | 44 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
| 45 | 45 | // Get schedule here, so it's done only one time |
| 46 | 46 | |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | $schedule = $Schedule->fetchSchedule($operator); |
| 65 | 65 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 66 | 66 | if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
| 67 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 68 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 67 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 68 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 69 | 69 | // Should also check if route schedule = route from DB |
| 70 | 70 | if ($schedule['DepartureAirportIATA'] != '') { |
| 71 | 71 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 88 | + $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 116 | 116 | $Spotter = new Spotter($this->db); |
| 117 | 117 | $real_arrival = $this->arrival($key); |
| 118 | - $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 118 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $airport_time = ''; |
| 129 | 129 | if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
| 130 | 130 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 131 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 131 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
| 132 | 132 | if (isset($closestAirports[0])) { |
| 133 | 133 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
| 134 | 134 | $airport_icao = $closestAirports[0]['icao']; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | break; |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 146 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) { |
|
| 147 | 147 | $airport_icao = $closestAirports[0]['icao']; |
| 148 | 148 | $airport_time = $this->all_flights[$key]['datetime']; |
| 149 | 149 | } else { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | } else { |
| 157 | 157 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
| 158 | 158 | } |
| 159 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 159 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 168 | 168 | foreach ($this->all_flights as $key => $flight) { |
| 169 | 169 | if (isset($flight['lastupdate'])) { |
| 170 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 170 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
| 171 | 171 | if (isset($this->all_flights[$key]['id'])) { |
| 172 | 172 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
| 173 | 173 | /* |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $real_arrival = $this->arrival($key); |
| 179 | 179 | $Spotter = new Spotter($this->db); |
| 180 | 180 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 181 | - $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 181 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
| 182 | 182 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 183 | 183 | } |
| 184 | 184 | // Put in archive |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $send = false; |
| 215 | 215 | |
| 216 | 216 | // SBS format is CSV format |
| 217 | - if(is_array($line) && isset($line['hex'])) { |
|
| 217 | + if (is_array($line) && isset($line['hex'])) { |
|
| 218 | 218 | //print_r($line); |
| 219 | 219 | if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
| 220 | 220 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | //print_r($this->all_flights); |
| 249 | 249 | if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) { |
| 250 | 250 | $this->all_flights[$id] = array('hex' => $hex); |
| 251 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 251 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 252 | 252 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 253 | 253 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 254 | 254 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $Spotter = new Spotter($this->db); |
| 259 | 259 | $aircraft_icao = $Spotter->getAllAircraftType($hex); |
| 260 | 260 | $Spotter->db = null; |
| 261 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 261 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 262 | 262 | |
| 263 | 263 | if ($aircraft_icao == '' && isset($line['aircraft_type'])) { |
| 264 | 264 | if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
@@ -266,32 +266,32 @@ discard block |
||
| 266 | 266 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
| 267 | 267 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
| 268 | 268 | } |
| 269 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 269 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 270 | 270 | } else if (isset($line['aircraft_name'])) { |
| 271 | 271 | // Get aircraft ICAO from aircraft name |
| 272 | 272 | $Spotter = new Spotter($this->db); |
| 273 | 273 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 274 | 274 | $Spotter->db = null; |
| 275 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 276 | - else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
| 277 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
| 278 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
|
| 279 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 275 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 276 | + else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
| 277 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $line['aircraft_icao'])); |
|
| 278 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true)); |
|
| 279 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
| 280 | 280 | if (!isset($line['id'])) { |
| 281 | 281 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 282 | 282 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
| 283 | 283 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 284 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 284 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 285 | 285 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 286 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 286 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 287 | 287 | |
| 288 | 288 | if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
| 289 | 289 | if ($globalAllFlights !== FALSE) $dataFound = true; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
| 292 | + if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/', $line['datetime'])) { |
|
| 293 | 293 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
| 294 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
| 294 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
| 295 | 295 | } else { |
| 296 | 296 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 297 | 297 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
@@ -302,23 +302,23 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | return ''; |
| 304 | 304 | } |
| 305 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 305 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
| 306 | 306 | |
| 307 | 307 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
| 308 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 308 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
| 309 | 309 | } |
| 310 | 310 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
| 311 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 311 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
| 312 | 312 | } |
| 313 | 313 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
| 314 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
| 314 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => $line['pilot_id'])); |
|
| 315 | 315 | } |
| 316 | 316 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
| 317 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
| 317 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => $line['pilot_name'])); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
| 321 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 321 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
| 322 | 322 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
| 323 | 323 | $timeelapsed = microtime(true); |
| 324 | 324 | $Spotter = new Spotter($this->db); |
@@ -328,10 +328,10 @@ discard block |
||
| 328 | 328 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 329 | 329 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 330 | 330 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 331 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 331 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
| 332 | 332 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 333 | 333 | $Spotter->db = null; |
| 334 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 334 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /* |
@@ -342,24 +342,24 @@ discard block |
||
| 342 | 342 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 343 | 343 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 344 | 344 | */ |
| 345 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 345 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 346 | 346 | |
| 347 | 347 | //$putinarchive = true; |
| 348 | 348 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
| 349 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
| 349 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
| 350 | 350 | } |
| 351 | 351 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
| 352 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
| 352 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
| 353 | 353 | } |
| 354 | 354 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
| 355 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 355 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
| 356 | 356 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
| 357 | 357 | $timeelapsed = microtime(true); |
| 358 | 358 | $Spotter = new Spotter($this->db); |
| 359 | 359 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 360 | 360 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 361 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 362 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 361 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
| 362 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 363 | 363 | |
| 364 | 364 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
| 365 | 365 | $timeelapsed = microtime(true); |
@@ -372,34 +372,34 @@ discard block |
||
| 372 | 372 | $Translation->db = null; |
| 373 | 373 | } |
| 374 | 374 | $Spotter->db = null; |
| 375 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 375 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 376 | 376 | |
| 377 | 377 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 378 | 378 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
| 379 | 379 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
| 380 | 380 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
| 381 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 381 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop'])); |
|
| 382 | 382 | } |
| 383 | 383 | } |
| 384 | 384 | if (!isset($globalFork)) $globalFork = TRUE; |
| 385 | 385 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 386 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
| 386 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | if (isset($line['speed']) && $line['speed'] != '') { |
| 392 | 392 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
| 393 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 394 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 393 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
| 394 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
| 395 | 395 | //$dataFound = true; |
| 396 | 396 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 397 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 397 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
| 398 | 398 | if ($distance > 1000 && $distance < 10000) { |
| 399 | 399 | // use datetime |
| 400 | 400 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 401 | 401 | $speed = $speed*3.6; |
| 402 | - if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
| 402 | + if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
| 403 | 403 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
| 404 | 404 | } |
| 405 | 405 | } |
@@ -407,11 +407,11 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | |
| 409 | 409 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 410 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 410 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
| 411 | 411 | else unset($timediff); |
| 412 | - if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
| 412 | + if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')))) { |
|
| 413 | 413 | if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) { |
| 414 | - if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 414 | + if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
| 415 | 415 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 416 | 416 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 417 | 417 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -419,10 +419,10 @@ discard block |
||
| 419 | 419 | if ($globalDebug) echo "\n".' ------- Check Country.... '; |
| 420 | 420 | $timeelapsed = microtime(true); |
| 421 | 421 | $Spotter = new Spotter($this->db); |
| 422 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 422 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
| 423 | 423 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
| 424 | 424 | $Spotter->db = null; |
| 425 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 425 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 426 | 426 | $this->tmd = 0; |
| 427 | 427 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
| 428 | 428 | } |
@@ -431,13 +431,13 @@ discard block |
||
| 431 | 431 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 432 | 432 | //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
| 433 | 433 | if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 434 | - if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
| 434 | + if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
| 435 | 435 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
| 436 | 436 | $dataFound = true; |
| 437 | 437 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 438 | 438 | } |
| 439 | 439 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 440 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
| 440 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
| 441 | 441 | /* |
| 442 | 442 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
| 443 | 443 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -455,13 +455,13 @@ discard block |
||
| 455 | 455 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
| 456 | 456 | //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
| 457 | 457 | if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 458 | - if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
| 458 | + if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
| 459 | 459 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
| 460 | 460 | $dataFound = true; |
| 461 | 461 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 462 | 462 | } |
| 463 | 463 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 464 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
| 464 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
| 465 | 465 | /* |
| 466 | 466 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
| 467 | 467 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -479,45 +479,45 @@ discard block |
||
| 479 | 479 | } else if ($globalDebug && $timediff > 20) { |
| 480 | 480 | $this->tmd = $this->tmd + 1; |
| 481 | 481 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
| 482 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
| 483 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
| 482 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
| 483 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
| 484 | 484 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
| 485 | 485 | } |
| 486 | 486 | } |
| 487 | 487 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 488 | 488 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
| 489 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 489 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
| 490 | 490 | } |
| 491 | 491 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
| 492 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 492 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
| 493 | 493 | //$dataFound = true; |
| 494 | 494 | } |
| 495 | 495 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 496 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 496 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
| 497 | 497 | } |
| 498 | 498 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 499 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 499 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
| 500 | 500 | } |
| 501 | 501 | if (isset($line['emergency']) && $line['emergency'] != '') { |
| 502 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 502 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
| 503 | 503 | //$dataFound = true; |
| 504 | 504 | } |
| 505 | 505 | if (isset($line['ground']) && $line['ground'] != '') { |
| 506 | 506 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
| 507 | 507 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 508 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 509 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 510 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
| 511 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 512 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 508 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 509 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 510 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
| 511 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 512 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 513 | 513 | } |
| 514 | 514 | if ($line['ground'] != 1) $line['ground'] = 0; |
| 515 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 515 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
| 516 | 516 | //$dataFound = true; |
| 517 | 517 | } |
| 518 | 518 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 519 | 519 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
| 520 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 520 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
| 521 | 521 | $highlight = ''; |
| 522 | 522 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
| 523 | 523 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -525,48 +525,48 @@ discard block |
||
| 525 | 525 | if ($highlight != '') { |
| 526 | 526 | $timeelapsed = microtime(true); |
| 527 | 527 | $Spotter = new Spotter($this->db); |
| 528 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
| 528 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
| 529 | 529 | $Spotter->db = null; |
| 530 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 530 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 531 | 531 | |
| 532 | 532 | $this->all_flights[$id]['putinarchive'] = true; |
| 533 | 533 | //$putinarchive = true; |
| 534 | 534 | //$highlight = ''; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 537 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
| 538 | 538 | //$dataFound = true; |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 542 | 542 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 543 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 544 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
| 545 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
| 543 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 544 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
| 545 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
| 546 | 546 | //$dataFound = true; |
| 547 | 547 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 551 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 551 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | if (isset($line['heading']) && $line['heading'] != '') { |
| 555 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 556 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 557 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 555 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 556 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
| 557 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
| 558 | 558 | //$dataFound = true; |
| 559 | 559 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 560 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 561 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 562 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 560 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 561 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
| 562 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 563 | 563 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
| 564 | 564 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 565 | 565 | // If not enough messages and ACARS set heading to 0 |
| 566 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 566 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
| 567 | 567 | } |
| 568 | - if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 569 | - elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 568 | + if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 569 | + elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 570 | 570 | |
| 571 | 571 | // print_r($this->all_flights[$id]); |
| 572 | 572 | //gets the callsign from the last hour |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
| 577 | 577 | $this->all_flights[$id]['lastupdate'] = time(); |
| 578 | 578 | if ($this->all_flights[$id]['addedSpotter'] == 0) { |
| 579 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 579 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 580 | 580 | //print_r($this->all_flights); |
| 581 | 581 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
| 582 | 582 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -586,61 +586,61 @@ discard block |
||
| 586 | 586 | $SpotterLive = new SpotterLive($this->db); |
| 587 | 587 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
| 588 | 588 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 589 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 589 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 590 | 590 | } elseif (isset($line['id'])) { |
| 591 | 591 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 592 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 592 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 593 | 593 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 594 | 594 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 595 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 595 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 596 | 596 | } else $recent_ident = ''; |
| 597 | - $SpotterLive->db=null; |
|
| 597 | + $SpotterLive->db = null; |
|
| 598 | 598 | |
| 599 | 599 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 600 | 600 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 601 | 601 | } else { |
| 602 | 602 | $recent_ident = ''; |
| 603 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
| 603 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
| 604 | 604 | } |
| 605 | 605 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 606 | - if($recent_ident == "") |
|
| 606 | + if ($recent_ident == "") |
|
| 607 | 607 | { |
| 608 | 608 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
| 609 | 609 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 610 | 610 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 611 | 611 | //adds the spotter data for the archive |
| 612 | 612 | $ignoreImport = false; |
| 613 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 613 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 614 | 614 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 615 | 615 | $ignoreImport = true; |
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | 618 | if (count($globalAirportAccept) > 0) { |
| 619 | 619 | $ignoreImport = true; |
| 620 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 620 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 621 | 621 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 622 | 622 | $ignoreImport = false; |
| 623 | 623 | } |
| 624 | 624 | } |
| 625 | 625 | } |
| 626 | 626 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 627 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 628 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 627 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
| 628 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
| 629 | 629 | $ignoreImport = true; |
| 630 | 630 | } |
| 631 | 631 | } |
| 632 | 632 | } |
| 633 | 633 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 634 | 634 | $ignoreImport = true; |
| 635 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 636 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 635 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
| 636 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
| 637 | 637 | $ignoreImport = false; |
| 638 | 638 | } |
| 639 | 639 | } |
| 640 | 640 | } |
| 641 | 641 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 642 | 642 | $ignoreImport = true; |
| 643 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 643 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
| 644 | 644 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 645 | 645 | $ignoreImport = false; |
| 646 | 646 | } |
@@ -652,27 +652,27 @@ discard block |
||
| 652 | 652 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
| 653 | 653 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
| 654 | 654 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
| 655 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 655 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 656 | 656 | $timeelapsed = microtime(true); |
| 657 | 657 | $Spotter = new Spotter($this->db); |
| 658 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
|
| 658 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name']); |
|
| 659 | 659 | $Spotter->db = null; |
| 660 | 660 | if ($globalDebug && isset($result)) echo $result."\n"; |
| 661 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 661 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 662 | 662 | |
| 663 | 663 | // Add source stat in DB |
| 664 | 664 | $Stats = new Stats($this->db); |
| 665 | 665 | if (!empty($this->stats)) { |
| 666 | 666 | if ($globalDebug) echo 'Add source stats : '; |
| 667 | - foreach($this->stats as $date => $data) { |
|
| 668 | - foreach($data as $source => $sourced) { |
|
| 667 | + foreach ($this->stats as $date => $data) { |
|
| 668 | + foreach ($data as $source => $sourced) { |
|
| 669 | 669 | //print_r($sourced); |
| 670 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 671 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 670 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
| 671 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
| 672 | 672 | if (isset($sourced['msg'])) { |
| 673 | 673 | if (time() - $sourced['msg']['date'] > 10) { |
| 674 | 674 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
| 675 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 675 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
| 676 | 676 | unset($this->stats[$date][$source]['msg']); |
| 677 | 677 | } |
| 678 | 678 | } |
@@ -708,18 +708,18 @@ discard block |
||
| 708 | 708 | //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 709 | 709 | $SpotterLive = new SpotterLive($this->db); |
| 710 | 710 | $SpotterLive->deleteLiveSpotterData(); |
| 711 | - $SpotterLive->db=null; |
|
| 711 | + $SpotterLive->db = null; |
|
| 712 | 712 | if ($globalDebug) echo " Done\n"; |
| 713 | 713 | $this->last_delete = time(); |
| 714 | 714 | } |
| 715 | 715 | } else { |
| 716 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
|
| 716 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
|
| 717 | 717 | $this->all_flights[$id]['id'] = $recent_ident; |
| 718 | 718 | $this->all_flights[$id]['addedSpotter'] = 1; |
| 719 | 719 | } |
| 720 | 720 | if (isset($globalDaemon) && !$globalDaemon) { |
| 721 | 721 | $Spotter = new Spotter($this->db); |
| 722 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
| 722 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']); |
|
| 723 | 723 | $Spotter->db = null; |
| 724 | 724 | } |
| 725 | 725 | |
@@ -743,37 +743,37 @@ discard block |
||
| 743 | 743 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 744 | 744 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 745 | 745 | |
| 746 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 746 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 747 | 747 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 748 | 748 | $ignoreImport = true; |
| 749 | 749 | } |
| 750 | 750 | } |
| 751 | 751 | if (count($globalAirportAccept) > 0) { |
| 752 | 752 | $ignoreImport = true; |
| 753 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 753 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 754 | 754 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 755 | 755 | $ignoreImport = false; |
| 756 | 756 | } |
| 757 | 757 | } |
| 758 | 758 | } |
| 759 | 759 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 760 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 761 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 760 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
| 761 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
| 762 | 762 | $ignoreImport = true; |
| 763 | 763 | } |
| 764 | 764 | } |
| 765 | 765 | } |
| 766 | 766 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 767 | 767 | $ignoreImport = true; |
| 768 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 769 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 768 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
| 769 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
| 770 | 770 | $ignoreImport = false; |
| 771 | 771 | } |
| 772 | 772 | } |
| 773 | 773 | } |
| 774 | 774 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 775 | 775 | $ignoreImport = true; |
| 776 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 776 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
| 777 | 777 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 778 | 778 | $ignoreImport = false; |
| 779 | 779 | } |
@@ -781,13 +781,13 @@ discard block |
||
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | if (!$ignoreImport) { |
| 784 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 784 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 785 | 785 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
| 786 | 786 | $timeelapsed = microtime(true); |
| 787 | 787 | $SpotterLive = new SpotterLive($this->db); |
| 788 | - $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
| 788 | + $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
| 789 | 789 | $SpotterLive->db = null; |
| 790 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 790 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 791 | 791 | |
| 792 | 792 | // Put statistics in $this->stats variable |
| 793 | 793 | //if ($line['format_source'] != 'aprs') { |
@@ -805,19 +805,19 @@ discard block |
||
| 805 | 805 | $latitude = $globalCenterLatitude; |
| 806 | 806 | $longitude = $globalCenterLongitude; |
| 807 | 807 | } |
| 808 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
| 808 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
| 809 | 809 | } else { |
| 810 | 810 | $latitude = $this->source_location[$source]['latitude']; |
| 811 | 811 | $longitude = $this->source_location[$source]['longitude']; |
| 812 | 812 | } |
| 813 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 813 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 814 | 814 | //$stats_heading = $stats_heading%22.5; |
| 815 | 815 | $stats_heading = round($stats_heading/22.5); |
| 816 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 816 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 817 | 817 | $current_date = date('Y-m-d'); |
| 818 | 818 | if ($stats_heading == 16) $stats_heading = 0; |
| 819 | 819 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 820 | - for ($i=0;$i<=15;$i++) { |
|
| 820 | + for ($i = 0; $i <= 15; $i++) { |
|
| 821 | 821 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
| 822 | 822 | } |
| 823 | 823 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -832,9 +832,9 @@ discard block |
||
| 832 | 832 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 833 | 833 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 834 | 834 | end($this->stats[$current_date][$source]['hist']); |
| 835 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 835 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
| 836 | 836 | } else $mini = 0; |
| 837 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
| 837 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
| 838 | 838 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 839 | 839 | } |
| 840 | 840 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
| 848 | 848 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
| 849 | 849 | if ($globalDebug) echo $result."\n"; |
| 850 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 850 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
| 851 | 851 | //$this->del(); |
| 852 | 852 | |
| 853 | 853 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
| 5 | 5 | $global_query = "SELECT spotter_output.* FROM spotter_output"; |
| 6 | 6 | |
| 7 | -class Spotter{ |
|
| 7 | +class Spotter { |
|
| 8 | 8 | public $db; |
| 9 | 9 | |
| 10 | 10 | public function __construct($dbc = null) { |
@@ -17,64 +17,64 @@ discard block |
||
| 17 | 17 | * @param Array $filter the filter |
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 22 | 22 | $filters = array(); |
| 23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
| 26 | 26 | } else { |
| 27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 31 | 31 | $filter_query_join = ''; |
| 32 | 32 | $filter_query_where = ''; |
| 33 | - foreach($filters as $flt) { |
|
| 33 | + foreach ($filters as $flt) { |
|
| 34 | 34 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 35 | 35 | if ($flt['airlines'][0] != '') { |
| 36 | 36 | if (isset($flt['source'])) { |
| 37 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 37 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 38 | 38 | } else { |
| 39 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 39 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 44 | 44 | if (isset($flt['source'])) { |
| 45 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 45 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 46 | 46 | } else { |
| 47 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 47 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) { |
| 51 | 51 | if (isset($flt['source'])) { |
| 52 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 52 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 57 | 57 | if ($filter['airlines'][0] != '') { |
| 58 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 58 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 62 | 62 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id "; |
| 63 | 63 | } |
| 64 | 64 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 65 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 65 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 66 | 66 | } |
| 67 | 67 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 68 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 68 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 69 | 69 | } |
| 70 | 70 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 71 | 71 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
| 72 | 72 | } |
| 73 | 73 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 74 | 74 | if ($filter_query_where == '') { |
| 75 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 75 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 76 | 76 | } else { |
| 77 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 77 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @return Array the spotter information |
| 93 | 93 | * |
| 94 | 94 | */ |
| 95 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
| 95 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
| 96 | 96 | { |
| 97 | 97 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
| 98 | 98 | $Image = new Image($this->db); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $sth = $this->db->prepare($query.$limitQuery); |
| 123 | 123 | $sth->execute($params); |
| 124 | 124 | } catch (PDOException $e) { |
| 125 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
| 125 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
| 126 | 126 | exit(); |
| 127 | 127 | } |
| 128 | 128 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $spotter_array = array(); |
| 133 | 133 | |
| 134 | 134 | |
| 135 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 135 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 136 | 136 | { |
| 137 | 137 | $num_rows++; |
| 138 | 138 | $temp_array = array(); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | if (isset($row['route_stop'])) { |
| 178 | 178 | $temp_array['route_stop'] = $row['route_stop']; |
| 179 | 179 | if ($row['route_stop'] != '') { |
| 180 | - $allroute = explode(' ',$row['route_stop']); |
|
| 180 | + $allroute = explode(' ', $row['route_stop']); |
|
| 181 | 181 | |
| 182 | 182 | foreach ($allroute as $route) { |
| 183 | 183 | $route_airport_array = $this->getAllAirportInfo($route); |
@@ -232,11 +232,11 @@ discard block |
||
| 232 | 232 | { |
| 233 | 233 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
| 234 | 234 | } else { |
| 235 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
| 235 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
| 236 | 236 | } |
| 237 | 237 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
| 238 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
| 239 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
| 238 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
| 239 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
| 240 | 240 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -270,9 +270,9 @@ discard block |
||
| 270 | 270 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 271 | 271 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 272 | 272 | if (is_numeric(substr($row['ident'], 2, 1))) { |
| 273 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource); |
|
| 273 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource); |
|
| 274 | 274 | } elseif (is_numeric(substr($row['ident'], 3, 1))) { |
| 275 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 275 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 276 | 276 | } else { |
| 277 | 277 | $airline_array = $this->getAllAirlineInfo('NA'); |
| 278 | 278 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') { |
| 312 | - $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3)); |
|
| 312 | + $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3)); |
|
| 313 | 313 | //$acars_array = ACARS->getLiveAcarsData('BA40YL'); |
| 314 | 314 | if (count($acars_array) > 0) { |
| 315 | 315 | $temp_array['acars'] = $acars_array; |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 329 | + if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 330 | 330 | { |
| 331 | 331 | if ($globalIVAO) { |
| 332 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 333 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 332 | + if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']); |
|
| 333 | + else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']); |
|
| 334 | 334 | } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
| 335 | 335 | if (count($image_array) > 0) { |
| 336 | 336 | $temp_array['image'] = $image_array[0]['image']; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | if (isset($row['arrival_airport_time']) && $row['arrival_airport_time'] != '') { |
| 354 | 354 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 355 | 355 | } |
| 356 | - if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 356 | + if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 357 | 357 | if ($schedules === true) { |
| 358 | 358 | $schedule_array = $Schedule->getSchedule($temp_array['ident']); |
| 359 | 359 | //print_r($schedule_array); |
@@ -435,12 +435,12 @@ discard block |
||
| 435 | 435 | if (isset($row['squawk'])) { |
| 436 | 436 | $temp_array['squawk'] = $row['squawk']; |
| 437 | 437 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 438 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
|
| 439 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 438 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']); |
|
| 439 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 440 | 440 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 441 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
|
| 442 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 443 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 441 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']); |
|
| 442 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 443 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | $temp_array['query_number_rows'] = $num_rows; |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | * @return Array the spotter information |
| 460 | 460 | * |
| 461 | 461 | */ |
| 462 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
|
| 462 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
| 463 | 463 | { |
| 464 | 464 | global $globalTimezone, $globalDBdriver; |
| 465 | 465 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | $query_values = array(); |
| 471 | 471 | $additional_query = ''; |
| 472 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 472 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 473 | 473 | if ($q != "") |
| 474 | 474 | { |
| 475 | 475 | if (!is_string($q)) |
@@ -477,8 +477,8 @@ discard block |
||
| 477 | 477 | return false; |
| 478 | 478 | } else { |
| 479 | 479 | $q_array = explode(" ", $q); |
| 480 | - foreach ($q_array as $q_item){ |
|
| 481 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 480 | + foreach ($q_array as $q_item) { |
|
| 481 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 482 | 482 | $additional_query .= " AND ("; |
| 483 | 483 | if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
| 484 | 484 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -510,37 +510,37 @@ discard block |
||
| 510 | 510 | |
| 511 | 511 | if ($registration != "") |
| 512 | 512 | { |
| 513 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 513 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 514 | 514 | if (!is_string($registration)) |
| 515 | 515 | { |
| 516 | 516 | return false; |
| 517 | 517 | } else { |
| 518 | 518 | $additional_query .= " AND spotter_output.registration = :registration"; |
| 519 | - $query_values = array_merge($query_values,array(':registration' => $registration)); |
|
| 519 | + $query_values = array_merge($query_values, array(':registration' => $registration)); |
|
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | if ($aircraft_icao != "") |
| 524 | 524 | { |
| 525 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 525 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 526 | 526 | if (!is_string($aircraft_icao)) |
| 527 | 527 | { |
| 528 | 528 | return false; |
| 529 | 529 | } else { |
| 530 | 530 | $additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao"; |
| 531 | - $query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao)); |
|
| 531 | + $query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao)); |
|
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | if ($aircraft_manufacturer != "") |
| 536 | 536 | { |
| 537 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 537 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 538 | 538 | if (!is_string($aircraft_manufacturer)) |
| 539 | 539 | { |
| 540 | 540 | return false; |
| 541 | 541 | } else { |
| 542 | 542 | $additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer"; |
| 543 | - $query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 543 | + $query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 544 | 544 | } |
| 545 | 545 | } |
| 546 | 546 | |
@@ -556,25 +556,25 @@ discard block |
||
| 556 | 556 | |
| 557 | 557 | if ($airline_icao != "") |
| 558 | 558 | { |
| 559 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 559 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 560 | 560 | if (!is_string($airline_icao)) |
| 561 | 561 | { |
| 562 | 562 | return false; |
| 563 | 563 | } else { |
| 564 | 564 | $additional_query .= " AND spotter_output.airline_icao = :airline_icao"; |
| 565 | - $query_values = array_merge($query_values,array(':airline_icao' => $airline_icao)); |
|
| 565 | + $query_values = array_merge($query_values, array(':airline_icao' => $airline_icao)); |
|
| 566 | 566 | } |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | if ($airline_country != "") |
| 570 | 570 | { |
| 571 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 571 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
| 572 | 572 | if (!is_string($airline_country)) |
| 573 | 573 | { |
| 574 | 574 | return false; |
| 575 | 575 | } else { |
| 576 | 576 | $additional_query .= " AND spotter_output.airline_country = :airline_country"; |
| 577 | - $query_values = array_merge($query_values,array(':airline_country' => $airline_country)); |
|
| 577 | + $query_values = array_merge($query_values, array(':airline_country' => $airline_country)); |
|
| 578 | 578 | } |
| 579 | 579 | } |
| 580 | 580 | |
@@ -601,31 +601,31 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | if ($airport != "") |
| 603 | 603 | { |
| 604 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 604 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 605 | 605 | if (!is_string($airport)) |
| 606 | 606 | { |
| 607 | 607 | return false; |
| 608 | 608 | } else { |
| 609 | 609 | $additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)"; |
| 610 | - $query_values = array_merge($query_values,array(':airport' => $airport)); |
|
| 610 | + $query_values = array_merge($query_values, array(':airport' => $airport)); |
|
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | if ($airport_country != "") |
| 615 | 615 | { |
| 616 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 616 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
| 617 | 617 | if (!is_string($airport_country)) |
| 618 | 618 | { |
| 619 | 619 | return false; |
| 620 | 620 | } else { |
| 621 | 621 | $additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)"; |
| 622 | - $query_values = array_merge($query_values,array(':airport_country' => $airport_country)); |
|
| 622 | + $query_values = array_merge($query_values, array(':airport_country' => $airport_country)); |
|
| 623 | 623 | } |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | if ($callsign != "") |
| 627 | 627 | { |
| 628 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 628 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 629 | 629 | if (!is_string($callsign)) |
| 630 | 630 | { |
| 631 | 631 | return false; |
@@ -633,79 +633,79 @@ discard block |
||
| 633 | 633 | $translate = $Translation->ident2icao($callsign); |
| 634 | 634 | if ($translate != $callsign) { |
| 635 | 635 | $additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)"; |
| 636 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
| 636 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
| 637 | 637 | } else { |
| 638 | 638 | $additional_query .= " AND spotter_output.ident = :callsign"; |
| 639 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
| 639 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | if ($owner != "") |
| 645 | 645 | { |
| 646 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 646 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 647 | 647 | if (!is_string($owner)) |
| 648 | 648 | { |
| 649 | 649 | return false; |
| 650 | 650 | } else { |
| 651 | 651 | $additional_query .= " AND spotter_output.owner_name = :owner"; |
| 652 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
| 652 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
| 653 | 653 | } |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | if ($pilot_name != "") |
| 657 | 657 | { |
| 658 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 658 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 659 | 659 | if (!is_string($pilot_name)) |
| 660 | 660 | { |
| 661 | 661 | return false; |
| 662 | 662 | } else { |
| 663 | 663 | $additional_query .= " AND spotter_output.pilot_name = :pilot_name"; |
| 664 | - $query_values = array_merge($query_values,array(':pilot_name' => $pilot_name)); |
|
| 664 | + $query_values = array_merge($query_values, array(':pilot_name' => $pilot_name)); |
|
| 665 | 665 | } |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | if ($pilot_id != "") |
| 669 | 669 | { |
| 670 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 670 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
| 671 | 671 | if (!is_string($pilot_id)) |
| 672 | 672 | { |
| 673 | 673 | return false; |
| 674 | 674 | } else { |
| 675 | 675 | $additional_query .= " AND spotter_output.pilot_id = :pilot_id"; |
| 676 | - $query_values = array_merge($query_values,array(':pilot_id' => $pilot_id)); |
|
| 676 | + $query_values = array_merge($query_values, array(':pilot_id' => $pilot_id)); |
|
| 677 | 677 | } |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | if ($departure_airport_route != "") |
| 681 | 681 | { |
| 682 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 682 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
| 683 | 683 | if (!is_string($departure_airport_route)) |
| 684 | 684 | { |
| 685 | 685 | return false; |
| 686 | 686 | } else { |
| 687 | 687 | $additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route"; |
| 688 | - $query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route)); |
|
| 688 | + $query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route)); |
|
| 689 | 689 | } |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | if ($arrival_airport_route != "") |
| 693 | 693 | { |
| 694 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 694 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
| 695 | 695 | if (!is_string($arrival_airport_route)) |
| 696 | 696 | { |
| 697 | 697 | return false; |
| 698 | 698 | } else { |
| 699 | 699 | $additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route"; |
| 700 | - $query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 700 | + $query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | if ($altitude != "") |
| 705 | 705 | { |
| 706 | 706 | $altitude_array = explode(",", $altitude); |
| 707 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 708 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 707 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 708 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 709 | 709 | |
| 710 | 710 | if ($altitude_array[1] != "") |
| 711 | 711 | { |
@@ -721,8 +721,8 @@ discard block |
||
| 721 | 721 | if ($date_posted != "") |
| 722 | 722 | { |
| 723 | 723 | $date_array = explode(",", $date_posted); |
| 724 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 725 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 724 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
| 725 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
| 726 | 726 | |
| 727 | 727 | if ($globalTimezone != '') { |
| 728 | 728 | date_default_timezone_set($globalTimezone); |
@@ -753,8 +753,8 @@ discard block |
||
| 753 | 753 | { |
| 754 | 754 | $limit_array = explode(",", $limit); |
| 755 | 755 | |
| 756 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 757 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 756 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 757 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 758 | 758 | |
| 759 | 759 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 760 | 760 | { |
@@ -783,23 +783,23 @@ discard block |
||
| 783 | 783 | |
| 784 | 784 | |
| 785 | 785 | if ($origLat != "" && $origLon != "" && $dist != "") { |
| 786 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 786 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 787 | 787 | |
| 788 | 788 | if ($globalDBdriver == 'mysql') { |
| 789 | - $query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
| 789 | + $query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
| 790 | 790 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 791 | 791 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
| 792 | 792 | } else { |
| 793 | - $query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 793 | + $query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 794 | 794 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 795 | 795 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
| 796 | 796 | } |
| 797 | 797 | } else { |
| 798 | - $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
| 798 | + $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
| 799 | 799 | ".$additional_query." |
| 800 | 800 | ".$orderby_query; |
| 801 | 801 | } |
| 802 | - $spotter_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
| 802 | + $spotter_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
| 803 | 803 | return $spotter_array; |
| 804 | 804 | } |
| 805 | 805 | |
@@ -822,8 +822,8 @@ discard block |
||
| 822 | 822 | { |
| 823 | 823 | $limit_array = explode(",", $limit); |
| 824 | 824 | |
| 825 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 826 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 825 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 826 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 827 | 827 | |
| 828 | 828 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 829 | 829 | { |
@@ -840,9 +840,9 @@ discard block |
||
| 840 | 840 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
| 843 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
| 844 | 844 | |
| 845 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
| 845 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
| 846 | 846 | |
| 847 | 847 | return $spotter_array; |
| 848 | 848 | } |
@@ -888,34 +888,34 @@ discard block |
||
| 888 | 888 | { |
| 889 | 889 | return false; |
| 890 | 890 | } else { |
| 891 | - if ($interval == "30m"){ |
|
| 891 | + if ($interval == "30m") { |
|
| 892 | 892 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date '; |
| 893 | - } else if ($interval == "1h"){ |
|
| 893 | + } else if ($interval == "1h") { |
|
| 894 | 894 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date '; |
| 895 | - } else if ($interval == "3h"){ |
|
| 895 | + } else if ($interval == "3h") { |
|
| 896 | 896 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date '; |
| 897 | - } else if ($interval == "6h"){ |
|
| 897 | + } else if ($interval == "6h") { |
|
| 898 | 898 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date '; |
| 899 | - } else if ($interval == "12h"){ |
|
| 899 | + } else if ($interval == "12h") { |
|
| 900 | 900 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date '; |
| 901 | - } else if ($interval == "24h"){ |
|
| 901 | + } else if ($interval == "24h") { |
|
| 902 | 902 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date '; |
| 903 | - } else if ($interval == "7d"){ |
|
| 903 | + } else if ($interval == "7d") { |
|
| 904 | 904 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date '; |
| 905 | - } else if ($interval == "30d"){ |
|
| 905 | + } else if ($interval == "30d") { |
|
| 906 | 906 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date '; |
| 907 | 907 | } |
| 908 | 908 | } |
| 909 | 909 | } |
| 910 | 910 | |
| 911 | - $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
| 911 | + $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
| 912 | 912 | WHERE spotter_output.latitude <> '' |
| 913 | 913 | AND spotter_output.longitude <> '' |
| 914 | 914 | ".$additional_query." |
| 915 | 915 | HAVING distance < :radius |
| 916 | 916 | ORDER BY distance"; |
| 917 | 917 | |
| 918 | - $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query); |
|
| 918 | + $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query); |
|
| 919 | 919 | |
| 920 | 920 | return $spotter_array; |
| 921 | 921 | } |
@@ -927,21 +927,21 @@ discard block |
||
| 927 | 927 | * @return Array the spotter information |
| 928 | 928 | * |
| 929 | 929 | */ |
| 930 | - public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
|
| 930 | + public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array()) |
|
| 931 | 931 | { |
| 932 | 932 | global $global_query; |
| 933 | 933 | |
| 934 | 934 | date_default_timezone_set('UTC'); |
| 935 | 935 | |
| 936 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 936 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 937 | 937 | |
| 938 | 938 | $limit_query = ''; |
| 939 | 939 | if ($limit != "") |
| 940 | 940 | { |
| 941 | 941 | $limit_array = explode(",", $limit); |
| 942 | 942 | |
| 943 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 944 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 943 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 944 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 945 | 945 | |
| 946 | 946 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 947 | 947 | { |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | - $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 961 | + $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 962 | 962 | |
| 963 | 963 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 964 | 964 | |
@@ -977,15 +977,15 @@ discard block |
||
| 977 | 977 | global $global_query; |
| 978 | 978 | |
| 979 | 979 | date_default_timezone_set('UTC'); |
| 980 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 980 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 981 | 981 | |
| 982 | 982 | $limit_query = ''; |
| 983 | 983 | if ($limit != "") |
| 984 | 984 | { |
| 985 | 985 | $limit_array = explode(",", $limit); |
| 986 | 986 | |
| 987 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 988 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 987 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 988 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 989 | 989 | |
| 990 | 990 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 991 | 991 | { |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | - $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1005 | + $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1006 | 1006 | |
| 1007 | 1007 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1008 | 1008 | |
@@ -1016,20 +1016,20 @@ discard block |
||
| 1016 | 1016 | * @return Array the spotter information |
| 1017 | 1017 | * |
| 1018 | 1018 | */ |
| 1019 | - public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
|
| 1019 | + public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array()) |
|
| 1020 | 1020 | { |
| 1021 | 1021 | global $global_query; |
| 1022 | 1022 | |
| 1023 | 1023 | date_default_timezone_set('UTC'); |
| 1024 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1024 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1025 | 1025 | |
| 1026 | 1026 | $limit_query = ''; |
| 1027 | 1027 | if ($limit != "") |
| 1028 | 1028 | { |
| 1029 | 1029 | $limit_array = explode(",", $limit); |
| 1030 | 1030 | |
| 1031 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1032 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1031 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1032 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1033 | 1033 | |
| 1034 | 1034 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1035 | 1035 | { |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | - $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1049 | + $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1050 | 1050 | |
| 1051 | 1051 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1052 | 1052 | |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | |
| 1067 | 1067 | date_default_timezone_set('UTC'); |
| 1068 | 1068 | |
| 1069 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1069 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1070 | 1070 | |
| 1071 | 1071 | $limit_query = ''; |
| 1072 | 1072 | |
@@ -1074,8 +1074,8 @@ discard block |
||
| 1074 | 1074 | { |
| 1075 | 1075 | $limit_array = explode(",", $limit); |
| 1076 | 1076 | |
| 1077 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1078 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1077 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1078 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1079 | 1079 | |
| 1080 | 1080 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1081 | 1081 | { |
@@ -1092,7 +1092,7 @@ discard block |
||
| 1092 | 1092 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | - $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1095 | + $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1096 | 1096 | |
| 1097 | 1097 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1098 | 1098 | |
@@ -1111,14 +1111,14 @@ discard block |
||
| 1111 | 1111 | global $global_query; |
| 1112 | 1112 | |
| 1113 | 1113 | date_default_timezone_set('UTC'); |
| 1114 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1114 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1115 | 1115 | $limit_query = ''; |
| 1116 | 1116 | if ($limit != "") |
| 1117 | 1117 | { |
| 1118 | 1118 | $limit_array = explode(",", $limit); |
| 1119 | 1119 | |
| 1120 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1121 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1120 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1121 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1122 | 1122 | |
| 1123 | 1123 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1124 | 1124 | { |
@@ -1135,7 +1135,7 @@ discard block |
||
| 1135 | 1135 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | - $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1138 | + $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1139 | 1139 | |
| 1140 | 1140 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1141 | 1141 | |
@@ -1159,9 +1159,9 @@ discard block |
||
| 1159 | 1159 | $query_values = array(':id' => $id); |
| 1160 | 1160 | |
| 1161 | 1161 | //$query = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." "; |
| 1162 | - $query = $global_query." WHERE ".$additional_query." "; |
|
| 1162 | + $query = $global_query." WHERE ".$additional_query." "; |
|
| 1163 | 1163 | |
| 1164 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
| 1164 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
| 1165 | 1165 | |
| 1166 | 1166 | return $spotter_array; |
| 1167 | 1167 | } |
@@ -1199,8 +1199,8 @@ discard block |
||
| 1199 | 1199 | { |
| 1200 | 1200 | $limit_array = explode(",", $limit); |
| 1201 | 1201 | |
| 1202 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1203 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1202 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1203 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1204 | 1204 | |
| 1205 | 1205 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1206 | 1206 | { |
@@ -1241,7 +1241,7 @@ discard block |
||
| 1241 | 1241 | $query_values = array(); |
| 1242 | 1242 | $limit_query = ''; |
| 1243 | 1243 | $additional_query = ''; |
| 1244 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1244 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1245 | 1245 | |
| 1246 | 1246 | if ($aircraft_type != "") |
| 1247 | 1247 | { |
@@ -1258,8 +1258,8 @@ discard block |
||
| 1258 | 1258 | { |
| 1259 | 1259 | $limit_array = explode(",", $limit); |
| 1260 | 1260 | |
| 1261 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1262 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1261 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1262 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1263 | 1263 | |
| 1264 | 1264 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1265 | 1265 | { |
@@ -1315,8 +1315,8 @@ discard block |
||
| 1315 | 1315 | { |
| 1316 | 1316 | $limit_array = explode(",", $limit); |
| 1317 | 1317 | |
| 1318 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1319 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1318 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1319 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1320 | 1320 | |
| 1321 | 1321 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1322 | 1322 | { |
@@ -1332,7 +1332,7 @@ discard block |
||
| 1332 | 1332 | } else { |
| 1333 | 1333 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1334 | 1334 | } |
| 1335 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1335 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1336 | 1336 | |
| 1337 | 1337 | //$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query; |
| 1338 | 1338 | $query = $global_query.$filter_query." ".$additional_query." ".$orderby_query; |
@@ -1351,7 +1351,7 @@ discard block |
||
| 1351 | 1351 | * @return Array the spotter information |
| 1352 | 1352 | * |
| 1353 | 1353 | */ |
| 1354 | - public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
|
| 1354 | + public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array()) |
|
| 1355 | 1355 | { |
| 1356 | 1356 | global $global_query; |
| 1357 | 1357 | |
@@ -1360,7 +1360,7 @@ discard block |
||
| 1360 | 1360 | $query_values = array(); |
| 1361 | 1361 | $limit_query = ''; |
| 1362 | 1362 | $additional_query = ''; |
| 1363 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1363 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1364 | 1364 | |
| 1365 | 1365 | if ($airline != "") |
| 1366 | 1366 | { |
@@ -1377,8 +1377,8 @@ discard block |
||
| 1377 | 1377 | { |
| 1378 | 1378 | $limit_array = explode(",", $limit); |
| 1379 | 1379 | |
| 1380 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1381 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1380 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1381 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1382 | 1382 | |
| 1383 | 1383 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1384 | 1384 | { |
@@ -1408,7 +1408,7 @@ discard block |
||
| 1408 | 1408 | * @return Array the spotter information |
| 1409 | 1409 | * |
| 1410 | 1410 | */ |
| 1411 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
| 1411 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
| 1412 | 1412 | { |
| 1413 | 1413 | global $global_query; |
| 1414 | 1414 | |
@@ -1416,7 +1416,7 @@ discard block |
||
| 1416 | 1416 | $query_values = array(); |
| 1417 | 1417 | $limit_query = ''; |
| 1418 | 1418 | $additional_query = ''; |
| 1419 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1419 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1420 | 1420 | |
| 1421 | 1421 | if ($airport != "") |
| 1422 | 1422 | { |
@@ -1433,8 +1433,8 @@ discard block |
||
| 1433 | 1433 | { |
| 1434 | 1434 | $limit_array = explode(",", $limit); |
| 1435 | 1435 | |
| 1436 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1437 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1436 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1437 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1438 | 1438 | |
| 1439 | 1439 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1440 | 1440 | { |
@@ -1466,7 +1466,7 @@ discard block |
||
| 1466 | 1466 | * @return Array the spotter information |
| 1467 | 1467 | * |
| 1468 | 1468 | */ |
| 1469 | - public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
| 1469 | + public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
| 1470 | 1470 | { |
| 1471 | 1471 | global $global_query, $globalTimezone, $globalDBdriver; |
| 1472 | 1472 | |
@@ -1474,7 +1474,7 @@ discard block |
||
| 1474 | 1474 | $limit_query = ''; |
| 1475 | 1475 | $additional_query = ''; |
| 1476 | 1476 | |
| 1477 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1477 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1478 | 1478 | |
| 1479 | 1479 | if ($date != "") |
| 1480 | 1480 | { |
@@ -1500,8 +1500,8 @@ discard block |
||
| 1500 | 1500 | { |
| 1501 | 1501 | $limit_array = explode(",", $limit); |
| 1502 | 1502 | |
| 1503 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1504 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1503 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1504 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1505 | 1505 | |
| 1506 | 1506 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1507 | 1507 | { |
@@ -1531,7 +1531,7 @@ discard block |
||
| 1531 | 1531 | * @return Array the spotter information |
| 1532 | 1532 | * |
| 1533 | 1533 | */ |
| 1534 | - public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
|
| 1534 | + public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array()) |
|
| 1535 | 1535 | { |
| 1536 | 1536 | global $global_query; |
| 1537 | 1537 | |
@@ -1540,7 +1540,7 @@ discard block |
||
| 1540 | 1540 | $query_values = array(); |
| 1541 | 1541 | $limit_query = ''; |
| 1542 | 1542 | $additional_query = ''; |
| 1543 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1543 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1544 | 1544 | if ($country != "") |
| 1545 | 1545 | { |
| 1546 | 1546 | if (!is_string($country)) |
@@ -1557,8 +1557,8 @@ discard block |
||
| 1557 | 1557 | { |
| 1558 | 1558 | $limit_array = explode(",", $limit); |
| 1559 | 1559 | |
| 1560 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1561 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1560 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1561 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1562 | 1562 | |
| 1563 | 1563 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1564 | 1564 | { |
@@ -1598,7 +1598,7 @@ discard block |
||
| 1598 | 1598 | $query_values = array(); |
| 1599 | 1599 | $additional_query = ''; |
| 1600 | 1600 | $limit_query = ''; |
| 1601 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1601 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1602 | 1602 | |
| 1603 | 1603 | if ($aircraft_manufacturer != "") |
| 1604 | 1604 | { |
@@ -1615,8 +1615,8 @@ discard block |
||
| 1615 | 1615 | { |
| 1616 | 1616 | $limit_array = explode(",", $limit); |
| 1617 | 1617 | |
| 1618 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1619 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1618 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1619 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1620 | 1620 | |
| 1621 | 1621 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1622 | 1622 | { |
@@ -1658,14 +1658,14 @@ discard block |
||
| 1658 | 1658 | $query_values = array(); |
| 1659 | 1659 | $additional_query = ''; |
| 1660 | 1660 | $limit_query = ''; |
| 1661 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1661 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1662 | 1662 | if ($departure_airport_icao != "") |
| 1663 | 1663 | { |
| 1664 | 1664 | if (!is_string($departure_airport_icao)) |
| 1665 | 1665 | { |
| 1666 | 1666 | return false; |
| 1667 | 1667 | } else { |
| 1668 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1668 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1669 | 1669 | $additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)"; |
| 1670 | 1670 | $query_values = array(':departure_airport_icao' => $departure_airport_icao); |
| 1671 | 1671 | } |
@@ -1677,9 +1677,9 @@ discard block |
||
| 1677 | 1677 | { |
| 1678 | 1678 | return false; |
| 1679 | 1679 | } else { |
| 1680 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1680 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1681 | 1681 | $additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)"; |
| 1682 | - $query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1682 | + $query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1683 | 1683 | } |
| 1684 | 1684 | } |
| 1685 | 1685 | |
@@ -1687,8 +1687,8 @@ discard block |
||
| 1687 | 1687 | { |
| 1688 | 1688 | $limit_array = explode(",", $limit); |
| 1689 | 1689 | |
| 1690 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1691 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1690 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1691 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1692 | 1692 | |
| 1693 | 1693 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1694 | 1694 | { |
@@ -1727,15 +1727,15 @@ discard block |
||
| 1727 | 1727 | global $global_query; |
| 1728 | 1728 | |
| 1729 | 1729 | date_default_timezone_set('UTC'); |
| 1730 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1730 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1731 | 1731 | $limit_query = ''; |
| 1732 | 1732 | |
| 1733 | 1733 | if ($limit != "") |
| 1734 | 1734 | { |
| 1735 | 1735 | $limit_array = explode(",", $limit); |
| 1736 | 1736 | |
| 1737 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1738 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1737 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1738 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1739 | 1739 | |
| 1740 | 1740 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1741 | 1741 | { |
@@ -1752,7 +1752,7 @@ discard block |
||
| 1752 | 1752 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1753 | 1753 | } |
| 1754 | 1754 | |
| 1755 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1755 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1756 | 1756 | |
| 1757 | 1757 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1758 | 1758 | |
@@ -1765,19 +1765,19 @@ discard block |
||
| 1765 | 1765 | * @return String the highlight text |
| 1766 | 1766 | * |
| 1767 | 1767 | */ |
| 1768 | - public function getHighlightByRegistration($registration,$filter = array()) |
|
| 1768 | + public function getHighlightByRegistration($registration, $filter = array()) |
|
| 1769 | 1769 | { |
| 1770 | 1770 | global $global_query; |
| 1771 | 1771 | |
| 1772 | 1772 | date_default_timezone_set('UTC'); |
| 1773 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1774 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 1773 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1774 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 1775 | 1775 | |
| 1776 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1776 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1777 | 1777 | $sth = $this->db->prepare($query); |
| 1778 | 1778 | $sth->execute(array(':registration' => $registration)); |
| 1779 | 1779 | |
| 1780 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1780 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1781 | 1781 | { |
| 1782 | 1782 | $highlight = $row['highlight']; |
| 1783 | 1783 | } |
@@ -1793,14 +1793,14 @@ discard block |
||
| 1793 | 1793 | * @return String usage |
| 1794 | 1794 | * |
| 1795 | 1795 | */ |
| 1796 | - public function getSquawkUsage($squawk = '',$country = 'FR') |
|
| 1796 | + public function getSquawkUsage($squawk = '', $country = 'FR') |
|
| 1797 | 1797 | { |
| 1798 | 1798 | |
| 1799 | - $squawk = filter_var($squawk,FILTER_SANITIZE_STRING); |
|
| 1800 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 1799 | + $squawk = filter_var($squawk, FILTER_SANITIZE_STRING); |
|
| 1800 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 1801 | 1801 | |
| 1802 | 1802 | $query = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1"; |
| 1803 | - $query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country); |
|
| 1803 | + $query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country); |
|
| 1804 | 1804 | |
| 1805 | 1805 | $sth = $this->db->prepare($query); |
| 1806 | 1806 | $sth->execute($query_values); |
@@ -1822,9 +1822,9 @@ discard block |
||
| 1822 | 1822 | public function getAirportIcao($airport_iata = '') |
| 1823 | 1823 | { |
| 1824 | 1824 | |
| 1825 | - $airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING); |
|
| 1825 | + $airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING); |
|
| 1826 | 1826 | |
| 1827 | - $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 1827 | + $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 1828 | 1828 | $query_values = array(':airport' => $airport_iata); |
| 1829 | 1829 | |
| 1830 | 1830 | $sth = $this->db->prepare($query); |
@@ -1846,12 +1846,12 @@ discard block |
||
| 1846 | 1846 | * @return Float distance to the airport |
| 1847 | 1847 | * |
| 1848 | 1848 | */ |
| 1849 | - public function getAirportDistance($airport_icao,$latitude,$longitude) |
|
| 1849 | + public function getAirportDistance($airport_icao, $latitude, $longitude) |
|
| 1850 | 1850 | { |
| 1851 | 1851 | |
| 1852 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 1852 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 1853 | 1853 | |
| 1854 | - $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 1854 | + $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 1855 | 1855 | $query_values = array(':airport' => $airport_icao); |
| 1856 | 1856 | $sth = $this->db->prepare($query); |
| 1857 | 1857 | $sth->execute($query_values); |
@@ -1861,7 +1861,7 @@ discard block |
||
| 1861 | 1861 | $airport_latitude = $row['latitude']; |
| 1862 | 1862 | $airport_longitude = $row['longitude']; |
| 1863 | 1863 | $Common = new Common(); |
| 1864 | - return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
|
| 1864 | + return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude); |
|
| 1865 | 1865 | } else return ''; |
| 1866 | 1866 | } |
| 1867 | 1867 | |
@@ -1875,11 +1875,11 @@ discard block |
||
| 1875 | 1875 | public function getAllAirportInfo($airport = '') |
| 1876 | 1876 | { |
| 1877 | 1877 | |
| 1878 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 1878 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 1879 | 1879 | |
| 1880 | 1880 | $query_values = array(); |
| 1881 | 1881 | if ($airport == 'NA') { |
| 1882 | - return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => '')); |
|
| 1882 | + return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => '')); |
|
| 1883 | 1883 | } elseif ($airport == '') { |
| 1884 | 1884 | $query = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport"; |
| 1885 | 1885 | } else { |
@@ -1927,14 +1927,14 @@ discard block |
||
| 1927 | 1927 | { |
| 1928 | 1928 | $lst_countries = ''; |
| 1929 | 1929 | foreach ($countries as $country) { |
| 1930 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 1930 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 1931 | 1931 | if ($lst_countries == '') { |
| 1932 | 1932 | $lst_countries = "'".$country."'"; |
| 1933 | 1933 | } else { |
| 1934 | 1934 | $lst_countries .= ",'".$country."'"; |
| 1935 | 1935 | } |
| 1936 | 1936 | } |
| 1937 | - $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 1937 | + $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 1938 | 1938 | |
| 1939 | 1939 | $sth = $this->db->prepare($query); |
| 1940 | 1940 | $sth->execute(); |
@@ -1942,7 +1942,7 @@ discard block |
||
| 1942 | 1942 | $airport_array = array(); |
| 1943 | 1943 | $temp_array = array(); |
| 1944 | 1944 | |
| 1945 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1945 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1946 | 1946 | { |
| 1947 | 1947 | $temp_array['name'] = $row['name']; |
| 1948 | 1948 | $temp_array['city'] = $row['city']; |
@@ -1970,10 +1970,10 @@ discard block |
||
| 1970 | 1970 | { |
| 1971 | 1971 | global $globalDBdriver; |
| 1972 | 1972 | if (is_array($coord)) { |
| 1973 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1974 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1975 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1976 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1973 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1974 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1975 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1976 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1977 | 1977 | } else return array(); |
| 1978 | 1978 | if ($globalDBdriver == 'mysql') { |
| 1979 | 1979 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
@@ -1985,7 +1985,7 @@ discard block |
||
| 1985 | 1985 | |
| 1986 | 1986 | $airport_array = array(); |
| 1987 | 1987 | |
| 1988 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1988 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1989 | 1989 | { |
| 1990 | 1990 | $temp_array = $row; |
| 1991 | 1991 | |
@@ -2005,13 +2005,13 @@ discard block |
||
| 2005 | 2005 | public function getAllWaypointsInfobyCoord($coord) |
| 2006 | 2006 | { |
| 2007 | 2007 | if (is_array($coord)) { |
| 2008 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2009 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2010 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2011 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2008 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2009 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2010 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2011 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2012 | 2012 | } else return array(); |
| 2013 | 2013 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2014 | - $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 2014 | + $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 2015 | 2015 | //$query = "SELECT waypoints.* FROM waypoints"; |
| 2016 | 2016 | //$query = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end"; |
| 2017 | 2017 | //$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
@@ -2023,7 +2023,7 @@ discard block |
||
| 2023 | 2023 | |
| 2024 | 2024 | $waypoints_array = array(); |
| 2025 | 2025 | |
| 2026 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2026 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2027 | 2027 | { |
| 2028 | 2028 | $temp_array = $row; |
| 2029 | 2029 | |
@@ -2045,10 +2045,10 @@ discard block |
||
| 2045 | 2045 | { |
| 2046 | 2046 | global $globalUseRealAirlines; |
| 2047 | 2047 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
| 2048 | - $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
|
| 2048 | + $airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING)); |
|
| 2049 | 2049 | if ($airline_icao == 'NA') { |
| 2050 | 2050 | $airline_array = array(); |
| 2051 | - $airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2051 | + $airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2052 | 2052 | return $airline_array; |
| 2053 | 2053 | } else { |
| 2054 | 2054 | if (strlen($airline_icao) == 2) { |
@@ -2069,7 +2069,7 @@ discard block |
||
| 2069 | 2069 | if ($fromsource === NULL) { |
| 2070 | 2070 | $sth->execute(array(':airline_icao' => $airline_icao)); |
| 2071 | 2071 | } else { |
| 2072 | - $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
|
| 2072 | + $sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource)); |
|
| 2073 | 2073 | } |
| 2074 | 2074 | /* |
| 2075 | 2075 | $airline_array = array(); |
@@ -2111,12 +2111,12 @@ discard block |
||
| 2111 | 2111 | */ |
| 2112 | 2112 | public function getAllAircraftInfo($aircraft_type) |
| 2113 | 2113 | { |
| 2114 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2114 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2115 | 2115 | |
| 2116 | 2116 | if ($aircraft_type == 'NA') { |
| 2117 | - return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2117 | + return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2118 | 2118 | } |
| 2119 | - $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
| 2119 | + $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
| 2120 | 2120 | |
| 2121 | 2121 | $sth = $this->db->prepare($query); |
| 2122 | 2122 | $sth->execute(array(':aircraft_type' => $aircraft_type)); |
@@ -2148,7 +2148,7 @@ discard block |
||
| 2148 | 2148 | */ |
| 2149 | 2149 | public function getAircraftIcao($aircraft_type) |
| 2150 | 2150 | { |
| 2151 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2151 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2152 | 2152 | $all_aircraft = array('737-300' => 'B733', |
| 2153 | 2153 | '777-200' => 'B772', |
| 2154 | 2154 | '777-200ER' => 'B772', |
@@ -2160,10 +2160,10 @@ discard block |
||
| 2160 | 2160 | 'A380' => 'A388'); |
| 2161 | 2161 | if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
| 2162 | 2162 | |
| 2163 | - $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2163 | + $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2164 | 2164 | $aircraft_type = strtoupper($aircraft_type); |
| 2165 | 2165 | $sth = $this->db->prepare($query); |
| 2166 | - $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
|
| 2166 | + $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,)); |
|
| 2167 | 2167 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2168 | 2168 | if (isset($result[0]['icao'])) return $result[0]['icao']; |
| 2169 | 2169 | else return ''; |
@@ -2178,9 +2178,9 @@ discard block |
||
| 2178 | 2178 | */ |
| 2179 | 2179 | public function getAllAircraftType($aircraft_modes) |
| 2180 | 2180 | { |
| 2181 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 2181 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 2182 | 2182 | |
| 2183 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
| 2183 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
| 2184 | 2184 | |
| 2185 | 2185 | $sth = $this->db->prepare($query); |
| 2186 | 2186 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -2201,8 +2201,8 @@ discard block |
||
| 2201 | 2201 | */ |
| 2202 | 2202 | public function getOperator($operator) |
| 2203 | 2203 | { |
| 2204 | - $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
|
| 2205 | - $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2204 | + $operator = filter_var($operator, FILTER_SANITIZE_STRING); |
|
| 2205 | + $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2206 | 2206 | |
| 2207 | 2207 | $sth = $this->db->prepare($query); |
| 2208 | 2208 | $sth->execute(array(':operator' => $operator)); |
@@ -2223,9 +2223,9 @@ discard block |
||
| 2223 | 2223 | */ |
| 2224 | 2224 | public function getRouteInfo($callsign) |
| 2225 | 2225 | { |
| 2226 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 2226 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 2227 | 2227 | if ($callsign == '') return array(); |
| 2228 | - $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
| 2228 | + $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
| 2229 | 2229 | |
| 2230 | 2230 | $sth = $this->db->prepare($query); |
| 2231 | 2231 | $sth->execute(array(':callsign' => $callsign)); |
@@ -2246,9 +2246,9 @@ discard block |
||
| 2246 | 2246 | */ |
| 2247 | 2247 | public function getAircraftInfoByRegistration($registration) |
| 2248 | 2248 | { |
| 2249 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2249 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2250 | 2250 | |
| 2251 | - $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2251 | + $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2252 | 2252 | |
| 2253 | 2253 | $sth = $this->db->prepare($query); |
| 2254 | 2254 | $sth->execute(array(':registration' => $registration)); |
@@ -2256,7 +2256,7 @@ discard block |
||
| 2256 | 2256 | $aircraft_array = array(); |
| 2257 | 2257 | $temp_array = array(); |
| 2258 | 2258 | |
| 2259 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2259 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2260 | 2260 | { |
| 2261 | 2261 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2262 | 2262 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -2278,7 +2278,7 @@ discard block |
||
| 2278 | 2278 | */ |
| 2279 | 2279 | public function getAircraftOwnerByRegistration($registration) |
| 2280 | 2280 | { |
| 2281 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2281 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2282 | 2282 | $Connection = new Connection($this->db); |
| 2283 | 2283 | if ($Connection->tableExists('aircraft_owner')) { |
| 2284 | 2284 | $query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1"; |
@@ -2300,7 +2300,7 @@ discard block |
||
| 2300 | 2300 | public function getAllFlightsforSitemap() |
| 2301 | 2301 | { |
| 2302 | 2302 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
| 2303 | - $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2303 | + $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2304 | 2304 | |
| 2305 | 2305 | $sth = $this->db->prepare($query); |
| 2306 | 2306 | $sth->execute(); |
@@ -2347,7 +2347,7 @@ discard block |
||
| 2347 | 2347 | $manufacturer_array = array(); |
| 2348 | 2348 | $temp_array = array(); |
| 2349 | 2349 | |
| 2350 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2350 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2351 | 2351 | { |
| 2352 | 2352 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 2353 | 2353 | |
@@ -2373,7 +2373,7 @@ discard block |
||
| 2373 | 2373 | ORDER BY spotter_output.aircraft_name ASC"; |
| 2374 | 2374 | |
| 2375 | 2375 | */ |
| 2376 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2376 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2377 | 2377 | $query = "SELECT DISTINCT icao AS aircraft_icao, type AS aircraft_name, manufacturer AS aircraft_manufacturer FROM aircraft".$filter_query." icao <> '' ORDER BY aircraft_manufacturer ASC"; |
| 2378 | 2378 | |
| 2379 | 2379 | $sth = $this->db->prepare($query); |
@@ -2382,7 +2382,7 @@ discard block |
||
| 2382 | 2382 | $aircraft_array = array(); |
| 2383 | 2383 | $temp_array = array(); |
| 2384 | 2384 | |
| 2385 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2385 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2386 | 2386 | { |
| 2387 | 2387 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 2388 | 2388 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
@@ -2403,8 +2403,8 @@ discard block |
||
| 2403 | 2403 | */ |
| 2404 | 2404 | public function getAllAircraftRegistrations($filters = array()) |
| 2405 | 2405 | { |
| 2406 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2407 | - $query = "SELECT DISTINCT spotter_output.registration |
|
| 2406 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2407 | + $query = "SELECT DISTINCT spotter_output.registration |
|
| 2408 | 2408 | FROM spotter_output".$filter_query." spotter_output.registration <> '' |
| 2409 | 2409 | ORDER BY spotter_output.registration ASC"; |
| 2410 | 2410 | |
@@ -2414,7 +2414,7 @@ discard block |
||
| 2414 | 2414 | $aircraft_array = array(); |
| 2415 | 2415 | $temp_array = array(); |
| 2416 | 2416 | |
| 2417 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2417 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2418 | 2418 | { |
| 2419 | 2419 | $temp_array['registration'] = $row['registration']; |
| 2420 | 2420 | |
@@ -2431,11 +2431,11 @@ discard block |
||
| 2431 | 2431 | * @return Array list of source name |
| 2432 | 2432 | * |
| 2433 | 2433 | */ |
| 2434 | - public function getAllSourceName($type = '',$filters = array()) |
|
| 2434 | + public function getAllSourceName($type = '', $filters = array()) |
|
| 2435 | 2435 | { |
| 2436 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2436 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2437 | 2437 | $query_values = array(); |
| 2438 | - $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2438 | + $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2439 | 2439 | FROM spotter_output".$filter_query." spotter_output.source_name <> ''"; |
| 2440 | 2440 | if ($type != '') { |
| 2441 | 2441 | $query_values = array(':type' => $type); |
@@ -2450,7 +2450,7 @@ discard block |
||
| 2450 | 2450 | $source_array = array(); |
| 2451 | 2451 | $temp_array = array(); |
| 2452 | 2452 | |
| 2453 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2453 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2454 | 2454 | { |
| 2455 | 2455 | $temp_array['source_name'] = $row['source_name']; |
| 2456 | 2456 | $source_array[] = $temp_array; |
@@ -2466,11 +2466,11 @@ discard block |
||
| 2466 | 2466 | * @return Array list of airline names |
| 2467 | 2467 | * |
| 2468 | 2468 | */ |
| 2469 | - public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
|
| 2469 | + public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array()) |
|
| 2470 | 2470 | { |
| 2471 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
| 2472 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2473 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 2471 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
| 2472 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2473 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
| 2474 | 2474 | if ($airline_type == '' || $airline_type == 'all') { |
| 2475 | 2475 | /* |
| 2476 | 2476 | $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
@@ -2489,7 +2489,7 @@ discard block |
||
| 2489 | 2489 | $query_data = array(':forsource' => $forsource); |
| 2490 | 2490 | } |
| 2491 | 2491 | } else { |
| 2492 | - $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2492 | + $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2493 | 2493 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 2494 | 2494 | AND spotter_output.airline_type = :airline_type |
| 2495 | 2495 | ORDER BY spotter_output.airline_icao ASC"; |
@@ -2502,7 +2502,7 @@ discard block |
||
| 2502 | 2502 | $airline_array = array(); |
| 2503 | 2503 | $temp_array = array(); |
| 2504 | 2504 | |
| 2505 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2505 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2506 | 2506 | { |
| 2507 | 2507 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2508 | 2508 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -2522,8 +2522,8 @@ discard block |
||
| 2522 | 2522 | */ |
| 2523 | 2523 | public function getAllAirlineCountries($filters = array()) |
| 2524 | 2524 | { |
| 2525 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2526 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2525 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2526 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2527 | 2527 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 2528 | 2528 | ORDER BY spotter_output.airline_country ASC"; |
| 2529 | 2529 | |
@@ -2534,7 +2534,7 @@ discard block |
||
| 2534 | 2534 | $airline_array = array(); |
| 2535 | 2535 | $temp_array = array(); |
| 2536 | 2536 | |
| 2537 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2537 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2538 | 2538 | { |
| 2539 | 2539 | $temp_array['airline_country'] = $row['airline_country']; |
| 2540 | 2540 | |
@@ -2554,9 +2554,9 @@ discard block |
||
| 2554 | 2554 | */ |
| 2555 | 2555 | public function getAllAirportNames($filters = array()) |
| 2556 | 2556 | { |
| 2557 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2557 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2558 | 2558 | $airport_array = array(); |
| 2559 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
| 2559 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
| 2560 | 2560 | FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' |
| 2561 | 2561 | ORDER BY spotter_output.departure_airport_city ASC"; |
| 2562 | 2562 | |
@@ -2565,7 +2565,7 @@ discard block |
||
| 2565 | 2565 | $sth->execute(); |
| 2566 | 2566 | |
| 2567 | 2567 | $temp_array = array(); |
| 2568 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2568 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2569 | 2569 | { |
| 2570 | 2570 | $temp_array['airport_icao'] = $row['airport_icao']; |
| 2571 | 2571 | $temp_array['airport_name'] = $row['airport_name']; |
@@ -2575,14 +2575,14 @@ discard block |
||
| 2575 | 2575 | $airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array; |
| 2576 | 2576 | } |
| 2577 | 2577 | |
| 2578 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
| 2578 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
| 2579 | 2579 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' |
| 2580 | 2580 | ORDER BY spotter_output.arrival_airport_city ASC"; |
| 2581 | 2581 | |
| 2582 | 2582 | $sth = $this->db->prepare($query); |
| 2583 | 2583 | $sth->execute(); |
| 2584 | 2584 | |
| 2585 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2585 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2586 | 2586 | { |
| 2587 | 2587 | // if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao']) |
| 2588 | 2588 | // { |
@@ -2622,21 +2622,21 @@ discard block |
||
| 2622 | 2622 | |
| 2623 | 2623 | $temp_array = array(); |
| 2624 | 2624 | |
| 2625 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2625 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2626 | 2626 | { |
| 2627 | 2627 | $temp_array['airport_country'] = $row['airport_country']; |
| 2628 | 2628 | |
| 2629 | 2629 | $airport_array[$row['airport_country']] = $temp_array; |
| 2630 | 2630 | } |
| 2631 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2632 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2631 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2632 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2633 | 2633 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 2634 | 2634 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 2635 | 2635 | |
| 2636 | 2636 | $sth = $this->db->prepare($query); |
| 2637 | 2637 | $sth->execute(); |
| 2638 | 2638 | |
| 2639 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2639 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2640 | 2640 | { |
| 2641 | 2641 | if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country']) |
| 2642 | 2642 | { |
@@ -2659,9 +2659,9 @@ discard block |
||
| 2659 | 2659 | */ |
| 2660 | 2660 | public function getAllCountries($filters = array()) |
| 2661 | 2661 | { |
| 2662 | - $Connection= new Connection($this->db); |
|
| 2662 | + $Connection = new Connection($this->db); |
|
| 2663 | 2663 | if ($Connection->tableExists('countries')) { |
| 2664 | - $query = "SELECT countries.name AS airport_country |
|
| 2664 | + $query = "SELECT countries.name AS airport_country |
|
| 2665 | 2665 | FROM countries |
| 2666 | 2666 | ORDER BY countries.name ASC"; |
| 2667 | 2667 | $sth = $this->db->prepare($query); |
@@ -2670,14 +2670,14 @@ discard block |
||
| 2670 | 2670 | $temp_array = array(); |
| 2671 | 2671 | $country_array = array(); |
| 2672 | 2672 | |
| 2673 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2673 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2674 | 2674 | { |
| 2675 | 2675 | $temp_array['country'] = $row['airport_country']; |
| 2676 | 2676 | $country_array[$row['airport_country']] = $temp_array; |
| 2677 | 2677 | } |
| 2678 | 2678 | } else { |
| 2679 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2680 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 2679 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2680 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 2681 | 2681 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' |
| 2682 | 2682 | ORDER BY spotter_output.departure_airport_country ASC"; |
| 2683 | 2683 | |
@@ -2686,20 +2686,20 @@ discard block |
||
| 2686 | 2686 | |
| 2687 | 2687 | $temp_array = array(); |
| 2688 | 2688 | $country_array = array(); |
| 2689 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2689 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2690 | 2690 | { |
| 2691 | 2691 | $temp_array['country'] = $row['airport_country']; |
| 2692 | 2692 | $country_array[$row['airport_country']] = $temp_array; |
| 2693 | 2693 | } |
| 2694 | 2694 | |
| 2695 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2695 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2696 | 2696 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 2697 | 2697 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 2698 | 2698 | |
| 2699 | 2699 | $sth = $this->db->prepare($query); |
| 2700 | 2700 | $sth->execute(); |
| 2701 | 2701 | |
| 2702 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2702 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2703 | 2703 | { |
| 2704 | 2704 | if ($country_array[$row['airport_country']]['country'] != $row['airport_country']) |
| 2705 | 2705 | { |
@@ -2709,14 +2709,14 @@ discard block |
||
| 2709 | 2709 | } |
| 2710 | 2710 | } |
| 2711 | 2711 | |
| 2712 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2712 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2713 | 2713 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 2714 | 2714 | ORDER BY spotter_output.airline_country ASC"; |
| 2715 | 2715 | |
| 2716 | 2716 | $sth = $this->db->prepare($query); |
| 2717 | 2717 | $sth->execute(); |
| 2718 | 2718 | |
| 2719 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2719 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2720 | 2720 | { |
| 2721 | 2721 | if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country']) |
| 2722 | 2722 | { |
@@ -2740,8 +2740,8 @@ discard block |
||
| 2740 | 2740 | */ |
| 2741 | 2741 | public function getAllIdents($filters = array()) |
| 2742 | 2742 | { |
| 2743 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2744 | - $query = "SELECT DISTINCT spotter_output.ident |
|
| 2743 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2744 | + $query = "SELECT DISTINCT spotter_output.ident |
|
| 2745 | 2745 | FROM spotter_output".$filter_query." spotter_output.ident <> '' |
| 2746 | 2746 | ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0"; |
| 2747 | 2747 | |
@@ -2751,7 +2751,7 @@ discard block |
||
| 2751 | 2751 | $ident_array = array(); |
| 2752 | 2752 | $temp_array = array(); |
| 2753 | 2753 | |
| 2754 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2754 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2755 | 2755 | { |
| 2756 | 2756 | $temp_array['ident'] = $row['ident']; |
| 2757 | 2757 | $ident_array[] = $temp_array; |
@@ -2765,9 +2765,9 @@ discard block |
||
| 2765 | 2765 | * @return Array number, icao, name and city of airports |
| 2766 | 2766 | */ |
| 2767 | 2767 | |
| 2768 | - public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
|
| 2768 | + public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) { |
|
| 2769 | 2769 | global $globalTimezone, $globalDBdriver; |
| 2770 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2770 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2771 | 2771 | if ($globalTimezone != '') { |
| 2772 | 2772 | date_default_timezone_set($globalTimezone); |
| 2773 | 2773 | $datetime = new DateTime(); |
@@ -2832,7 +2832,7 @@ discard block |
||
| 2832 | 2832 | |
| 2833 | 2833 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 2834 | 2834 | global $globalTimezone, $globalDBdriver; |
| 2835 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2835 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2836 | 2836 | if ($globalTimezone != '') { |
| 2837 | 2837 | date_default_timezone_set($globalTimezone); |
| 2838 | 2838 | $datetime = new DateTime(); |
@@ -2916,7 +2916,7 @@ discard block |
||
| 2916 | 2916 | |
| 2917 | 2917 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 2918 | 2918 | global $globalTimezone, $globalDBdriver; |
| 2919 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2919 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2920 | 2920 | if ($globalTimezone != '') { |
| 2921 | 2921 | date_default_timezone_set($globalTimezone); |
| 2922 | 2922 | $datetime = new DateTime(); |
@@ -2949,9 +2949,9 @@ discard block |
||
| 2949 | 2949 | * @return Array number, icao, name and city of airports |
| 2950 | 2950 | */ |
| 2951 | 2951 | |
| 2952 | - public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
|
| 2952 | + public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) { |
|
| 2953 | 2953 | global $globalTimezone, $globalDBdriver; |
| 2954 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2954 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2955 | 2955 | if ($globalTimezone != '') { |
| 2956 | 2956 | date_default_timezone_set($globalTimezone); |
| 2957 | 2957 | $datetime = new DateTime(); |
@@ -3083,12 +3083,12 @@ discard block |
||
| 3083 | 3083 | } else $offset = '+00:00'; |
| 3084 | 3084 | |
| 3085 | 3085 | if ($globalDBdriver == 'mysql') { |
| 3086 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3086 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3087 | 3087 | FROM spotter_output |
| 3088 | 3088 | WHERE spotter_output.date <> '' |
| 3089 | 3089 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
| 3090 | 3090 | } else { |
| 3091 | - $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3091 | + $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3092 | 3092 | FROM spotter_output |
| 3093 | 3093 | WHERE spotter_output.date <> '' |
| 3094 | 3094 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
@@ -3100,7 +3100,7 @@ discard block |
||
| 3100 | 3100 | $date_array = array(); |
| 3101 | 3101 | $temp_array = array(); |
| 3102 | 3102 | |
| 3103 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3103 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3104 | 3104 | { |
| 3105 | 3105 | $temp_array['date'] = $row['date']; |
| 3106 | 3106 | |
@@ -3120,7 +3120,7 @@ discard block |
||
| 3120 | 3120 | */ |
| 3121 | 3121 | public function getAllRoutes() |
| 3122 | 3122 | { |
| 3123 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
| 3123 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
| 3124 | 3124 | FROM spotter_output |
| 3125 | 3125 | WHERE spotter_output.ident <> '' |
| 3126 | 3126 | GROUP BY route |
@@ -3131,7 +3131,7 @@ discard block |
||
| 3131 | 3131 | |
| 3132 | 3132 | $routes_array = array(); |
| 3133 | 3133 | $temp_array = array(); |
| 3134 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3134 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3135 | 3135 | { |
| 3136 | 3136 | $temp_array['route'] = $row['route']; |
| 3137 | 3137 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -3150,21 +3150,21 @@ discard block |
||
| 3150 | 3150 | * @return String success or false |
| 3151 | 3151 | * |
| 3152 | 3152 | */ |
| 3153 | - public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
|
| 3153 | + public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL) |
|
| 3154 | 3154 | { |
| 3155 | 3155 | if (!is_numeric(substr($ident, 0, 3))) |
| 3156 | 3156 | { |
| 3157 | 3157 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3158 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3158 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3159 | 3159 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3160 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3160 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3161 | 3161 | } else { |
| 3162 | 3162 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3163 | 3163 | } |
| 3164 | 3164 | if (count($airline_array) == 0) { |
| 3165 | 3165 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3166 | 3166 | } |
| 3167 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3167 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3168 | 3168 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3169 | 3169 | } |
| 3170 | 3170 | } else { |
@@ -3177,7 +3177,7 @@ discard block |
||
| 3177 | 3177 | |
| 3178 | 3178 | |
| 3179 | 3179 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
| 3180 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3180 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type); |
|
| 3181 | 3181 | |
| 3182 | 3182 | try { |
| 3183 | 3183 | $sth = $this->db->prepare($query); |
@@ -3198,11 +3198,11 @@ discard block |
||
| 3198 | 3198 | * @return String success or false |
| 3199 | 3199 | * |
| 3200 | 3200 | */ |
| 3201 | - public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
|
| 3201 | + public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '') |
|
| 3202 | 3202 | { |
| 3203 | 3203 | if ($groundspeed == '') $groundspeed = NULL; |
| 3204 | 3204 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3205 | - $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3205 | + $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3206 | 3206 | |
| 3207 | 3207 | try { |
| 3208 | 3208 | $sth = $this->db->prepare($query); |
@@ -3242,7 +3242,7 @@ discard block |
||
| 3242 | 3242 | * @param String $verticalrate vertival rate of flight |
| 3243 | 3243 | * @return String success or false |
| 3244 | 3244 | */ |
| 3245 | - public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
|
| 3245 | + public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '') |
|
| 3246 | 3246 | { |
| 3247 | 3247 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
| 3248 | 3248 | |
@@ -3266,13 +3266,13 @@ discard block |
||
| 3266 | 3266 | if ($ModeS != '') { |
| 3267 | 3267 | $timeelapsed = microtime(true); |
| 3268 | 3268 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3269 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3269 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3270 | 3270 | } else { |
| 3271 | - $myhex = explode('-',$flightaware_id); |
|
| 3271 | + $myhex = explode('-', $flightaware_id); |
|
| 3272 | 3272 | if (count($myhex) > 0) { |
| 3273 | 3273 | $timeelapsed = microtime(true); |
| 3274 | 3274 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3275 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3275 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3276 | 3276 | } |
| 3277 | 3277 | } |
| 3278 | 3278 | } |
@@ -3294,24 +3294,24 @@ discard block |
||
| 3294 | 3294 | { |
| 3295 | 3295 | $timeelapsed = microtime(true); |
| 3296 | 3296 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3297 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3297 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3298 | 3298 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3299 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3299 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3300 | 3300 | } else { |
| 3301 | 3301 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3302 | 3302 | } |
| 3303 | 3303 | if (count($airline_array) == 0) { |
| 3304 | 3304 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3305 | 3305 | } |
| 3306 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3306 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3307 | 3307 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3308 | 3308 | } |
| 3309 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3309 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3310 | 3310 | |
| 3311 | 3311 | } else { |
| 3312 | 3312 | $timeelapsed = microtime(true); |
| 3313 | 3313 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3314 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3314 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3315 | 3315 | } |
| 3316 | 3316 | } |
| 3317 | 3317 | } else $airline_array = array(); |
@@ -3328,27 +3328,27 @@ discard block |
||
| 3328 | 3328 | { |
| 3329 | 3329 | $timeelapsed = microtime(true); |
| 3330 | 3330 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3331 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3331 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3332 | 3332 | } else { |
| 3333 | 3333 | $timeelapsed = microtime(true); |
| 3334 | 3334 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3335 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3335 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3336 | 3336 | } |
| 3337 | 3337 | } |
| 3338 | 3338 | } else { |
| 3339 | 3339 | if ($ModeS != '') { |
| 3340 | 3340 | $timeelapsed = microtime(true); |
| 3341 | 3341 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3342 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3342 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3343 | 3343 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3344 | 3344 | { |
| 3345 | 3345 | $timeelapsed = microtime(true); |
| 3346 | 3346 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3347 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3347 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3348 | 3348 | } else { |
| 3349 | 3349 | $timeelapsed = microtime(true); |
| 3350 | 3350 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3351 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3351 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3352 | 3352 | } |
| 3353 | 3353 | } |
| 3354 | 3354 | } |
@@ -3363,7 +3363,7 @@ discard block |
||
| 3363 | 3363 | } else { |
| 3364 | 3364 | $timeelapsed = microtime(true); |
| 3365 | 3365 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3366 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3366 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3367 | 3367 | } |
| 3368 | 3368 | } |
| 3369 | 3369 | |
@@ -3377,7 +3377,7 @@ discard block |
||
| 3377 | 3377 | } else { |
| 3378 | 3378 | $timeelapsed = microtime(true); |
| 3379 | 3379 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3380 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3380 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3381 | 3381 | } |
| 3382 | 3382 | } |
| 3383 | 3383 | |
@@ -3441,7 +3441,7 @@ discard block |
||
| 3441 | 3441 | { |
| 3442 | 3442 | $timeelapsed = microtime(true); |
| 3443 | 3443 | $image_array = $Image->getSpotterImage($registration); |
| 3444 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3444 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3445 | 3445 | if (!isset($image_array[0]['registration'])) |
| 3446 | 3446 | { |
| 3447 | 3447 | //echo "Add image !!!! \n"; |
@@ -3449,7 +3449,7 @@ discard block |
||
| 3449 | 3449 | } |
| 3450 | 3450 | $timeelapsed = microtime(true); |
| 3451 | 3451 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3452 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3452 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3453 | 3453 | if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
| 3454 | 3454 | } |
| 3455 | 3455 | |
@@ -3457,33 +3457,33 @@ discard block |
||
| 3457 | 3457 | { |
| 3458 | 3458 | if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
| 3459 | 3459 | else $airline_icao = ''; |
| 3460 | - $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3460 | + $image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3461 | 3461 | if (!isset($image_array[0]['registration'])) |
| 3462 | 3462 | { |
| 3463 | 3463 | //echo "Add image !!!! \n"; |
| 3464 | - $Image->addSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3464 | + $Image->addSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3465 | 3465 | } |
| 3466 | 3466 | } |
| 3467 | 3467 | |
| 3468 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 3469 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 3470 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 3471 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3472 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3473 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3474 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3475 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3476 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 3477 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3478 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 3479 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3480 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 3481 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 3482 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 3483 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 3484 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 3485 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 3486 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 3468 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 3469 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 3470 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 3471 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3472 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3473 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3474 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3475 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3476 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 3477 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3478 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 3479 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3480 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 3481 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 3482 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 3483 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 3484 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 3485 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 3486 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 3487 | 3487 | |
| 3488 | 3488 | if (count($airline_array) == 0) |
| 3489 | 3489 | { |
@@ -3511,7 +3511,7 @@ discard block |
||
| 3511 | 3511 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
| 3512 | 3512 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 3513 | 3513 | if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
| 3514 | - $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3514 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3515 | 3515 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3516 | 3516 | |
| 3517 | 3517 | $airline_name = $airline_array[0]['name']; |
@@ -3521,7 +3521,7 @@ discard block |
||
| 3521 | 3521 | if ($airline_type == '') { |
| 3522 | 3522 | $timeelapsed = microtime(true); |
| 3523 | 3523 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3524 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3524 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3525 | 3525 | } |
| 3526 | 3526 | if ($airline_type == null) $airline_type = ''; |
| 3527 | 3527 | $aircraft_type = $aircraft_array[0]['type']; |
@@ -3532,7 +3532,7 @@ discard block |
||
| 3532 | 3532 | $arrival_airport_name = $arrival_airport_array[0]['name']; |
| 3533 | 3533 | $arrival_airport_city = $arrival_airport_array[0]['city']; |
| 3534 | 3534 | $arrival_airport_country = $arrival_airport_array[0]['country']; |
| 3535 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3535 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3536 | 3536 | |
| 3537 | 3537 | try { |
| 3538 | 3538 | |
@@ -3558,13 +3558,13 @@ discard block |
||
| 3558 | 3558 | { |
| 3559 | 3559 | global $globalDBdriver, $globalTimezone; |
| 3560 | 3560 | if ($globalDBdriver == 'mysql') { |
| 3561 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3561 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3562 | 3562 | WHERE spotter_output.ident = :ident |
| 3563 | 3563 | AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 3564 | 3564 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3565 | 3565 | $query_data = array(':ident' => $ident); |
| 3566 | 3566 | } else { |
| 3567 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3567 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3568 | 3568 | WHERE spotter_output.ident = :ident |
| 3569 | 3569 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3570 | 3570 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -3573,8 +3573,8 @@ discard block |
||
| 3573 | 3573 | |
| 3574 | 3574 | $sth = $this->db->prepare($query); |
| 3575 | 3575 | $sth->execute($query_data); |
| 3576 | - $ident_result=''; |
|
| 3577 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3576 | + $ident_result = ''; |
|
| 3577 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3578 | 3578 | { |
| 3579 | 3579 | $ident_result = $row['ident']; |
| 3580 | 3580 | } |
@@ -3600,8 +3600,8 @@ discard block |
||
| 3600 | 3600 | return false; |
| 3601 | 3601 | } else { |
| 3602 | 3602 | $q_array = explode(" ", $q); |
| 3603 | - foreach ($q_array as $q_item){ |
|
| 3604 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 3603 | + foreach ($q_array as $q_item) { |
|
| 3604 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 3605 | 3605 | $additional_query .= " AND ("; |
| 3606 | 3606 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 3607 | 3607 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
@@ -3616,11 +3616,11 @@ discard block |
||
| 3616 | 3616 | } |
| 3617 | 3617 | } |
| 3618 | 3618 | if ($globalDBdriver == 'mysql') { |
| 3619 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3619 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3620 | 3620 | WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 3621 | 3621 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3622 | 3622 | } else { |
| 3623 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3623 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3624 | 3624 | WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 3625 | 3625 | AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 3626 | 3626 | } |
@@ -3637,11 +3637,11 @@ discard block |
||
| 3637 | 3637 | * @return Array the airline list |
| 3638 | 3638 | * |
| 3639 | 3639 | */ |
| 3640 | - public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3640 | + public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3641 | 3641 | { |
| 3642 | 3642 | global $globalDBdriver; |
| 3643 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3644 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3643 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3644 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3645 | 3645 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' "; |
| 3646 | 3646 | if ($olderthanmonths > 0) { |
| 3647 | 3647 | if ($globalDBdriver == 'mysql') { |
@@ -3665,7 +3665,7 @@ discard block |
||
| 3665 | 3665 | |
| 3666 | 3666 | $airline_array = array(); |
| 3667 | 3667 | $temp_array = array(); |
| 3668 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3668 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3669 | 3669 | { |
| 3670 | 3670 | $temp_array['airline_name'] = $row['airline_name']; |
| 3671 | 3671 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3682,11 +3682,11 @@ discard block |
||
| 3682 | 3682 | * @return Array the pilots list |
| 3683 | 3683 | * |
| 3684 | 3684 | */ |
| 3685 | - public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3685 | + public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3686 | 3686 | { |
| 3687 | 3687 | global $globalDBdriver; |
| 3688 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3689 | - $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3688 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3689 | + $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3690 | 3690 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
| 3691 | 3691 | if ($olderthanmonths > 0) { |
| 3692 | 3692 | if ($globalDBdriver == 'mysql') { |
@@ -3712,7 +3712,7 @@ discard block |
||
| 3712 | 3712 | $airline_array = array(); |
| 3713 | 3713 | $temp_array = array(); |
| 3714 | 3714 | |
| 3715 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3715 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3716 | 3716 | { |
| 3717 | 3717 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 3718 | 3718 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3732,7 +3732,7 @@ discard block |
||
| 3732 | 3732 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 3733 | 3733 | { |
| 3734 | 3734 | global $globalDBdriver; |
| 3735 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3735 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3736 | 3736 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 3737 | 3737 | if ($olderthanmonths > 0) { |
| 3738 | 3738 | if ($globalDBdriver == 'mysql') { |
@@ -3758,7 +3758,7 @@ discard block |
||
| 3758 | 3758 | $airline_array = array(); |
| 3759 | 3759 | $temp_array = array(); |
| 3760 | 3760 | |
| 3761 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3761 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3762 | 3762 | { |
| 3763 | 3763 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 3764 | 3764 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3776,11 +3776,11 @@ discard block |
||
| 3776 | 3776 | * @return Array the pilots list |
| 3777 | 3777 | * |
| 3778 | 3778 | */ |
| 3779 | - public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3779 | + public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3780 | 3780 | { |
| 3781 | 3781 | global $globalDBdriver; |
| 3782 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3783 | - $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3782 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3783 | + $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3784 | 3784 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 3785 | 3785 | if ($olderthanmonths > 0) { |
| 3786 | 3786 | if ($globalDBdriver == 'mysql') { |
@@ -3806,7 +3806,7 @@ discard block |
||
| 3806 | 3806 | $airline_array = array(); |
| 3807 | 3807 | $temp_array = array(); |
| 3808 | 3808 | |
| 3809 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3809 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3810 | 3810 | { |
| 3811 | 3811 | $temp_array['owner_name'] = $row['owner_name']; |
| 3812 | 3812 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3821,11 +3821,11 @@ discard block |
||
| 3821 | 3821 | * @return Array the pilots list |
| 3822 | 3822 | * |
| 3823 | 3823 | */ |
| 3824 | - public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3824 | + public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3825 | 3825 | { |
| 3826 | 3826 | global $globalDBdriver; |
| 3827 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3828 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3827 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3828 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3829 | 3829 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 3830 | 3830 | if ($olderthanmonths > 0) { |
| 3831 | 3831 | if ($globalDBdriver == 'mysql') { |
@@ -3851,7 +3851,7 @@ discard block |
||
| 3851 | 3851 | $airline_array = array(); |
| 3852 | 3852 | $temp_array = array(); |
| 3853 | 3853 | |
| 3854 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3854 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3855 | 3855 | { |
| 3856 | 3856 | $temp_array['owner_name'] = $row['owner_name']; |
| 3857 | 3857 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3867,11 +3867,11 @@ discard block |
||
| 3867 | 3867 | * @return Array the airline list |
| 3868 | 3868 | * |
| 3869 | 3869 | */ |
| 3870 | - public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
|
| 3870 | + public function countAllAirlinesByAircraft($aircraft_icao, $filters = array()) |
|
| 3871 | 3871 | { |
| 3872 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3873 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3874 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3872 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3873 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3874 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3875 | 3875 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 3876 | 3876 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 3877 | 3877 | ORDER BY airline_count DESC"; |
@@ -3883,7 +3883,7 @@ discard block |
||
| 3883 | 3883 | $airline_array = array(); |
| 3884 | 3884 | $temp_array = array(); |
| 3885 | 3885 | |
| 3886 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3886 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3887 | 3887 | { |
| 3888 | 3888 | $temp_array['airline_name'] = $row['airline_name']; |
| 3889 | 3889 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3903,11 +3903,11 @@ discard block |
||
| 3903 | 3903 | * @return Array the airline country list |
| 3904 | 3904 | * |
| 3905 | 3905 | */ |
| 3906 | - public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 3906 | + public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 3907 | 3907 | { |
| 3908 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3909 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3910 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 3908 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3909 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3910 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 3911 | 3911 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 3912 | 3912 | GROUP BY spotter_output.airline_country |
| 3913 | 3913 | ORDER BY airline_country_count DESC |
@@ -3920,7 +3920,7 @@ discard block |
||
| 3920 | 3920 | $airline_country_array = array(); |
| 3921 | 3921 | $temp_array = array(); |
| 3922 | 3922 | |
| 3923 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3923 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3924 | 3924 | { |
| 3925 | 3925 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 3926 | 3926 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -3939,11 +3939,11 @@ discard block |
||
| 3939 | 3939 | * @return Array the airline list |
| 3940 | 3940 | * |
| 3941 | 3941 | */ |
| 3942 | - public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
|
| 3942 | + public function countAllAirlinesByAirport($airport_icao, $filters = array()) |
|
| 3943 | 3943 | { |
| 3944 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 3945 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3946 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3944 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 3945 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3946 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3947 | 3947 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
| 3948 | 3948 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 3949 | 3949 | ORDER BY airline_count DESC"; |
@@ -3955,7 +3955,7 @@ discard block |
||
| 3955 | 3955 | $airline_array = array(); |
| 3956 | 3956 | $temp_array = array(); |
| 3957 | 3957 | |
| 3958 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3958 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3959 | 3959 | { |
| 3960 | 3960 | $temp_array['airline_name'] = $row['airline_name']; |
| 3961 | 3961 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3974,11 +3974,11 @@ discard block |
||
| 3974 | 3974 | * @return Array the airline country list |
| 3975 | 3975 | * |
| 3976 | 3976 | */ |
| 3977 | - public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
|
| 3977 | + public function countAllAirlineCountriesByAirport($airport_icao, $filters = array()) |
|
| 3978 | 3978 | { |
| 3979 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 3980 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3981 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 3979 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 3980 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3981 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 3982 | 3982 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
| 3983 | 3983 | GROUP BY spotter_output.airline_country |
| 3984 | 3984 | ORDER BY airline_country_count DESC |
@@ -3991,7 +3991,7 @@ discard block |
||
| 3991 | 3991 | $airline_country_array = array(); |
| 3992 | 3992 | $temp_array = array(); |
| 3993 | 3993 | |
| 3994 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3994 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3995 | 3995 | { |
| 3996 | 3996 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 3997 | 3997 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4008,11 +4008,11 @@ discard block |
||
| 4008 | 4008 | * @return Array the airline list |
| 4009 | 4009 | * |
| 4010 | 4010 | */ |
| 4011 | - public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4011 | + public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4012 | 4012 | { |
| 4013 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4014 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4015 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4013 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4014 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4015 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4016 | 4016 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4017 | 4017 | GROUP BY spotter_output.airline_name |
| 4018 | 4018 | ORDER BY airline_count DESC"; |
@@ -4023,7 +4023,7 @@ discard block |
||
| 4023 | 4023 | $airline_array = array(); |
| 4024 | 4024 | $temp_array = array(); |
| 4025 | 4025 | |
| 4026 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4026 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4027 | 4027 | { |
| 4028 | 4028 | $temp_array['airline_name'] = $row['airline_name']; |
| 4029 | 4029 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4043,11 +4043,11 @@ discard block |
||
| 4043 | 4043 | * @return Array the airline country list |
| 4044 | 4044 | * |
| 4045 | 4045 | */ |
| 4046 | - public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4046 | + public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4047 | 4047 | { |
| 4048 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4049 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4050 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4048 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4049 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4050 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4051 | 4051 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4052 | 4052 | GROUP BY spotter_output.airline_country |
| 4053 | 4053 | ORDER BY airline_country_count DESC |
@@ -4060,7 +4060,7 @@ discard block |
||
| 4060 | 4060 | $airline_country_array = array(); |
| 4061 | 4061 | $temp_array = array(); |
| 4062 | 4062 | |
| 4063 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4063 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4064 | 4064 | { |
| 4065 | 4065 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4066 | 4066 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4076,11 +4076,11 @@ discard block |
||
| 4076 | 4076 | * @return Array the airline list |
| 4077 | 4077 | * |
| 4078 | 4078 | */ |
| 4079 | - public function countAllAirlinesByDate($date,$filters = array()) |
|
| 4079 | + public function countAllAirlinesByDate($date, $filters = array()) |
|
| 4080 | 4080 | { |
| 4081 | 4081 | global $globalTimezone, $globalDBdriver; |
| 4082 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4083 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4082 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4083 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4084 | 4084 | if ($globalTimezone != '') { |
| 4085 | 4085 | date_default_timezone_set($globalTimezone); |
| 4086 | 4086 | $datetime = new DateTime($date); |
@@ -4088,12 +4088,12 @@ discard block |
||
| 4088 | 4088 | } else $offset = '+00:00'; |
| 4089 | 4089 | |
| 4090 | 4090 | if ($globalDBdriver == 'mysql') { |
| 4091 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4091 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4092 | 4092 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4093 | 4093 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
| 4094 | 4094 | ORDER BY airline_count DESC"; |
| 4095 | 4095 | } else { |
| 4096 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4096 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4097 | 4097 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4098 | 4098 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
| 4099 | 4099 | ORDER BY airline_count DESC"; |
@@ -4104,7 +4104,7 @@ discard block |
||
| 4104 | 4104 | |
| 4105 | 4105 | $airline_array = array(); |
| 4106 | 4106 | $temp_array = array(); |
| 4107 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4107 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4108 | 4108 | { |
| 4109 | 4109 | $temp_array['airline_name'] = $row['airline_name']; |
| 4110 | 4110 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4124,11 +4124,11 @@ discard block |
||
| 4124 | 4124 | * @return Array the airline country list |
| 4125 | 4125 | * |
| 4126 | 4126 | */ |
| 4127 | - public function countAllAirlineCountriesByDate($date,$filters = array()) |
|
| 4127 | + public function countAllAirlineCountriesByDate($date, $filters = array()) |
|
| 4128 | 4128 | { |
| 4129 | 4129 | global $globalTimezone, $globalDBdriver; |
| 4130 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4131 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4130 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4131 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4132 | 4132 | if ($globalTimezone != '') { |
| 4133 | 4133 | date_default_timezone_set($globalTimezone); |
| 4134 | 4134 | $datetime = new DateTime($date); |
@@ -4136,13 +4136,13 @@ discard block |
||
| 4136 | 4136 | } else $offset = '+00:00'; |
| 4137 | 4137 | |
| 4138 | 4138 | if ($globalDBdriver == 'mysql') { |
| 4139 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4139 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4140 | 4140 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4141 | 4141 | GROUP BY spotter_output.airline_country |
| 4142 | 4142 | ORDER BY airline_country_count DESC |
| 4143 | 4143 | LIMIT 10 OFFSET 0"; |
| 4144 | 4144 | } else { |
| 4145 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4145 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4146 | 4146 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4147 | 4147 | GROUP BY spotter_output.airline_country |
| 4148 | 4148 | ORDER BY airline_country_count DESC |
@@ -4154,7 +4154,7 @@ discard block |
||
| 4154 | 4154 | |
| 4155 | 4155 | $airline_country_array = array(); |
| 4156 | 4156 | $temp_array = array(); |
| 4157 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4157 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4158 | 4158 | { |
| 4159 | 4159 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4160 | 4160 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4171,11 +4171,11 @@ discard block |
||
| 4171 | 4171 | * @return Array the airline list |
| 4172 | 4172 | * |
| 4173 | 4173 | */ |
| 4174 | - public function countAllAirlinesByIdent($ident,$filters = array()) |
|
| 4174 | + public function countAllAirlinesByIdent($ident, $filters = array()) |
|
| 4175 | 4175 | { |
| 4176 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 4177 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4178 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4176 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 4177 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4178 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4179 | 4179 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 4180 | 4180 | GROUP BY spotter_output.airline_name |
| 4181 | 4181 | ORDER BY airline_count DESC"; |
@@ -4187,7 +4187,7 @@ discard block |
||
| 4187 | 4187 | $airline_array = array(); |
| 4188 | 4188 | $temp_array = array(); |
| 4189 | 4189 | |
| 4190 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4190 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4191 | 4191 | { |
| 4192 | 4192 | $temp_array['airline_name'] = $row['airline_name']; |
| 4193 | 4193 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4205,25 +4205,25 @@ discard block |
||
| 4205 | 4205 | * @return Array the airline list |
| 4206 | 4206 | * |
| 4207 | 4207 | */ |
| 4208 | - public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 4208 | + public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4209 | 4209 | { |
| 4210 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4211 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4212 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4210 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4211 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4212 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4213 | 4213 | |
| 4214 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4214 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4215 | 4215 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4216 | 4216 | GROUP BY spotter_output.airline_name |
| 4217 | 4217 | ORDER BY airline_count DESC"; |
| 4218 | 4218 | |
| 4219 | 4219 | |
| 4220 | 4220 | $sth = $this->db->prepare($query); |
| 4221 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4221 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4222 | 4222 | |
| 4223 | 4223 | $airline_array = array(); |
| 4224 | 4224 | $temp_array = array(); |
| 4225 | 4225 | |
| 4226 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4226 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4227 | 4227 | { |
| 4228 | 4228 | $temp_array['airline_name'] = $row['airline_name']; |
| 4229 | 4229 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4241,13 +4241,13 @@ discard block |
||
| 4241 | 4241 | * @return Array the airline country list |
| 4242 | 4242 | * |
| 4243 | 4243 | */ |
| 4244 | - public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
|
| 4244 | + public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4245 | 4245 | { |
| 4246 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4247 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4248 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4246 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4247 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4248 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4249 | 4249 | |
| 4250 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4250 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4251 | 4251 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4252 | 4252 | GROUP BY spotter_output.airline_country |
| 4253 | 4253 | ORDER BY airline_country_count DESC |
@@ -4255,11 +4255,11 @@ discard block |
||
| 4255 | 4255 | |
| 4256 | 4256 | |
| 4257 | 4257 | $sth = $this->db->prepare($query); |
| 4258 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4258 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4259 | 4259 | |
| 4260 | 4260 | $airline_country_array = array(); |
| 4261 | 4261 | $temp_array = array(); |
| 4262 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4262 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4263 | 4263 | { |
| 4264 | 4264 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4265 | 4265 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4277,11 +4277,11 @@ discard block |
||
| 4277 | 4277 | * @return Array the airline list |
| 4278 | 4278 | * |
| 4279 | 4279 | */ |
| 4280 | - public function countAllAirlinesByCountry($country,$filters = array()) |
|
| 4280 | + public function countAllAirlinesByCountry($country, $filters = array()) |
|
| 4281 | 4281 | { |
| 4282 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4283 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4284 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4282 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4283 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4284 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4285 | 4285 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4286 | 4286 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4287 | 4287 | ORDER BY airline_count DESC"; |
@@ -4292,7 +4292,7 @@ discard block |
||
| 4292 | 4292 | |
| 4293 | 4293 | $airline_array = array(); |
| 4294 | 4294 | $temp_array = array(); |
| 4295 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4295 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4296 | 4296 | { |
| 4297 | 4297 | $temp_array['airline_name'] = $row['airline_name']; |
| 4298 | 4298 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4311,11 +4311,11 @@ discard block |
||
| 4311 | 4311 | * @return Array the airline country list |
| 4312 | 4312 | * |
| 4313 | 4313 | */ |
| 4314 | - public function countAllAirlineCountriesByCountry($country,$filters = array()) |
|
| 4314 | + public function countAllAirlineCountriesByCountry($country, $filters = array()) |
|
| 4315 | 4315 | { |
| 4316 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4317 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4318 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4316 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4317 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4318 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4319 | 4319 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4320 | 4320 | GROUP BY spotter_output.airline_country |
| 4321 | 4321 | ORDER BY airline_country_count DESC |
@@ -4327,7 +4327,7 @@ discard block |
||
| 4327 | 4327 | |
| 4328 | 4328 | $airline_country_array = array(); |
| 4329 | 4329 | $temp_array = array(); |
| 4330 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4330 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4331 | 4331 | { |
| 4332 | 4332 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4333 | 4333 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4346,8 +4346,8 @@ discard block |
||
| 4346 | 4346 | */ |
| 4347 | 4347 | public function countAllAirlineCountries($limit = true, $filters = array()) |
| 4348 | 4348 | { |
| 4349 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4350 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4349 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4350 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4351 | 4351 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
| 4352 | 4352 | GROUP BY spotter_output.airline_country |
| 4353 | 4353 | ORDER BY airline_country_count DESC"; |
@@ -4358,7 +4358,7 @@ discard block |
||
| 4358 | 4358 | |
| 4359 | 4359 | $airline_array = array(); |
| 4360 | 4360 | $temp_array = array(); |
| 4361 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4361 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4362 | 4362 | { |
| 4363 | 4363 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4364 | 4364 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4374,11 +4374,11 @@ discard block |
||
| 4374 | 4374 | * @return Array the airline country list |
| 4375 | 4375 | * |
| 4376 | 4376 | */ |
| 4377 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
| 4377 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
| 4378 | 4378 | { |
| 4379 | 4379 | global $globalDBdriver; |
| 4380 | 4380 | //$filter_query = $this->getFilter($filters,true,true); |
| 4381 | - $Connection= new Connection($this->db); |
|
| 4381 | + $Connection = new Connection($this->db); |
|
| 4382 | 4382 | if (!$Connection->tableExists('countries')) return array(); |
| 4383 | 4383 | /* |
| 4384 | 4384 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -4413,7 +4413,7 @@ discard block |
||
| 4413 | 4413 | $flight_array = array(); |
| 4414 | 4414 | $temp_array = array(); |
| 4415 | 4415 | |
| 4416 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4416 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4417 | 4417 | { |
| 4418 | 4418 | $temp_array['flight_count'] = $row['nb']; |
| 4419 | 4419 | $temp_array['flight_country'] = $row['name']; |
@@ -4431,12 +4431,12 @@ discard block |
||
| 4431 | 4431 | * @return Array the aircraft list |
| 4432 | 4432 | * |
| 4433 | 4433 | */ |
| 4434 | - public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4434 | + public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4435 | 4435 | { |
| 4436 | 4436 | global $globalDBdriver; |
| 4437 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4437 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4438 | 4438 | |
| 4439 | - $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4439 | + $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4440 | 4440 | FROM spotter_output ".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> ''"; |
| 4441 | 4441 | if ($olderthanmonths > 0) { |
| 4442 | 4442 | if ($globalDBdriver == 'mysql') { |
@@ -4461,7 +4461,7 @@ discard block |
||
| 4461 | 4461 | |
| 4462 | 4462 | $aircraft_array = array(); |
| 4463 | 4463 | $temp_array = array(); |
| 4464 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4464 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4465 | 4465 | { |
| 4466 | 4466 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4467 | 4467 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4478,11 +4478,11 @@ discard block |
||
| 4478 | 4478 | * @return Array the aircraft list |
| 4479 | 4479 | * |
| 4480 | 4480 | */ |
| 4481 | - public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4481 | + public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4482 | 4482 | { |
| 4483 | 4483 | global $globalDBdriver; |
| 4484 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4485 | - $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4484 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4485 | + $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4486 | 4486 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
| 4487 | 4487 | if ($olderthanmonths > 0) { |
| 4488 | 4488 | if ($globalDBdriver == 'mysql') { |
@@ -4507,7 +4507,7 @@ discard block |
||
| 4507 | 4507 | |
| 4508 | 4508 | $aircraft_array = array(); |
| 4509 | 4509 | $temp_array = array(); |
| 4510 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4510 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4511 | 4511 | { |
| 4512 | 4512 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 4513 | 4513 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4525,11 +4525,11 @@ discard block |
||
| 4525 | 4525 | * @return Array the aircraft list |
| 4526 | 4526 | * |
| 4527 | 4527 | */ |
| 4528 | - public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4528 | + public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4529 | 4529 | { |
| 4530 | 4530 | global $globalDBdriver; |
| 4531 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4532 | - $query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4531 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4532 | + $query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4533 | 4533 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
| 4534 | 4534 | if ($olderthanmonths > 0) { |
| 4535 | 4535 | if ($globalDBdriver == 'mysql') { |
@@ -4554,7 +4554,7 @@ discard block |
||
| 4554 | 4554 | |
| 4555 | 4555 | $aircraft_array = array(); |
| 4556 | 4556 | $temp_array = array(); |
| 4557 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4557 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4558 | 4558 | { |
| 4559 | 4559 | //$temp_array['airline_icao'] = $row['airline_icao']; |
| 4560 | 4560 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4573,13 +4573,13 @@ discard block |
||
| 4573 | 4573 | * @return Array the aircraft list |
| 4574 | 4574 | * |
| 4575 | 4575 | */ |
| 4576 | - public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
|
| 4576 | + public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array()) |
|
| 4577 | 4577 | { |
| 4578 | 4578 | $Image = new Image($this->db); |
| 4579 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4580 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4579 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4580 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4581 | 4581 | |
| 4582 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4582 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4583 | 4583 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4584 | 4584 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
| 4585 | 4585 | ORDER BY registration_count DESC"; |
@@ -4590,14 +4590,14 @@ discard block |
||
| 4590 | 4590 | $aircraft_array = array(); |
| 4591 | 4591 | $temp_array = array(); |
| 4592 | 4592 | |
| 4593 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4593 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4594 | 4594 | { |
| 4595 | 4595 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4596 | 4596 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4597 | 4597 | $temp_array['registration'] = $row['registration']; |
| 4598 | 4598 | $temp_array['airline_name'] = $row['airline_name']; |
| 4599 | 4599 | $temp_array['image_thumbnail'] = ""; |
| 4600 | - if($row['registration'] != "") |
|
| 4600 | + if ($row['registration'] != "") |
|
| 4601 | 4601 | { |
| 4602 | 4602 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4603 | 4603 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4616,11 +4616,11 @@ discard block |
||
| 4616 | 4616 | * @return Array the aircraft list |
| 4617 | 4617 | * |
| 4618 | 4618 | */ |
| 4619 | - public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
|
| 4619 | + public function countAllAircraftTypesByAirline($airline_icao, $filters = array()) |
|
| 4620 | 4620 | { |
| 4621 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4622 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4623 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4621 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4622 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4623 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4624 | 4624 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao |
| 4625 | 4625 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 4626 | 4626 | ORDER BY aircraft_icao_count DESC"; |
@@ -4631,7 +4631,7 @@ discard block |
||
| 4631 | 4631 | $aircraft_array = array(); |
| 4632 | 4632 | $temp_array = array(); |
| 4633 | 4633 | |
| 4634 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4634 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4635 | 4635 | { |
| 4636 | 4636 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4637 | 4637 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4649,13 +4649,13 @@ discard block |
||
| 4649 | 4649 | * @return Array the aircraft list |
| 4650 | 4650 | * |
| 4651 | 4651 | */ |
| 4652 | - public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
|
| 4652 | + public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array()) |
|
| 4653 | 4653 | { |
| 4654 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4654 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4655 | 4655 | $Image = new Image($this->db); |
| 4656 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4656 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4657 | 4657 | |
| 4658 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4658 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4659 | 4659 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao |
| 4660 | 4660 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 4661 | 4661 | ORDER BY registration_count DESC"; |
@@ -4665,14 +4665,14 @@ discard block |
||
| 4665 | 4665 | |
| 4666 | 4666 | $aircraft_array = array(); |
| 4667 | 4667 | $temp_array = array(); |
| 4668 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4668 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4669 | 4669 | { |
| 4670 | 4670 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4671 | 4671 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4672 | 4672 | $temp_array['registration'] = $row['registration']; |
| 4673 | 4673 | $temp_array['airline_name'] = $row['airline_name']; |
| 4674 | 4674 | $temp_array['image_thumbnail'] = ""; |
| 4675 | - if($row['registration'] != "") |
|
| 4675 | + if ($row['registration'] != "") |
|
| 4676 | 4676 | { |
| 4677 | 4677 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4678 | 4678 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4691,11 +4691,11 @@ discard block |
||
| 4691 | 4691 | * @return Array the aircraft list |
| 4692 | 4692 | * |
| 4693 | 4693 | */ |
| 4694 | - public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
|
| 4694 | + public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array()) |
|
| 4695 | 4695 | { |
| 4696 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4697 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4698 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4696 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4697 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4698 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4699 | 4699 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao |
| 4700 | 4700 | GROUP BY spotter_output.aircraft_manufacturer |
| 4701 | 4701 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4706,7 +4706,7 @@ discard block |
||
| 4706 | 4706 | $aircraft_array = array(); |
| 4707 | 4707 | $temp_array = array(); |
| 4708 | 4708 | |
| 4709 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4709 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4710 | 4710 | { |
| 4711 | 4711 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 4712 | 4712 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4723,12 +4723,12 @@ discard block |
||
| 4723 | 4723 | * @return Array the aircraft list |
| 4724 | 4724 | * |
| 4725 | 4725 | */ |
| 4726 | - public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
|
| 4726 | + public function countAllAircraftTypesByAirport($airport_icao, $filters = array()) |
|
| 4727 | 4727 | { |
| 4728 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4729 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4728 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4729 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4730 | 4730 | |
| 4731 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4731 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4732 | 4732 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4733 | 4733 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 4734 | 4734 | ORDER BY aircraft_icao_count DESC"; |
@@ -4738,7 +4738,7 @@ discard block |
||
| 4738 | 4738 | |
| 4739 | 4739 | $aircraft_array = array(); |
| 4740 | 4740 | $temp_array = array(); |
| 4741 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4741 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4742 | 4742 | { |
| 4743 | 4743 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4744 | 4744 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4756,13 +4756,13 @@ discard block |
||
| 4756 | 4756 | * @return Array the aircraft list |
| 4757 | 4757 | * |
| 4758 | 4758 | */ |
| 4759 | - public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
|
| 4759 | + public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array()) |
|
| 4760 | 4760 | { |
| 4761 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4761 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4762 | 4762 | $Image = new Image($this->db); |
| 4763 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4763 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4764 | 4764 | |
| 4765 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4765 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4766 | 4766 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4767 | 4767 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 4768 | 4768 | ORDER BY registration_count DESC"; |
@@ -4772,14 +4772,14 @@ discard block |
||
| 4772 | 4772 | |
| 4773 | 4773 | $aircraft_array = array(); |
| 4774 | 4774 | $temp_array = array(); |
| 4775 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4775 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4776 | 4776 | { |
| 4777 | 4777 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4778 | 4778 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4779 | 4779 | $temp_array['registration'] = $row['registration']; |
| 4780 | 4780 | $temp_array['airline_name'] = $row['airline_name']; |
| 4781 | 4781 | $temp_array['image_thumbnail'] = ""; |
| 4782 | - if($row['registration'] != "") |
|
| 4782 | + if ($row['registration'] != "") |
|
| 4783 | 4783 | { |
| 4784 | 4784 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4785 | 4785 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4797,11 +4797,11 @@ discard block |
||
| 4797 | 4797 | * @return Array the aircraft list |
| 4798 | 4798 | * |
| 4799 | 4799 | */ |
| 4800 | - public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
|
| 4800 | + public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array()) |
|
| 4801 | 4801 | { |
| 4802 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4803 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4804 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4802 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4803 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4804 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4805 | 4805 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4806 | 4806 | GROUP BY spotter_output.aircraft_manufacturer |
| 4807 | 4807 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4812,7 +4812,7 @@ discard block |
||
| 4812 | 4812 | |
| 4813 | 4813 | $aircraft_array = array(); |
| 4814 | 4814 | $temp_array = array(); |
| 4815 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4815 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4816 | 4816 | { |
| 4817 | 4817 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 4818 | 4818 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4827,12 +4827,12 @@ discard block |
||
| 4827 | 4827 | * @return Array the aircraft list |
| 4828 | 4828 | * |
| 4829 | 4829 | */ |
| 4830 | - public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4830 | + public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4831 | 4831 | { |
| 4832 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4833 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4832 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4833 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4834 | 4834 | |
| 4835 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4835 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4836 | 4836 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4837 | 4837 | GROUP BY spotter_output.aircraft_name |
| 4838 | 4838 | ORDER BY aircraft_icao_count DESC"; |
@@ -4841,7 +4841,7 @@ discard block |
||
| 4841 | 4841 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 4842 | 4842 | $aircraft_array = array(); |
| 4843 | 4843 | $temp_array = array(); |
| 4844 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4844 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4845 | 4845 | { |
| 4846 | 4846 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4847 | 4847 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4860,11 +4860,11 @@ discard block |
||
| 4860 | 4860 | */ |
| 4861 | 4861 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 4862 | 4862 | { |
| 4863 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4863 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4864 | 4864 | $Image = new Image($this->db); |
| 4865 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4865 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4866 | 4866 | |
| 4867 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4867 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4868 | 4868 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4869 | 4869 | GROUP BY spotter_output.registration |
| 4870 | 4870 | ORDER BY registration_count DESC"; |
@@ -4874,14 +4874,14 @@ discard block |
||
| 4874 | 4874 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 4875 | 4875 | $aircraft_array = array(); |
| 4876 | 4876 | $temp_array = array(); |
| 4877 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4877 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4878 | 4878 | { |
| 4879 | 4879 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4880 | 4880 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4881 | 4881 | $temp_array['registration'] = $row['registration']; |
| 4882 | 4882 | $temp_array['airline_name'] = $row['airline_name']; |
| 4883 | 4883 | $temp_array['image_thumbnail'] = ""; |
| 4884 | - if($row['registration'] != "") |
|
| 4884 | + if ($row['registration'] != "") |
|
| 4885 | 4885 | { |
| 4886 | 4886 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4887 | 4887 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4898,11 +4898,11 @@ discard block |
||
| 4898 | 4898 | * @return Array the aircraft list |
| 4899 | 4899 | * |
| 4900 | 4900 | */ |
| 4901 | - public function countAllAircraftTypesByDate($date,$filters = array()) |
|
| 4901 | + public function countAllAircraftTypesByDate($date, $filters = array()) |
|
| 4902 | 4902 | { |
| 4903 | 4903 | global $globalTimezone, $globalDBdriver; |
| 4904 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4905 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4904 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4905 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4906 | 4906 | if ($globalTimezone != '') { |
| 4907 | 4907 | date_default_timezone_set($globalTimezone); |
| 4908 | 4908 | $datetime = new DateTime($date); |
@@ -4910,12 +4910,12 @@ discard block |
||
| 4910 | 4910 | } else $offset = '+00:00'; |
| 4911 | 4911 | |
| 4912 | 4912 | if ($globalDBdriver == 'mysql') { |
| 4913 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4913 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4914 | 4914 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4915 | 4915 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 4916 | 4916 | ORDER BY aircraft_icao_count DESC"; |
| 4917 | 4917 | } else { |
| 4918 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4918 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4919 | 4919 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4920 | 4920 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 4921 | 4921 | ORDER BY aircraft_icao_count DESC"; |
@@ -4926,7 +4926,7 @@ discard block |
||
| 4926 | 4926 | |
| 4927 | 4927 | $aircraft_array = array(); |
| 4928 | 4928 | $temp_array = array(); |
| 4929 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4929 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4930 | 4930 | { |
| 4931 | 4931 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4932 | 4932 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4944,12 +4944,12 @@ discard block |
||
| 4944 | 4944 | * @return Array the aircraft list |
| 4945 | 4945 | * |
| 4946 | 4946 | */ |
| 4947 | - public function countAllAircraftRegistrationByDate($date,$filters = array()) |
|
| 4947 | + public function countAllAircraftRegistrationByDate($date, $filters = array()) |
|
| 4948 | 4948 | { |
| 4949 | 4949 | global $globalTimezone, $globalDBdriver; |
| 4950 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4950 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4951 | 4951 | $Image = new Image($this->db); |
| 4952 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4952 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4953 | 4953 | if ($globalTimezone != '') { |
| 4954 | 4954 | date_default_timezone_set($globalTimezone); |
| 4955 | 4955 | $datetime = new DateTime($date); |
@@ -4957,12 +4957,12 @@ discard block |
||
| 4957 | 4957 | } else $offset = '+00:00'; |
| 4958 | 4958 | |
| 4959 | 4959 | if ($globalDBdriver == 'mysql') { |
| 4960 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4960 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4961 | 4961 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4962 | 4962 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 4963 | 4963 | ORDER BY registration_count DESC"; |
| 4964 | 4964 | } else { |
| 4965 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4965 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4966 | 4966 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4967 | 4967 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 4968 | 4968 | ORDER BY registration_count DESC"; |
@@ -4973,14 +4973,14 @@ discard block |
||
| 4973 | 4973 | |
| 4974 | 4974 | $aircraft_array = array(); |
| 4975 | 4975 | $temp_array = array(); |
| 4976 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4976 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4977 | 4977 | { |
| 4978 | 4978 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4979 | 4979 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4980 | 4980 | $temp_array['registration'] = $row['registration']; |
| 4981 | 4981 | $temp_array['airline_name'] = $row['airline_name']; |
| 4982 | 4982 | $temp_array['image_thumbnail'] = ""; |
| 4983 | - if($row['registration'] != "") |
|
| 4983 | + if ($row['registration'] != "") |
|
| 4984 | 4984 | { |
| 4985 | 4985 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4986 | 4986 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4999,11 +4999,11 @@ discard block |
||
| 4999 | 4999 | * @return Array the aircraft manufacturer list |
| 5000 | 5000 | * |
| 5001 | 5001 | */ |
| 5002 | - public function countAllAircraftManufacturerByDate($date,$filters = array()) |
|
| 5002 | + public function countAllAircraftManufacturerByDate($date, $filters = array()) |
|
| 5003 | 5003 | { |
| 5004 | 5004 | global $globalTimezone, $globalDBdriver; |
| 5005 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5006 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5005 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5006 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5007 | 5007 | if ($globalTimezone != '') { |
| 5008 | 5008 | date_default_timezone_set($globalTimezone); |
| 5009 | 5009 | $datetime = new DateTime($date); |
@@ -5011,12 +5011,12 @@ discard block |
||
| 5011 | 5011 | } else $offset = '+00:00'; |
| 5012 | 5012 | |
| 5013 | 5013 | if ($globalDBdriver == 'mysql') { |
| 5014 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5014 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5015 | 5015 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5016 | 5016 | GROUP BY spotter_output.aircraft_manufacturer |
| 5017 | 5017 | ORDER BY aircraft_manufacturer_count DESC"; |
| 5018 | 5018 | } else { |
| 5019 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5019 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5020 | 5020 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5021 | 5021 | GROUP BY spotter_output.aircraft_manufacturer |
| 5022 | 5022 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5028,7 +5028,7 @@ discard block |
||
| 5028 | 5028 | $aircraft_array = array(); |
| 5029 | 5029 | $temp_array = array(); |
| 5030 | 5030 | |
| 5031 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5031 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5032 | 5032 | { |
| 5033 | 5033 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5034 | 5034 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5045,11 +5045,11 @@ discard block |
||
| 5045 | 5045 | * @return Array the aircraft list |
| 5046 | 5046 | * |
| 5047 | 5047 | */ |
| 5048 | - public function countAllAircraftTypesByIdent($ident,$filters = array()) |
|
| 5048 | + public function countAllAircraftTypesByIdent($ident, $filters = array()) |
|
| 5049 | 5049 | { |
| 5050 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5051 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5052 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5050 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5051 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5052 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5053 | 5053 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 5054 | 5054 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5055 | 5055 | ORDER BY aircraft_icao_count DESC"; |
@@ -5060,7 +5060,7 @@ discard block |
||
| 5060 | 5060 | $aircraft_array = array(); |
| 5061 | 5061 | $temp_array = array(); |
| 5062 | 5062 | |
| 5063 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5063 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5064 | 5064 | { |
| 5065 | 5065 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5066 | 5066 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5078,13 +5078,13 @@ discard block |
||
| 5078 | 5078 | * @return Array the aircraft list |
| 5079 | 5079 | * |
| 5080 | 5080 | */ |
| 5081 | - public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
|
| 5081 | + public function countAllAircraftRegistrationByIdent($ident, $filters = array()) |
|
| 5082 | 5082 | { |
| 5083 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5083 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5084 | 5084 | $Image = new Image($this->db); |
| 5085 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5085 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5086 | 5086 | |
| 5087 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5087 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5088 | 5088 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident |
| 5089 | 5089 | GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5090 | 5090 | ORDER BY registration_count DESC"; |
@@ -5096,14 +5096,14 @@ discard block |
||
| 5096 | 5096 | $aircraft_array = array(); |
| 5097 | 5097 | $temp_array = array(); |
| 5098 | 5098 | |
| 5099 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5099 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5100 | 5100 | { |
| 5101 | 5101 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5102 | 5102 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5103 | 5103 | $temp_array['registration'] = $row['registration']; |
| 5104 | 5104 | $temp_array['airline_name'] = $row['airline_name']; |
| 5105 | 5105 | $temp_array['image_thumbnail'] = ""; |
| 5106 | - if($row['registration'] != "") |
|
| 5106 | + if ($row['registration'] != "") |
|
| 5107 | 5107 | { |
| 5108 | 5108 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5109 | 5109 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5122,11 +5122,11 @@ discard block |
||
| 5122 | 5122 | * @return Array the aircraft manufacturer list |
| 5123 | 5123 | * |
| 5124 | 5124 | */ |
| 5125 | - public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
|
| 5125 | + public function countAllAircraftManufacturerByIdent($ident, $filters = array()) |
|
| 5126 | 5126 | { |
| 5127 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5128 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5129 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5127 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5128 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5129 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5130 | 5130 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident |
| 5131 | 5131 | GROUP BY spotter_output.aircraft_manufacturer |
| 5132 | 5132 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5136,7 +5136,7 @@ discard block |
||
| 5136 | 5136 | $sth->execute(array(':ident' => $ident)); |
| 5137 | 5137 | $aircraft_array = array(); |
| 5138 | 5138 | $temp_array = array(); |
| 5139 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5139 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5140 | 5140 | { |
| 5141 | 5141 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5142 | 5142 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5152,24 +5152,24 @@ discard block |
||
| 5152 | 5152 | * @return Array the aircraft list |
| 5153 | 5153 | * |
| 5154 | 5154 | */ |
| 5155 | - public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5155 | + public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5156 | 5156 | { |
| 5157 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5158 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5159 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5157 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5158 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5159 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5160 | 5160 | |
| 5161 | 5161 | |
| 5162 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5162 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5163 | 5163 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5164 | 5164 | GROUP BY spotter_output.aircraft_name |
| 5165 | 5165 | ORDER BY aircraft_icao_count DESC"; |
| 5166 | 5166 | |
| 5167 | 5167 | |
| 5168 | 5168 | $sth = $this->db->prepare($query); |
| 5169 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5169 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5170 | 5170 | $aircraft_array = array(); |
| 5171 | 5171 | $temp_array = array(); |
| 5172 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5172 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5173 | 5173 | { |
| 5174 | 5174 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5175 | 5175 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5185,33 +5185,33 @@ discard block |
||
| 5185 | 5185 | * @return Array the aircraft list |
| 5186 | 5186 | * |
| 5187 | 5187 | */ |
| 5188 | - public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5188 | + public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5189 | 5189 | { |
| 5190 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5190 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5191 | 5191 | $Image = new Image($this->db); |
| 5192 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5193 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5192 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5193 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5194 | 5194 | |
| 5195 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5195 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5196 | 5196 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5197 | 5197 | GROUP BY spotter_output.registration |
| 5198 | 5198 | ORDER BY registration_count DESC"; |
| 5199 | 5199 | |
| 5200 | 5200 | |
| 5201 | 5201 | $sth = $this->db->prepare($query); |
| 5202 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5202 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5203 | 5203 | |
| 5204 | 5204 | $aircraft_array = array(); |
| 5205 | 5205 | $temp_array = array(); |
| 5206 | 5206 | |
| 5207 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5207 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5208 | 5208 | { |
| 5209 | 5209 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5210 | 5210 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5211 | 5211 | $temp_array['registration'] = $row['registration']; |
| 5212 | 5212 | $temp_array['airline_name'] = $row['airline_name']; |
| 5213 | 5213 | $temp_array['image_thumbnail'] = ""; |
| 5214 | - if($row['registration'] != "") |
|
| 5214 | + if ($row['registration'] != "") |
|
| 5215 | 5215 | { |
| 5216 | 5216 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5217 | 5217 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5231,25 +5231,25 @@ discard block |
||
| 5231 | 5231 | * @return Array the aircraft manufacturer list |
| 5232 | 5232 | * |
| 5233 | 5233 | */ |
| 5234 | - public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5234 | + public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5235 | 5235 | { |
| 5236 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5237 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5238 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5236 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5237 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5238 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5239 | 5239 | |
| 5240 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5240 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5241 | 5241 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5242 | 5242 | GROUP BY spotter_output.aircraft_manufacturer |
| 5243 | 5243 | ORDER BY aircraft_manufacturer_count DESC"; |
| 5244 | 5244 | |
| 5245 | 5245 | |
| 5246 | 5246 | $sth = $this->db->prepare($query); |
| 5247 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5247 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5248 | 5248 | |
| 5249 | 5249 | $aircraft_array = array(); |
| 5250 | 5250 | $temp_array = array(); |
| 5251 | 5251 | |
| 5252 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5252 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5253 | 5253 | { |
| 5254 | 5254 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5255 | 5255 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5269,11 +5269,11 @@ discard block |
||
| 5269 | 5269 | * @return Array the aircraft list |
| 5270 | 5270 | * |
| 5271 | 5271 | */ |
| 5272 | - public function countAllAircraftTypesByCountry($country,$filters = array()) |
|
| 5272 | + public function countAllAircraftTypesByCountry($country, $filters = array()) |
|
| 5273 | 5273 | { |
| 5274 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5275 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5276 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5274 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5275 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5276 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5277 | 5277 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 5278 | 5278 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5279 | 5279 | ORDER BY aircraft_icao_count DESC"; |
@@ -5285,7 +5285,7 @@ discard block |
||
| 5285 | 5285 | $aircraft_array = array(); |
| 5286 | 5286 | $temp_array = array(); |
| 5287 | 5287 | |
| 5288 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5288 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5289 | 5289 | { |
| 5290 | 5290 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5291 | 5291 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5304,12 +5304,12 @@ discard block |
||
| 5304 | 5304 | * @return Array the aircraft list |
| 5305 | 5305 | * |
| 5306 | 5306 | */ |
| 5307 | - public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
|
| 5307 | + public function countAllAircraftRegistrationByCountry($country, $filters = array()) |
|
| 5308 | 5308 | { |
| 5309 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5309 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5310 | 5310 | $Image = new Image($this->db); |
| 5311 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5312 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5311 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5312 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5313 | 5313 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
| 5314 | 5314 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5315 | 5315 | ORDER BY registration_count DESC"; |
@@ -5321,14 +5321,14 @@ discard block |
||
| 5321 | 5321 | $aircraft_array = array(); |
| 5322 | 5322 | $temp_array = array(); |
| 5323 | 5323 | |
| 5324 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5324 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5325 | 5325 | { |
| 5326 | 5326 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5327 | 5327 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5328 | 5328 | $temp_array['registration'] = $row['registration']; |
| 5329 | 5329 | $temp_array['airline_name'] = $row['airline_name']; |
| 5330 | 5330 | $temp_array['image_thumbnail'] = ""; |
| 5331 | - if($row['registration'] != "") |
|
| 5331 | + if ($row['registration'] != "") |
|
| 5332 | 5332 | { |
| 5333 | 5333 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5334 | 5334 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5348,11 +5348,11 @@ discard block |
||
| 5348 | 5348 | * @return Array the aircraft manufacturer list |
| 5349 | 5349 | * |
| 5350 | 5350 | */ |
| 5351 | - public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
|
| 5351 | + public function countAllAircraftManufacturerByCountry($country, $filters = array()) |
|
| 5352 | 5352 | { |
| 5353 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5354 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5355 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5353 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5354 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5355 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5356 | 5356 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
| 5357 | 5357 | GROUP BY spotter_output.aircraft_manufacturer |
| 5358 | 5358 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5364,7 +5364,7 @@ discard block |
||
| 5364 | 5364 | $aircraft_array = array(); |
| 5365 | 5365 | $temp_array = array(); |
| 5366 | 5366 | |
| 5367 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5367 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5368 | 5368 | { |
| 5369 | 5369 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5370 | 5370 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5385,8 +5385,8 @@ discard block |
||
| 5385 | 5385 | */ |
| 5386 | 5386 | public function countAllAircraftManufacturers($filters = array()) |
| 5387 | 5387 | { |
| 5388 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5389 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5388 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5389 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5390 | 5390 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 5391 | 5391 | $query .= " GROUP BY spotter_output.aircraft_manufacturer |
| 5392 | 5392 | ORDER BY aircraft_manufacturer_count DESC |
@@ -5399,7 +5399,7 @@ discard block |
||
| 5399 | 5399 | $manufacturer_array = array(); |
| 5400 | 5400 | $temp_array = array(); |
| 5401 | 5401 | |
| 5402 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5402 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5403 | 5403 | { |
| 5404 | 5404 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5405 | 5405 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5418,12 +5418,12 @@ discard block |
||
| 5418 | 5418 | * @return Array the aircraft list |
| 5419 | 5419 | * |
| 5420 | 5420 | */ |
| 5421 | - public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 5421 | + public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5422 | 5422 | { |
| 5423 | 5423 | global $globalDBdriver; |
| 5424 | 5424 | $Image = new Image($this->db); |
| 5425 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5426 | - $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5425 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5426 | + $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5427 | 5427 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 5428 | 5428 | if ($olderthanmonths > 0) { |
| 5429 | 5429 | if ($globalDBdriver == 'mysql') { |
@@ -5451,7 +5451,7 @@ discard block |
||
| 5451 | 5451 | $aircraft_array = array(); |
| 5452 | 5452 | $temp_array = array(); |
| 5453 | 5453 | |
| 5454 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5454 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5455 | 5455 | { |
| 5456 | 5456 | $temp_array['registration'] = $row['registration']; |
| 5457 | 5457 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5459,7 +5459,7 @@ discard block |
||
| 5459 | 5459 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5460 | 5460 | $temp_array['airline_name'] = $row['airline_name']; |
| 5461 | 5461 | $temp_array['image_thumbnail'] = ""; |
| 5462 | - if($row['registration'] != "") |
|
| 5462 | + if ($row['registration'] != "") |
|
| 5463 | 5463 | { |
| 5464 | 5464 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5465 | 5465 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5478,12 +5478,12 @@ discard block |
||
| 5478 | 5478 | * @return Array the aircraft list |
| 5479 | 5479 | * |
| 5480 | 5480 | */ |
| 5481 | - public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 5481 | + public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5482 | 5482 | { |
| 5483 | 5483 | global $globalDBdriver; |
| 5484 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5484 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5485 | 5485 | $Image = new Image($this->db); |
| 5486 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5486 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5487 | 5487 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 5488 | 5488 | if ($olderthanmonths > 0) { |
| 5489 | 5489 | if ($globalDBdriver == 'mysql') { |
@@ -5511,7 +5511,7 @@ discard block |
||
| 5511 | 5511 | $aircraft_array = array(); |
| 5512 | 5512 | $temp_array = array(); |
| 5513 | 5513 | |
| 5514 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5514 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5515 | 5515 | { |
| 5516 | 5516 | $temp_array['registration'] = $row['registration']; |
| 5517 | 5517 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5520,7 +5520,7 @@ discard block |
||
| 5520 | 5520 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5521 | 5521 | $temp_array['airline_name'] = $row['airline_name']; |
| 5522 | 5522 | $temp_array['image_thumbnail'] = ""; |
| 5523 | - if($row['registration'] != "") |
|
| 5523 | + if ($row['registration'] != "") |
|
| 5524 | 5524 | { |
| 5525 | 5525 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5526 | 5526 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5539,11 +5539,11 @@ discard block |
||
| 5539 | 5539 | * @return Array the airport list |
| 5540 | 5540 | * |
| 5541 | 5541 | */ |
| 5542 | - public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5542 | + public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5543 | 5543 | { |
| 5544 | 5544 | global $globalDBdriver; |
| 5545 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5546 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5545 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5546 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5547 | 5547 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
| 5548 | 5548 | if ($olderthanmonths > 0) { |
| 5549 | 5549 | if ($globalDBdriver == 'mysql') { |
@@ -5572,7 +5572,7 @@ discard block |
||
| 5572 | 5572 | $airport_array = array(); |
| 5573 | 5573 | $temp_array = array(); |
| 5574 | 5574 | |
| 5575 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5575 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5576 | 5576 | { |
| 5577 | 5577 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5578 | 5578 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5591,11 +5591,11 @@ discard block |
||
| 5591 | 5591 | * @return Array the airport list |
| 5592 | 5592 | * |
| 5593 | 5593 | */ |
| 5594 | - public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5594 | + public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5595 | 5595 | { |
| 5596 | 5596 | global $globalDBdriver; |
| 5597 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5598 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5597 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5598 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5599 | 5599 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' "; |
| 5600 | 5600 | if ($olderthanmonths > 0) { |
| 5601 | 5601 | if ($globalDBdriver == 'mysql') { |
@@ -5624,7 +5624,7 @@ discard block |
||
| 5624 | 5624 | $airport_array = array(); |
| 5625 | 5625 | $temp_array = array(); |
| 5626 | 5626 | |
| 5627 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5627 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5628 | 5628 | { |
| 5629 | 5629 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 5630 | 5630 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5644,11 +5644,11 @@ discard block |
||
| 5644 | 5644 | * @return Array the airport list |
| 5645 | 5645 | * |
| 5646 | 5646 | */ |
| 5647 | - public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5647 | + public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5648 | 5648 | { |
| 5649 | 5649 | global $globalDBdriver; |
| 5650 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5651 | - $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 5650 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5651 | + $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 5652 | 5652 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
| 5653 | 5653 | if ($olderthanmonths > 0) { |
| 5654 | 5654 | if ($globalDBdriver == 'mysql') { |
@@ -5676,7 +5676,7 @@ discard block |
||
| 5676 | 5676 | $airport_array = array(); |
| 5677 | 5677 | $temp_array = array(); |
| 5678 | 5678 | |
| 5679 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5679 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5680 | 5680 | { |
| 5681 | 5681 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5682 | 5682 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5695,11 +5695,11 @@ discard block |
||
| 5695 | 5695 | * @return Array the airport list |
| 5696 | 5696 | * |
| 5697 | 5697 | */ |
| 5698 | - public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5698 | + public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5699 | 5699 | { |
| 5700 | 5700 | global $globalDBdriver; |
| 5701 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5702 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 5701 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5702 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 5703 | 5703 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
| 5704 | 5704 | if ($olderthanmonths > 0) { |
| 5705 | 5705 | if ($globalDBdriver == 'mysql') { |
@@ -5728,7 +5728,7 @@ discard block |
||
| 5728 | 5728 | $airport_array = array(); |
| 5729 | 5729 | $temp_array = array(); |
| 5730 | 5730 | |
| 5731 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5731 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5732 | 5732 | { |
| 5733 | 5733 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 5734 | 5734 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5748,11 +5748,11 @@ discard block |
||
| 5748 | 5748 | * @return Array the airport list |
| 5749 | 5749 | * |
| 5750 | 5750 | */ |
| 5751 | - public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
|
| 5751 | + public function countAllDepartureAirportsByAirline($airline_icao, $filters = array()) |
|
| 5752 | 5752 | { |
| 5753 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5754 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5755 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5753 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5754 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5755 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5756 | 5756 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao |
| 5757 | 5757 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5758 | 5758 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5764,7 +5764,7 @@ discard block |
||
| 5764 | 5764 | $airport_array = array(); |
| 5765 | 5765 | $temp_array = array(); |
| 5766 | 5766 | |
| 5767 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5767 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5768 | 5768 | { |
| 5769 | 5769 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5770 | 5770 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5786,11 +5786,11 @@ discard block |
||
| 5786 | 5786 | * @return Array the airport list |
| 5787 | 5787 | * |
| 5788 | 5788 | */ |
| 5789 | - public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 5789 | + public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 5790 | 5790 | { |
| 5791 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5792 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5793 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5791 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5792 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5793 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5794 | 5794 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 5795 | 5795 | GROUP BY spotter_output.departure_airport_country |
| 5796 | 5796 | ORDER BY airport_departure_country_count DESC"; |
@@ -5802,7 +5802,7 @@ discard block |
||
| 5802 | 5802 | $airport_array = array(); |
| 5803 | 5803 | $temp_array = array(); |
| 5804 | 5804 | |
| 5805 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5805 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5806 | 5806 | { |
| 5807 | 5807 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5808 | 5808 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5821,11 +5821,11 @@ discard block |
||
| 5821 | 5821 | * @return Array the airport list |
| 5822 | 5822 | * |
| 5823 | 5823 | */ |
| 5824 | - public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 5824 | + public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 5825 | 5825 | { |
| 5826 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5827 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 5828 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5826 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5827 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 5828 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5829 | 5829 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao |
| 5830 | 5830 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5831 | 5831 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5837,7 +5837,7 @@ discard block |
||
| 5837 | 5837 | $airport_array = array(); |
| 5838 | 5838 | $temp_array = array(); |
| 5839 | 5839 | |
| 5840 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5840 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5841 | 5841 | { |
| 5842 | 5842 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5843 | 5843 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5858,11 +5858,11 @@ discard block |
||
| 5858 | 5858 | * @return Array the airport list |
| 5859 | 5859 | * |
| 5860 | 5860 | */ |
| 5861 | - public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 5861 | + public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 5862 | 5862 | { |
| 5863 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5864 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 5865 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5863 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5864 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 5865 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5866 | 5866 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 5867 | 5867 | GROUP BY spotter_output.departure_airport_country |
| 5868 | 5868 | ORDER BY airport_departure_country_count DESC"; |
@@ -5874,7 +5874,7 @@ discard block |
||
| 5874 | 5874 | $airport_array = array(); |
| 5875 | 5875 | $temp_array = array(); |
| 5876 | 5876 | |
| 5877 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5877 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5878 | 5878 | { |
| 5879 | 5879 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5880 | 5880 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5892,11 +5892,11 @@ discard block |
||
| 5892 | 5892 | * @return Array the airport list |
| 5893 | 5893 | * |
| 5894 | 5894 | */ |
| 5895 | - public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
|
| 5895 | + public function countAllDepartureAirportsByRegistration($registration, $filters = array()) |
|
| 5896 | 5896 | { |
| 5897 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5898 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 5899 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5897 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5898 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 5899 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5900 | 5900 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration |
| 5901 | 5901 | GROUP BY spotter_output.departure_airport_icao |
| 5902 | 5902 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5908,7 +5908,7 @@ discard block |
||
| 5908 | 5908 | $airport_array = array(); |
| 5909 | 5909 | $temp_array = array(); |
| 5910 | 5910 | |
| 5911 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5911 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5912 | 5912 | { |
| 5913 | 5913 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5914 | 5914 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5929,11 +5929,11 @@ discard block |
||
| 5929 | 5929 | * @return Array the airport list |
| 5930 | 5930 | * |
| 5931 | 5931 | */ |
| 5932 | - public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
|
| 5932 | + public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array()) |
|
| 5933 | 5933 | { |
| 5934 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5935 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 5936 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5934 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5935 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 5936 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5937 | 5937 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration |
| 5938 | 5938 | GROUP BY spotter_output.departure_airport_country |
| 5939 | 5939 | ORDER BY airport_departure_country_count DESC"; |
@@ -5945,7 +5945,7 @@ discard block |
||
| 5945 | 5945 | $airport_array = array(); |
| 5946 | 5946 | $temp_array = array(); |
| 5947 | 5947 | |
| 5948 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5948 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5949 | 5949 | { |
| 5950 | 5950 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5951 | 5951 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5963,11 +5963,11 @@ discard block |
||
| 5963 | 5963 | * @return Array the airport list |
| 5964 | 5964 | * |
| 5965 | 5965 | */ |
| 5966 | - public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
|
| 5966 | + public function countAllDepartureAirportsByAirport($airport_icao, $filters = array()) |
|
| 5967 | 5967 | { |
| 5968 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5969 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 5970 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5968 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5969 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 5970 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5971 | 5971 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao |
| 5972 | 5972 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5973 | 5973 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5979,7 +5979,7 @@ discard block |
||
| 5979 | 5979 | $airport_array = array(); |
| 5980 | 5980 | $temp_array = array(); |
| 5981 | 5981 | |
| 5982 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5982 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5983 | 5983 | { |
| 5984 | 5984 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5985 | 5985 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6000,11 +6000,11 @@ discard block |
||
| 6000 | 6000 | * @return Array the airport list |
| 6001 | 6001 | * |
| 6002 | 6002 | */ |
| 6003 | - public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 6003 | + public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 6004 | 6004 | { |
| 6005 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6006 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6007 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6005 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6006 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6007 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6008 | 6008 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao |
| 6009 | 6009 | GROUP BY spotter_output.departure_airport_country |
| 6010 | 6010 | ORDER BY airport_departure_country_count DESC"; |
@@ -6016,7 +6016,7 @@ discard block |
||
| 6016 | 6016 | $airport_array = array(); |
| 6017 | 6017 | $temp_array = array(); |
| 6018 | 6018 | |
| 6019 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6019 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6020 | 6020 | { |
| 6021 | 6021 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6022 | 6022 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6035,11 +6035,11 @@ discard block |
||
| 6035 | 6035 | * @return Array the airport list |
| 6036 | 6036 | * |
| 6037 | 6037 | */ |
| 6038 | - public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6038 | + public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6039 | 6039 | { |
| 6040 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6041 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6042 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6040 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6041 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6042 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6043 | 6043 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6044 | 6044 | GROUP BY spotter_output.departure_airport_icao |
| 6045 | 6045 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6051,7 +6051,7 @@ discard block |
||
| 6051 | 6051 | $airport_array = array(); |
| 6052 | 6052 | $temp_array = array(); |
| 6053 | 6053 | |
| 6054 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6054 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6055 | 6055 | { |
| 6056 | 6056 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6057 | 6057 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6072,11 +6072,11 @@ discard block |
||
| 6072 | 6072 | * @return Array the airport list |
| 6073 | 6073 | * |
| 6074 | 6074 | */ |
| 6075 | - public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6075 | + public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6076 | 6076 | { |
| 6077 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6078 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6079 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6077 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6078 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6079 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6080 | 6080 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6081 | 6081 | GROUP BY spotter_output.departure_airport_country |
| 6082 | 6082 | ORDER BY airport_departure_country_count DESC"; |
@@ -6088,7 +6088,7 @@ discard block |
||
| 6088 | 6088 | $airport_array = array(); |
| 6089 | 6089 | $temp_array = array(); |
| 6090 | 6090 | |
| 6091 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6091 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6092 | 6092 | { |
| 6093 | 6093 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6094 | 6094 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6106,11 +6106,11 @@ discard block |
||
| 6106 | 6106 | * @return Array the airport list |
| 6107 | 6107 | * |
| 6108 | 6108 | */ |
| 6109 | - public function countAllDepartureAirportsByDate($date,$filters = array()) |
|
| 6109 | + public function countAllDepartureAirportsByDate($date, $filters = array()) |
|
| 6110 | 6110 | { |
| 6111 | 6111 | global $globalTimezone, $globalDBdriver; |
| 6112 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6113 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6112 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6113 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6114 | 6114 | if ($globalTimezone != '') { |
| 6115 | 6115 | date_default_timezone_set($globalTimezone); |
| 6116 | 6116 | $datetime = new DateTime($date); |
@@ -6118,12 +6118,12 @@ discard block |
||
| 6118 | 6118 | } else $offset = '+00:00'; |
| 6119 | 6119 | |
| 6120 | 6120 | if ($globalDBdriver == 'mysql') { |
| 6121 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6121 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6122 | 6122 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6123 | 6123 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6124 | 6124 | ORDER BY airport_departure_icao_count DESC"; |
| 6125 | 6125 | } else { |
| 6126 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6126 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6127 | 6127 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6128 | 6128 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6129 | 6129 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6135,7 +6135,7 @@ discard block |
||
| 6135 | 6135 | $airport_array = array(); |
| 6136 | 6136 | $temp_array = array(); |
| 6137 | 6137 | |
| 6138 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6138 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6139 | 6139 | { |
| 6140 | 6140 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6141 | 6141 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6156,11 +6156,11 @@ discard block |
||
| 6156 | 6156 | * @return Array the airport list |
| 6157 | 6157 | * |
| 6158 | 6158 | */ |
| 6159 | - public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
|
| 6159 | + public function countAllDepartureAirportCountriesByDate($date, $filters = array()) |
|
| 6160 | 6160 | { |
| 6161 | 6161 | global $globalTimezone, $globalDBdriver; |
| 6162 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6163 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6162 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6163 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6164 | 6164 | if ($globalTimezone != '') { |
| 6165 | 6165 | date_default_timezone_set($globalTimezone); |
| 6166 | 6166 | $datetime = new DateTime($date); |
@@ -6168,12 +6168,12 @@ discard block |
||
| 6168 | 6168 | } else $offset = '+00:00'; |
| 6169 | 6169 | |
| 6170 | 6170 | if ($globalDBdriver == 'mysql') { |
| 6171 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6171 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6172 | 6172 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6173 | 6173 | GROUP BY spotter_output.departure_airport_country |
| 6174 | 6174 | ORDER BY airport_departure_country_count DESC"; |
| 6175 | 6175 | } else { |
| 6176 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6176 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6177 | 6177 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6178 | 6178 | GROUP BY spotter_output.departure_airport_country |
| 6179 | 6179 | ORDER BY airport_departure_country_count DESC"; |
@@ -6185,7 +6185,7 @@ discard block |
||
| 6185 | 6185 | $airport_array = array(); |
| 6186 | 6186 | $temp_array = array(); |
| 6187 | 6187 | |
| 6188 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6188 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6189 | 6189 | { |
| 6190 | 6190 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6191 | 6191 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6203,11 +6203,11 @@ discard block |
||
| 6203 | 6203 | * @return Array the airport list |
| 6204 | 6204 | * |
| 6205 | 6205 | */ |
| 6206 | - public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
|
| 6206 | + public function countAllDepartureAirportsByIdent($ident, $filters = array()) |
|
| 6207 | 6207 | { |
| 6208 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6209 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 6210 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6208 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6209 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 6210 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6211 | 6211 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident |
| 6212 | 6212 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6213 | 6213 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6219,7 +6219,7 @@ discard block |
||
| 6219 | 6219 | $airport_array = array(); |
| 6220 | 6220 | $temp_array = array(); |
| 6221 | 6221 | |
| 6222 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6222 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6223 | 6223 | { |
| 6224 | 6224 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6225 | 6225 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6241,11 +6241,11 @@ discard block |
||
| 6241 | 6241 | * @return Array the airport list |
| 6242 | 6242 | * |
| 6243 | 6243 | */ |
| 6244 | - public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
|
| 6244 | + public function countAllDepartureAirportCountriesByIdent($ident, $filters = array()) |
|
| 6245 | 6245 | { |
| 6246 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6247 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 6248 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6246 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6247 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 6248 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6249 | 6249 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident |
| 6250 | 6250 | GROUP BY spotter_output.departure_airport_country |
| 6251 | 6251 | ORDER BY airport_departure_country_count DESC"; |
@@ -6257,7 +6257,7 @@ discard block |
||
| 6257 | 6257 | $airport_array = array(); |
| 6258 | 6258 | $temp_array = array(); |
| 6259 | 6259 | |
| 6260 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6260 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6261 | 6261 | { |
| 6262 | 6262 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6263 | 6263 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6276,12 +6276,12 @@ discard block |
||
| 6276 | 6276 | * @return Array the airport list |
| 6277 | 6277 | * |
| 6278 | 6278 | */ |
| 6279 | - public function countAllDepartureAirportsByCountry($country,$filters = array()) |
|
| 6279 | + public function countAllDepartureAirportsByCountry($country, $filters = array()) |
|
| 6280 | 6280 | { |
| 6281 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6282 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6281 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6282 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6283 | 6283 | |
| 6284 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6284 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6285 | 6285 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 6286 | 6286 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6287 | 6287 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6293,7 +6293,7 @@ discard block |
||
| 6293 | 6293 | $airport_array = array(); |
| 6294 | 6294 | $temp_array = array(); |
| 6295 | 6295 | |
| 6296 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6296 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6297 | 6297 | { |
| 6298 | 6298 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6299 | 6299 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6314,11 +6314,11 @@ discard block |
||
| 6314 | 6314 | * @return Array the airport list |
| 6315 | 6315 | * |
| 6316 | 6316 | */ |
| 6317 | - public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
|
| 6317 | + public function countAllDepartureAirportCountriesByCountry($country, $filters = array()) |
|
| 6318 | 6318 | { |
| 6319 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6320 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6321 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6319 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6320 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6321 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6322 | 6322 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 6323 | 6323 | GROUP BY spotter_output.departure_airport_country |
| 6324 | 6324 | ORDER BY airport_departure_country_count DESC"; |
@@ -6330,7 +6330,7 @@ discard block |
||
| 6330 | 6330 | $airport_array = array(); |
| 6331 | 6331 | $temp_array = array(); |
| 6332 | 6332 | |
| 6333 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6333 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6334 | 6334 | { |
| 6335 | 6335 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6336 | 6336 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6348,11 +6348,11 @@ discard block |
||
| 6348 | 6348 | * @return Array the airport list |
| 6349 | 6349 | * |
| 6350 | 6350 | */ |
| 6351 | - public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
| 6351 | + public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6352 | 6352 | { |
| 6353 | 6353 | global $globalDBdriver; |
| 6354 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6355 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6354 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6355 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6356 | 6356 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
| 6357 | 6357 | if ($olderthanmonths > 0) { |
| 6358 | 6358 | if ($globalDBdriver == 'mysql') { |
@@ -6387,7 +6387,7 @@ discard block |
||
| 6387 | 6387 | $airport_array = array(); |
| 6388 | 6388 | $temp_array = array(); |
| 6389 | 6389 | |
| 6390 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6390 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6391 | 6391 | { |
| 6392 | 6392 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6393 | 6393 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6410,11 +6410,11 @@ discard block |
||
| 6410 | 6410 | * @return Array the airport list |
| 6411 | 6411 | * |
| 6412 | 6412 | */ |
| 6413 | - public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
| 6413 | + public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6414 | 6414 | { |
| 6415 | 6415 | global $globalDBdriver; |
| 6416 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6417 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6416 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6417 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6418 | 6418 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' "; |
| 6419 | 6419 | if ($olderthanmonths > 0) { |
| 6420 | 6420 | if ($globalDBdriver == 'mysql') { |
@@ -6449,7 +6449,7 @@ discard block |
||
| 6449 | 6449 | $airport_array = array(); |
| 6450 | 6450 | $temp_array = array(); |
| 6451 | 6451 | |
| 6452 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6452 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6453 | 6453 | { |
| 6454 | 6454 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 6455 | 6455 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
@@ -6474,11 +6474,11 @@ discard block |
||
| 6474 | 6474 | * @return Array the airport list |
| 6475 | 6475 | * |
| 6476 | 6476 | */ |
| 6477 | - public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
| 6477 | + public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6478 | 6478 | { |
| 6479 | 6479 | global $globalDBdriver; |
| 6480 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6481 | - $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6480 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6481 | + $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6482 | 6482 | FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
| 6483 | 6483 | if ($olderthanmonths > 0) { |
| 6484 | 6484 | if ($globalDBdriver == 'mysql') { |
@@ -6512,7 +6512,7 @@ discard block |
||
| 6512 | 6512 | $airport_array = array(); |
| 6513 | 6513 | $temp_array = array(); |
| 6514 | 6514 | |
| 6515 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6515 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6516 | 6516 | { |
| 6517 | 6517 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6518 | 6518 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6535,11 +6535,11 @@ discard block |
||
| 6535 | 6535 | * @return Array the airport list |
| 6536 | 6536 | * |
| 6537 | 6537 | */ |
| 6538 | - public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
| 6538 | + public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6539 | 6539 | { |
| 6540 | 6540 | global $globalDBdriver; |
| 6541 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6542 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6541 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6542 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6543 | 6543 | FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
| 6544 | 6544 | if ($olderthanmonths > 0) { |
| 6545 | 6545 | if ($globalDBdriver == 'mysql') { |
@@ -6574,7 +6574,7 @@ discard block |
||
| 6574 | 6574 | $airport_array = array(); |
| 6575 | 6575 | $temp_array = array(); |
| 6576 | 6576 | |
| 6577 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6577 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6578 | 6578 | { |
| 6579 | 6579 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6580 | 6580 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6600,9 +6600,9 @@ discard block |
||
| 6600 | 6600 | */ |
| 6601 | 6601 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 6602 | 6602 | { |
| 6603 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6604 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6605 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6603 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6604 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6605 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6606 | 6606 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao |
| 6607 | 6607 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6608 | 6608 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6613,7 +6613,7 @@ discard block |
||
| 6613 | 6613 | $airport_array = array(); |
| 6614 | 6614 | $temp_array = array(); |
| 6615 | 6615 | |
| 6616 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6616 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6617 | 6617 | { |
| 6618 | 6618 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6619 | 6619 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6634,12 +6634,12 @@ discard block |
||
| 6634 | 6634 | * @return Array the airport list |
| 6635 | 6635 | * |
| 6636 | 6636 | */ |
| 6637 | - public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 6637 | + public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 6638 | 6638 | { |
| 6639 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6640 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6639 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6640 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6641 | 6641 | |
| 6642 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6642 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6643 | 6643 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 6644 | 6644 | GROUP BY spotter_output.arrival_airport_country |
| 6645 | 6645 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6651,7 +6651,7 @@ discard block |
||
| 6651 | 6651 | $airport_array = array(); |
| 6652 | 6652 | $temp_array = array(); |
| 6653 | 6653 | |
| 6654 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6654 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6655 | 6655 | { |
| 6656 | 6656 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6657 | 6657 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6669,11 +6669,11 @@ discard block |
||
| 6669 | 6669 | * @return Array the airport list |
| 6670 | 6670 | * |
| 6671 | 6671 | */ |
| 6672 | - public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 6672 | + public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 6673 | 6673 | { |
| 6674 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6675 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6676 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6674 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6675 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6676 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6677 | 6677 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao |
| 6678 | 6678 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6679 | 6679 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6685,7 +6685,7 @@ discard block |
||
| 6685 | 6685 | $airport_array = array(); |
| 6686 | 6686 | $temp_array = array(); |
| 6687 | 6687 | |
| 6688 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6688 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6689 | 6689 | { |
| 6690 | 6690 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6691 | 6691 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6707,11 +6707,11 @@ discard block |
||
| 6707 | 6707 | * @return Array the airport list |
| 6708 | 6708 | * |
| 6709 | 6709 | */ |
| 6710 | - public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 6710 | + public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 6711 | 6711 | { |
| 6712 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6713 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6714 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6712 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6713 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6714 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6715 | 6715 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 6716 | 6716 | GROUP BY spotter_output.arrival_airport_country |
| 6717 | 6717 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6723,7 +6723,7 @@ discard block |
||
| 6723 | 6723 | $airport_array = array(); |
| 6724 | 6724 | $temp_array = array(); |
| 6725 | 6725 | |
| 6726 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6726 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6727 | 6727 | { |
| 6728 | 6728 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6729 | 6729 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6741,12 +6741,12 @@ discard block |
||
| 6741 | 6741 | * @return Array the airport list |
| 6742 | 6742 | * |
| 6743 | 6743 | */ |
| 6744 | - public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
|
| 6744 | + public function countAllArrivalAirportsByRegistration($registration, $filters = array()) |
|
| 6745 | 6745 | { |
| 6746 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6747 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6746 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6747 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6748 | 6748 | |
| 6749 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6749 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6750 | 6750 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration |
| 6751 | 6751 | GROUP BY spotter_output.arrival_airport_icao |
| 6752 | 6752 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6758,7 +6758,7 @@ discard block |
||
| 6758 | 6758 | $airport_array = array(); |
| 6759 | 6759 | $temp_array = array(); |
| 6760 | 6760 | |
| 6761 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6761 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6762 | 6762 | { |
| 6763 | 6763 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6764 | 6764 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6779,11 +6779,11 @@ discard block |
||
| 6779 | 6779 | * @return Array the airport list |
| 6780 | 6780 | * |
| 6781 | 6781 | */ |
| 6782 | - public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
|
| 6782 | + public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array()) |
|
| 6783 | 6783 | { |
| 6784 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6785 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6786 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6784 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6785 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6786 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6787 | 6787 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration |
| 6788 | 6788 | GROUP BY spotter_output.arrival_airport_country |
| 6789 | 6789 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6795,7 +6795,7 @@ discard block |
||
| 6795 | 6795 | $airport_array = array(); |
| 6796 | 6796 | $temp_array = array(); |
| 6797 | 6797 | |
| 6798 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6798 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6799 | 6799 | { |
| 6800 | 6800 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6801 | 6801 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6814,11 +6814,11 @@ discard block |
||
| 6814 | 6814 | * @return Array the airport list |
| 6815 | 6815 | * |
| 6816 | 6816 | */ |
| 6817 | - public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
|
| 6817 | + public function countAllArrivalAirportsByAirport($airport_icao, $filters = array()) |
|
| 6818 | 6818 | { |
| 6819 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6820 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6821 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6819 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6820 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6821 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6822 | 6822 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao |
| 6823 | 6823 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6824 | 6824 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6830,7 +6830,7 @@ discard block |
||
| 6830 | 6830 | $airport_array = array(); |
| 6831 | 6831 | $temp_array = array(); |
| 6832 | 6832 | |
| 6833 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6833 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6834 | 6834 | { |
| 6835 | 6835 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6836 | 6836 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6851,11 +6851,11 @@ discard block |
||
| 6851 | 6851 | * @return Array the airport list |
| 6852 | 6852 | * |
| 6853 | 6853 | */ |
| 6854 | - public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 6854 | + public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 6855 | 6855 | { |
| 6856 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6857 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6858 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6856 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6857 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6858 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6859 | 6859 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao |
| 6860 | 6860 | GROUP BY spotter_output.arrival_airport_country |
| 6861 | 6861 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6867,7 +6867,7 @@ discard block |
||
| 6867 | 6867 | $airport_array = array(); |
| 6868 | 6868 | $temp_array = array(); |
| 6869 | 6869 | |
| 6870 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6870 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6871 | 6871 | { |
| 6872 | 6872 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6873 | 6873 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6885,11 +6885,11 @@ discard block |
||
| 6885 | 6885 | * @return Array the airport list |
| 6886 | 6886 | * |
| 6887 | 6887 | */ |
| 6888 | - public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6888 | + public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6889 | 6889 | { |
| 6890 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6891 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6892 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6890 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6891 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6892 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6893 | 6893 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6894 | 6894 | GROUP BY spotter_output.arrival_airport_icao |
| 6895 | 6895 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6901,7 +6901,7 @@ discard block |
||
| 6901 | 6901 | $airport_array = array(); |
| 6902 | 6902 | $temp_array = array(); |
| 6903 | 6903 | |
| 6904 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6904 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6905 | 6905 | { |
| 6906 | 6906 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6907 | 6907 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6923,11 +6923,11 @@ discard block |
||
| 6923 | 6923 | * @return Array the airport list |
| 6924 | 6924 | * |
| 6925 | 6925 | */ |
| 6926 | - public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6926 | + public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6927 | 6927 | { |
| 6928 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6929 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6930 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6928 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6929 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6930 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6931 | 6931 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6932 | 6932 | GROUP BY spotter_output.arrival_airport_country |
| 6933 | 6933 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6939,7 +6939,7 @@ discard block |
||
| 6939 | 6939 | $airport_array = array(); |
| 6940 | 6940 | $temp_array = array(); |
| 6941 | 6941 | |
| 6942 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6942 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6943 | 6943 | { |
| 6944 | 6944 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6945 | 6945 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6958,11 +6958,11 @@ discard block |
||
| 6958 | 6958 | * @return Array the airport list |
| 6959 | 6959 | * |
| 6960 | 6960 | */ |
| 6961 | - public function countAllArrivalAirportsByDate($date,$filters = array()) |
|
| 6961 | + public function countAllArrivalAirportsByDate($date, $filters = array()) |
|
| 6962 | 6962 | { |
| 6963 | 6963 | global $globalTimezone, $globalDBdriver; |
| 6964 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6965 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6964 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6965 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6966 | 6966 | if ($globalTimezone != '') { |
| 6967 | 6967 | date_default_timezone_set($globalTimezone); |
| 6968 | 6968 | $datetime = new DateTime($date); |
@@ -6970,12 +6970,12 @@ discard block |
||
| 6970 | 6970 | } else $offset = '+00:00'; |
| 6971 | 6971 | |
| 6972 | 6972 | if ($globalDBdriver == 'mysql') { |
| 6973 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6973 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6974 | 6974 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6975 | 6975 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6976 | 6976 | ORDER BY airport_arrival_icao_count DESC"; |
| 6977 | 6977 | } else { |
| 6978 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6978 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6979 | 6979 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6980 | 6980 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6981 | 6981 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6987,7 +6987,7 @@ discard block |
||
| 6987 | 6987 | $airport_array = array(); |
| 6988 | 6988 | $temp_array = array(); |
| 6989 | 6989 | |
| 6990 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6990 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6991 | 6991 | { |
| 6992 | 6992 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6993 | 6993 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7011,8 +7011,8 @@ discard block |
||
| 7011 | 7011 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 7012 | 7012 | { |
| 7013 | 7013 | global $globalTimezone, $globalDBdriver; |
| 7014 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7015 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7014 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7015 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7016 | 7016 | if ($globalTimezone != '') { |
| 7017 | 7017 | date_default_timezone_set($globalTimezone); |
| 7018 | 7018 | $datetime = new DateTime($date); |
@@ -7020,12 +7020,12 @@ discard block |
||
| 7020 | 7020 | } else $offset = '+00:00'; |
| 7021 | 7021 | |
| 7022 | 7022 | if ($globalDBdriver == 'mysql') { |
| 7023 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7023 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7024 | 7024 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7025 | 7025 | GROUP BY spotter_output.arrival_airport_country |
| 7026 | 7026 | ORDER BY airport_arrival_country_count DESC"; |
| 7027 | 7027 | } else { |
| 7028 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7028 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7029 | 7029 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7030 | 7030 | GROUP BY spotter_output.arrival_airport_country |
| 7031 | 7031 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7037,7 +7037,7 @@ discard block |
||
| 7037 | 7037 | $airport_array = array(); |
| 7038 | 7038 | $temp_array = array(); |
| 7039 | 7039 | |
| 7040 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7040 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7041 | 7041 | { |
| 7042 | 7042 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7043 | 7043 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7055,11 +7055,11 @@ discard block |
||
| 7055 | 7055 | * @return Array the airport list |
| 7056 | 7056 | * |
| 7057 | 7057 | */ |
| 7058 | - public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
|
| 7058 | + public function countAllArrivalAirportsByIdent($ident, $filters = array()) |
|
| 7059 | 7059 | { |
| 7060 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7061 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7062 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7060 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7061 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7062 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7063 | 7063 | FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident |
| 7064 | 7064 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7065 | 7065 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7071,7 +7071,7 @@ discard block |
||
| 7071 | 7071 | $airport_array = array(); |
| 7072 | 7072 | $temp_array = array(); |
| 7073 | 7073 | |
| 7074 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7074 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7075 | 7075 | { |
| 7076 | 7076 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7077 | 7077 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7094,9 +7094,9 @@ discard block |
||
| 7094 | 7094 | */ |
| 7095 | 7095 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 7096 | 7096 | { |
| 7097 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7098 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7099 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7097 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7098 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7099 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7100 | 7100 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident |
| 7101 | 7101 | GROUP BY spotter_output.arrival_airport_country |
| 7102 | 7102 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7108,7 +7108,7 @@ discard block |
||
| 7108 | 7108 | $airport_array = array(); |
| 7109 | 7109 | $temp_array = array(); |
| 7110 | 7110 | |
| 7111 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7111 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7112 | 7112 | { |
| 7113 | 7113 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7114 | 7114 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7127,11 +7127,11 @@ discard block |
||
| 7127 | 7127 | * @return Array the airport list |
| 7128 | 7128 | * |
| 7129 | 7129 | */ |
| 7130 | - public function countAllArrivalAirportsByCountry($country,$filters = array()) |
|
| 7130 | + public function countAllArrivalAirportsByCountry($country, $filters = array()) |
|
| 7131 | 7131 | { |
| 7132 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7133 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7134 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7132 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7133 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7134 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7135 | 7135 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7136 | 7136 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7137 | 7137 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7143,7 +7143,7 @@ discard block |
||
| 7143 | 7143 | $airport_array = array(); |
| 7144 | 7144 | $temp_array = array(); |
| 7145 | 7145 | |
| 7146 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7146 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7147 | 7147 | { |
| 7148 | 7148 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7149 | 7149 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7164,11 +7164,11 @@ discard block |
||
| 7164 | 7164 | * @return Array the airport list |
| 7165 | 7165 | * |
| 7166 | 7166 | */ |
| 7167 | - public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
|
| 7167 | + public function countAllArrivalAirportCountriesByCountry($country, $filters = array()) |
|
| 7168 | 7168 | { |
| 7169 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7170 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7171 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7169 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7170 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7171 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7172 | 7172 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7173 | 7173 | GROUP BY spotter_output.arrival_airport_country |
| 7174 | 7174 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7180,7 +7180,7 @@ discard block |
||
| 7180 | 7180 | $airport_array = array(); |
| 7181 | 7181 | $temp_array = array(); |
| 7182 | 7182 | |
| 7183 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7183 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7184 | 7184 | { |
| 7185 | 7185 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7186 | 7186 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7201,7 +7201,7 @@ discard block |
||
| 7201 | 7201 | */ |
| 7202 | 7202 | public function countAllDepartureCountries($filters = array()) |
| 7203 | 7203 | { |
| 7204 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7204 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7205 | 7205 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
| 7206 | 7206 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
| 7207 | 7207 | $query .= " GROUP BY spotter_output.departure_airport_country |
@@ -7215,7 +7215,7 @@ discard block |
||
| 7215 | 7215 | $airport_array = array(); |
| 7216 | 7216 | $temp_array = array(); |
| 7217 | 7217 | |
| 7218 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7218 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7219 | 7219 | { |
| 7220 | 7220 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
| 7221 | 7221 | $temp_array['airport_departure_country'] = $row['departure_airport_country']; |
@@ -7233,9 +7233,9 @@ discard block |
||
| 7233 | 7233 | * @return Array the airport arrival list |
| 7234 | 7234 | * |
| 7235 | 7235 | */ |
| 7236 | - public function countAllArrivalCountries($limit = true,$filters = array()) |
|
| 7236 | + public function countAllArrivalCountries($limit = true, $filters = array()) |
|
| 7237 | 7237 | { |
| 7238 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7238 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7239 | 7239 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
| 7240 | 7240 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
| 7241 | 7241 | $query .= " GROUP BY spotter_output.arrival_airport_country |
@@ -7249,7 +7249,7 @@ discard block |
||
| 7249 | 7249 | $airport_array = array(); |
| 7250 | 7250 | $temp_array = array(); |
| 7251 | 7251 | |
| 7252 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7252 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7253 | 7253 | { |
| 7254 | 7254 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
| 7255 | 7255 | $temp_array['airport_arrival_country'] = $row['arrival_airport_country']; |
@@ -7272,8 +7272,8 @@ discard block |
||
| 7272 | 7272 | */ |
| 7273 | 7273 | public function countAllRoutes($filters = array()) |
| 7274 | 7274 | { |
| 7275 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7276 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7275 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7276 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7277 | 7277 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA' |
| 7278 | 7278 | GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7279 | 7279 | ORDER BY route_count DESC |
@@ -7286,7 +7286,7 @@ discard block |
||
| 7286 | 7286 | $routes_array = array(); |
| 7287 | 7287 | $temp_array = array(); |
| 7288 | 7288 | |
| 7289 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7289 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7290 | 7290 | { |
| 7291 | 7291 | $temp_array['route_count'] = $row['route_count']; |
| 7292 | 7292 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7313,11 +7313,11 @@ discard block |
||
| 7313 | 7313 | * @return Array the route list |
| 7314 | 7314 | * |
| 7315 | 7315 | */ |
| 7316 | - public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
|
| 7316 | + public function countAllRoutesByAircraft($aircraft_icao, $filters = array()) |
|
| 7317 | 7317 | { |
| 7318 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7319 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 7320 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7318 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7319 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 7320 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7321 | 7321 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 7322 | 7322 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7323 | 7323 | ORDER BY route_count DESC"; |
@@ -7328,7 +7328,7 @@ discard block |
||
| 7328 | 7328 | $routes_array = array(); |
| 7329 | 7329 | $temp_array = array(); |
| 7330 | 7330 | |
| 7331 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7331 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7332 | 7332 | { |
| 7333 | 7333 | $temp_array['route_count'] = $row['route_count']; |
| 7334 | 7334 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7355,9 +7355,9 @@ discard block |
||
| 7355 | 7355 | */ |
| 7356 | 7356 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 7357 | 7357 | { |
| 7358 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7358 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7359 | 7359 | $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
| 7360 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7360 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7361 | 7361 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration |
| 7362 | 7362 | GROUP BY route |
| 7363 | 7363 | ORDER BY route_count DESC"; |
@@ -7369,7 +7369,7 @@ discard block |
||
| 7369 | 7369 | $routes_array = array(); |
| 7370 | 7370 | $temp_array = array(); |
| 7371 | 7371 | |
| 7372 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7372 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7373 | 7373 | { |
| 7374 | 7374 | $temp_array['route_count'] = $row['route_count']; |
| 7375 | 7375 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7397,9 +7397,9 @@ discard block |
||
| 7397 | 7397 | */ |
| 7398 | 7398 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 7399 | 7399 | { |
| 7400 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7401 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 7402 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7400 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7401 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 7402 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7403 | 7403 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao |
| 7404 | 7404 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7405 | 7405 | ORDER BY route_count DESC"; |
@@ -7411,7 +7411,7 @@ discard block |
||
| 7411 | 7411 | $routes_array = array(); |
| 7412 | 7412 | $temp_array = array(); |
| 7413 | 7413 | |
| 7414 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7414 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7415 | 7415 | { |
| 7416 | 7416 | $temp_array['route_count'] = $row['route_count']; |
| 7417 | 7417 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7439,9 +7439,9 @@ discard block |
||
| 7439 | 7439 | */ |
| 7440 | 7440 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 7441 | 7441 | { |
| 7442 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7443 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 7444 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7442 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7443 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 7444 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7445 | 7445 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 7446 | 7446 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7447 | 7447 | ORDER BY route_count DESC"; |
@@ -7452,7 +7452,7 @@ discard block |
||
| 7452 | 7452 | $routes_array = array(); |
| 7453 | 7453 | $temp_array = array(); |
| 7454 | 7454 | |
| 7455 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7455 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7456 | 7456 | { |
| 7457 | 7457 | $temp_array['route_count'] = $row['route_count']; |
| 7458 | 7458 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7480,9 +7480,9 @@ discard block |
||
| 7480 | 7480 | */ |
| 7481 | 7481 | public function countAllRoutesByCountry($country, $filters = array()) |
| 7482 | 7482 | { |
| 7483 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7484 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7485 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7483 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7484 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7485 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7486 | 7486 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7487 | 7487 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7488 | 7488 | ORDER BY route_count DESC"; |
@@ -7493,7 +7493,7 @@ discard block |
||
| 7493 | 7493 | $routes_array = array(); |
| 7494 | 7494 | $temp_array = array(); |
| 7495 | 7495 | |
| 7496 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7496 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7497 | 7497 | { |
| 7498 | 7498 | $temp_array['route_count'] = $row['route_count']; |
| 7499 | 7499 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7521,8 +7521,8 @@ discard block |
||
| 7521 | 7521 | public function countAllRoutesByDate($date, $filters = array()) |
| 7522 | 7522 | { |
| 7523 | 7523 | global $globalTimezone, $globalDBdriver; |
| 7524 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7525 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7524 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7525 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7526 | 7526 | if ($globalTimezone != '') { |
| 7527 | 7527 | date_default_timezone_set($globalTimezone); |
| 7528 | 7528 | $datetime = new DateTime($date); |
@@ -7530,12 +7530,12 @@ discard block |
||
| 7530 | 7530 | } else $offset = '+00:00'; |
| 7531 | 7531 | |
| 7532 | 7532 | if ($globalDBdriver == 'mysql') { |
| 7533 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7533 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7534 | 7534 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7535 | 7535 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7536 | 7536 | ORDER BY route_count DESC"; |
| 7537 | 7537 | } else { |
| 7538 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7538 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7539 | 7539 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7540 | 7540 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7541 | 7541 | ORDER BY route_count DESC"; |
@@ -7547,7 +7547,7 @@ discard block |
||
| 7547 | 7547 | $routes_array = array(); |
| 7548 | 7548 | $temp_array = array(); |
| 7549 | 7549 | |
| 7550 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7550 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7551 | 7551 | { |
| 7552 | 7552 | $temp_array['route_count'] = $row['route_count']; |
| 7553 | 7553 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7574,9 +7574,9 @@ discard block |
||
| 7574 | 7574 | */ |
| 7575 | 7575 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 7576 | 7576 | { |
| 7577 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7578 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7579 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7577 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7578 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7579 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7580 | 7580 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident |
| 7581 | 7581 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7582 | 7582 | ORDER BY route_count DESC"; |
@@ -7588,7 +7588,7 @@ discard block |
||
| 7588 | 7588 | $routes_array = array(); |
| 7589 | 7589 | $temp_array = array(); |
| 7590 | 7590 | |
| 7591 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7591 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7592 | 7592 | { |
| 7593 | 7593 | $temp_array['route_count'] = $row['route_count']; |
| 7594 | 7594 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7615,9 +7615,9 @@ discard block |
||
| 7615 | 7615 | */ |
| 7616 | 7616 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 7617 | 7617 | { |
| 7618 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7619 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 7620 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7618 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7619 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 7620 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7621 | 7621 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7622 | 7622 | GROUP BY route |
| 7623 | 7623 | ORDER BY route_count DESC"; |
@@ -7629,7 +7629,7 @@ discard block |
||
| 7629 | 7629 | $routes_array = array(); |
| 7630 | 7630 | $temp_array = array(); |
| 7631 | 7631 | |
| 7632 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7632 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7633 | 7633 | { |
| 7634 | 7634 | $temp_array['route_count'] = $row['route_count']; |
| 7635 | 7635 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7657,8 +7657,8 @@ discard block |
||
| 7657 | 7657 | */ |
| 7658 | 7658 | public function countAllRoutesWithWaypoints($filters = array()) |
| 7659 | 7659 | { |
| 7660 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7661 | - $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7660 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7661 | + $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7662 | 7662 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' |
| 7663 | 7663 | GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7664 | 7664 | ORDER BY route_count DESC |
@@ -7671,7 +7671,7 @@ discard block |
||
| 7671 | 7671 | $routes_array = array(); |
| 7672 | 7672 | $temp_array = array(); |
| 7673 | 7673 | |
| 7674 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7674 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7675 | 7675 | { |
| 7676 | 7676 | $temp_array['spotter_id'] = $row['spotter_id']; |
| 7677 | 7677 | $temp_array['route_count'] = $row['route_count']; |
@@ -7696,11 +7696,11 @@ discard block |
||
| 7696 | 7696 | * @return Array the callsign list |
| 7697 | 7697 | * |
| 7698 | 7698 | */ |
| 7699 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 7699 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 7700 | 7700 | { |
| 7701 | 7701 | global $globalDBdriver; |
| 7702 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7703 | - $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 7702 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7703 | + $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 7704 | 7704 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
| 7705 | 7705 | if ($olderthanmonths > 0) { |
| 7706 | 7706 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -7719,7 +7719,7 @@ discard block |
||
| 7719 | 7719 | $callsign_array = array(); |
| 7720 | 7720 | $temp_array = array(); |
| 7721 | 7721 | |
| 7722 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7722 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7723 | 7723 | { |
| 7724 | 7724 | $temp_array['callsign_icao'] = $row['ident']; |
| 7725 | 7725 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7741,8 +7741,8 @@ discard block |
||
| 7741 | 7741 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 7742 | 7742 | { |
| 7743 | 7743 | global $globalDBdriver; |
| 7744 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7745 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 7744 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7745 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 7746 | 7746 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 7747 | 7747 | if ($olderthanmonths > 0) { |
| 7748 | 7748 | if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
@@ -7761,7 +7761,7 @@ discard block |
||
| 7761 | 7761 | $callsign_array = array(); |
| 7762 | 7762 | $temp_array = array(); |
| 7763 | 7763 | |
| 7764 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7764 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7765 | 7765 | { |
| 7766 | 7766 | $temp_array['callsign_icao'] = $row['ident']; |
| 7767 | 7767 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7815,7 +7815,7 @@ discard block |
||
| 7815 | 7815 | $date_array = array(); |
| 7816 | 7816 | $temp_array = array(); |
| 7817 | 7817 | |
| 7818 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7818 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7819 | 7819 | { |
| 7820 | 7820 | $temp_array['date_name'] = $row['date_name']; |
| 7821 | 7821 | $temp_array['date_count'] = $row['date_count']; |
@@ -7840,15 +7840,15 @@ discard block |
||
| 7840 | 7840 | $datetime = new DateTime(); |
| 7841 | 7841 | $offset = $datetime->format('P'); |
| 7842 | 7842 | } else $offset = '+00:00'; |
| 7843 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7843 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7844 | 7844 | if ($globalDBdriver == 'mysql') { |
| 7845 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 7845 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 7846 | 7846 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 7847 | 7847 | GROUP BY spotter_output.airline_icao, date_name |
| 7848 | 7848 | ORDER BY date_count DESC |
| 7849 | 7849 | LIMIT 10 OFFSET 0"; |
| 7850 | 7850 | } else { |
| 7851 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 7851 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 7852 | 7852 | FROM spotter_output |
| 7853 | 7853 | WHERE spotter_output.airline_icao <> '' |
| 7854 | 7854 | GROUP BY spotter_output.airline_icao, date_name |
@@ -7863,7 +7863,7 @@ discard block |
||
| 7863 | 7863 | $date_array = array(); |
| 7864 | 7864 | $temp_array = array(); |
| 7865 | 7865 | |
| 7866 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7866 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7867 | 7867 | { |
| 7868 | 7868 | $temp_array['date_name'] = $row['date_name']; |
| 7869 | 7869 | $temp_array['date_count'] = $row['date_count']; |
@@ -7889,7 +7889,7 @@ discard block |
||
| 7889 | 7889 | $datetime = new DateTime(); |
| 7890 | 7890 | $offset = $datetime->format('P'); |
| 7891 | 7891 | } else $offset = '+00:00'; |
| 7892 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7892 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7893 | 7893 | if ($globalDBdriver == 'mysql') { |
| 7894 | 7894 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 7895 | 7895 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -7910,7 +7910,7 @@ discard block |
||
| 7910 | 7910 | $date_array = array(); |
| 7911 | 7911 | $temp_array = array(); |
| 7912 | 7912 | |
| 7913 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7913 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7914 | 7914 | { |
| 7915 | 7915 | $temp_array['date_name'] = $row['date_name']; |
| 7916 | 7916 | $temp_array['date_count'] = $row['date_count']; |
@@ -7935,7 +7935,7 @@ discard block |
||
| 7935 | 7935 | $datetime = new DateTime(); |
| 7936 | 7936 | $offset = $datetime->format('P'); |
| 7937 | 7937 | } else $offset = '+00:00'; |
| 7938 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7938 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7939 | 7939 | if ($globalDBdriver == 'mysql') { |
| 7940 | 7940 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 7941 | 7941 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -7956,7 +7956,7 @@ discard block |
||
| 7956 | 7956 | $date_array = array(); |
| 7957 | 7957 | $temp_array = array(); |
| 7958 | 7958 | |
| 7959 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7959 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7960 | 7960 | { |
| 7961 | 7961 | $temp_array['date_name'] = $row['date_name']; |
| 7962 | 7962 | $temp_array['date_count'] = $row['date_count']; |
@@ -7977,7 +7977,7 @@ discard block |
||
| 7977 | 7977 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 7978 | 7978 | { |
| 7979 | 7979 | global $globalTimezone, $globalDBdriver; |
| 7980 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7980 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7981 | 7981 | if ($globalTimezone != '') { |
| 7982 | 7982 | date_default_timezone_set($globalTimezone); |
| 7983 | 7983 | $datetime = new DateTime(); |
@@ -7985,13 +7985,13 @@ discard block |
||
| 7985 | 7985 | } else $offset = '+00:00'; |
| 7986 | 7986 | |
| 7987 | 7987 | if ($globalDBdriver == 'mysql') { |
| 7988 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 7988 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 7989 | 7989 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH) |
| 7990 | 7990 | GROUP BY spotter_output.airline_icao, date_name |
| 7991 | 7991 | ORDER BY spotter_output.date ASC"; |
| 7992 | 7992 | $query_data = array(':offset' => $offset); |
| 7993 | 7993 | } else { |
| 7994 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 7994 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 7995 | 7995 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS' |
| 7996 | 7996 | GROUP BY spotter_output.airline_icao, date_name |
| 7997 | 7997 | ORDER BY date_name ASC"; |
@@ -8004,7 +8004,7 @@ discard block |
||
| 8004 | 8004 | $date_array = array(); |
| 8005 | 8005 | $temp_array = array(); |
| 8006 | 8006 | |
| 8007 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8007 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8008 | 8008 | { |
| 8009 | 8009 | $temp_array['date_name'] = $row['date_name']; |
| 8010 | 8010 | $temp_array['date_count'] = $row['date_count']; |
@@ -8051,7 +8051,7 @@ discard block |
||
| 8051 | 8051 | $date_array = array(); |
| 8052 | 8052 | $temp_array = array(); |
| 8053 | 8053 | |
| 8054 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8054 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8055 | 8055 | { |
| 8056 | 8056 | $temp_array['month_name'] = $row['month_name']; |
| 8057 | 8057 | $temp_array['year_name'] = $row['year_name']; |
@@ -8072,7 +8072,7 @@ discard block |
||
| 8072 | 8072 | public function countAllMonthsByAirlines($filters = array()) |
| 8073 | 8073 | { |
| 8074 | 8074 | global $globalTimezone, $globalDBdriver; |
| 8075 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8075 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8076 | 8076 | if ($globalTimezone != '') { |
| 8077 | 8077 | date_default_timezone_set($globalTimezone); |
| 8078 | 8078 | $datetime = new DateTime(); |
@@ -8080,12 +8080,12 @@ discard block |
||
| 8080 | 8080 | } else $offset = '+00:00'; |
| 8081 | 8081 | |
| 8082 | 8082 | if ($globalDBdriver == 'mysql') { |
| 8083 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8083 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8084 | 8084 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8085 | 8085 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8086 | 8086 | ORDER BY date_count DESC"; |
| 8087 | 8087 | } else { |
| 8088 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8088 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8089 | 8089 | FROM spotter_output |
| 8090 | 8090 | WHERE spotter_output.airline_icao <> '' |
| 8091 | 8091 | GROUP BY spotter_output.airline_icao, year_name, month_name |
@@ -8099,7 +8099,7 @@ discard block |
||
| 8099 | 8099 | $date_array = array(); |
| 8100 | 8100 | $temp_array = array(); |
| 8101 | 8101 | |
| 8102 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8102 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8103 | 8103 | { |
| 8104 | 8104 | $temp_array['month_name'] = $row['month_name']; |
| 8105 | 8105 | $temp_array['year_name'] = $row['year_name']; |
@@ -8126,14 +8126,14 @@ discard block |
||
| 8126 | 8126 | $datetime = new DateTime(); |
| 8127 | 8127 | $offset = $datetime->format('P'); |
| 8128 | 8128 | } else $offset = '+00:00'; |
| 8129 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8129 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8130 | 8130 | if ($globalDBdriver == 'mysql') { |
| 8131 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8131 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8132 | 8132 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
| 8133 | 8133 | GROUP BY year_name, month_name |
| 8134 | 8134 | ORDER BY date_count DESC"; |
| 8135 | 8135 | } else { |
| 8136 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8136 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8137 | 8137 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
| 8138 | 8138 | GROUP BY year_name, month_name |
| 8139 | 8139 | ORDER BY date_count DESC"; |
@@ -8145,7 +8145,7 @@ discard block |
||
| 8145 | 8145 | $date_array = array(); |
| 8146 | 8146 | $temp_array = array(); |
| 8147 | 8147 | |
| 8148 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8148 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8149 | 8149 | { |
| 8150 | 8150 | $temp_array['month_name'] = $row['month_name']; |
| 8151 | 8151 | $temp_array['year_name'] = $row['year_name']; |
@@ -8171,15 +8171,15 @@ discard block |
||
| 8171 | 8171 | $datetime = new DateTime(); |
| 8172 | 8172 | $offset = $datetime->format('P'); |
| 8173 | 8173 | } else $offset = '+00:00'; |
| 8174 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8174 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8175 | 8175 | |
| 8176 | 8176 | if ($globalDBdriver == 'mysql') { |
| 8177 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8177 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8178 | 8178 | FROM spotter_output".$filter_query." owner_name <> '' |
| 8179 | 8179 | GROUP BY year_name, month_name |
| 8180 | 8180 | ORDER BY date_count DESC"; |
| 8181 | 8181 | } else { |
| 8182 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8182 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8183 | 8183 | FROM spotter_output".$filter_query." owner_name <> '' |
| 8184 | 8184 | GROUP BY year_name, month_name |
| 8185 | 8185 | ORDER BY date_count DESC"; |
@@ -8191,7 +8191,7 @@ discard block |
||
| 8191 | 8191 | $date_array = array(); |
| 8192 | 8192 | $temp_array = array(); |
| 8193 | 8193 | |
| 8194 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8194 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8195 | 8195 | { |
| 8196 | 8196 | $temp_array['month_name'] = $row['month_name']; |
| 8197 | 8197 | $temp_array['year_name'] = $row['year_name']; |
@@ -8212,7 +8212,7 @@ discard block |
||
| 8212 | 8212 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 8213 | 8213 | { |
| 8214 | 8214 | global $globalTimezone, $globalDBdriver; |
| 8215 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8215 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8216 | 8216 | if ($globalTimezone != '') { |
| 8217 | 8217 | date_default_timezone_set($globalTimezone); |
| 8218 | 8218 | $datetime = new DateTime(); |
@@ -8220,12 +8220,12 @@ discard block |
||
| 8220 | 8220 | } else $offset = '+00:00'; |
| 8221 | 8221 | |
| 8222 | 8222 | if ($globalDBdriver == 'mysql') { |
| 8223 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8223 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8224 | 8224 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 8225 | 8225 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8226 | 8226 | ORDER BY date_count DESC"; |
| 8227 | 8227 | } else { |
| 8228 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8228 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8229 | 8229 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 8230 | 8230 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8231 | 8231 | ORDER BY date_count DESC"; |
@@ -8237,7 +8237,7 @@ discard block |
||
| 8237 | 8237 | $date_array = array(); |
| 8238 | 8238 | $temp_array = array(); |
| 8239 | 8239 | |
| 8240 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8240 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8241 | 8241 | { |
| 8242 | 8242 | $temp_array['month_name'] = $row['month_name']; |
| 8243 | 8243 | $temp_array['year_name'] = $row['year_name']; |
@@ -8264,15 +8264,15 @@ discard block |
||
| 8264 | 8264 | $datetime = new DateTime(); |
| 8265 | 8265 | $offset = $datetime->format('P'); |
| 8266 | 8266 | } else $offset = '+00:00'; |
| 8267 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8267 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8268 | 8268 | |
| 8269 | 8269 | if ($globalDBdriver == 'mysql') { |
| 8270 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8270 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8271 | 8271 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 8272 | 8272 | GROUP BY year_name, month_name |
| 8273 | 8273 | ORDER BY date_count DESC"; |
| 8274 | 8274 | } else { |
| 8275 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8275 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8276 | 8276 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 8277 | 8277 | GROUP BY year_name, month_name |
| 8278 | 8278 | ORDER BY date_count DESC"; |
@@ -8284,7 +8284,7 @@ discard block |
||
| 8284 | 8284 | $date_array = array(); |
| 8285 | 8285 | $temp_array = array(); |
| 8286 | 8286 | |
| 8287 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8287 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8288 | 8288 | { |
| 8289 | 8289 | $temp_array['month_name'] = $row['month_name']; |
| 8290 | 8290 | $temp_array['year_name'] = $row['year_name']; |
@@ -8305,7 +8305,7 @@ discard block |
||
| 8305 | 8305 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 8306 | 8306 | { |
| 8307 | 8307 | global $globalTimezone, $globalDBdriver; |
| 8308 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8308 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8309 | 8309 | if ($globalTimezone != '') { |
| 8310 | 8310 | date_default_timezone_set($globalTimezone); |
| 8311 | 8311 | $datetime = new DateTime(); |
@@ -8313,12 +8313,12 @@ discard block |
||
| 8313 | 8313 | } else $offset = '+00:00'; |
| 8314 | 8314 | |
| 8315 | 8315 | if ($globalDBdriver == 'mysql') { |
| 8316 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8316 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8317 | 8317 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 8318 | 8318 | GROUP BY spotter_output.airline_icao,year_name, month_name |
| 8319 | 8319 | ORDER BY date_count DESC"; |
| 8320 | 8320 | } else { |
| 8321 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8321 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8322 | 8322 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 8323 | 8323 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8324 | 8324 | ORDER BY date_count DESC"; |
@@ -8330,7 +8330,7 @@ discard block |
||
| 8330 | 8330 | $date_array = array(); |
| 8331 | 8331 | $temp_array = array(); |
| 8332 | 8332 | |
| 8333 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8333 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8334 | 8334 | { |
| 8335 | 8335 | $temp_array['month_name'] = $row['month_name']; |
| 8336 | 8336 | $temp_array['year_name'] = $row['year_name']; |
@@ -8352,7 +8352,7 @@ discard block |
||
| 8352 | 8352 | public function countAllMonthsAirlines($filters = array()) |
| 8353 | 8353 | { |
| 8354 | 8354 | global $globalTimezone, $globalDBdriver; |
| 8355 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8355 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8356 | 8356 | if ($globalTimezone != '') { |
| 8357 | 8357 | date_default_timezone_set($globalTimezone); |
| 8358 | 8358 | $datetime = new DateTime(); |
@@ -8360,12 +8360,12 @@ discard block |
||
| 8360 | 8360 | } else $offset = '+00:00'; |
| 8361 | 8361 | |
| 8362 | 8362 | if ($globalDBdriver == 'mysql') { |
| 8363 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
| 8363 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
| 8364 | 8364 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 8365 | 8365 | GROUP BY year_name, month_name |
| 8366 | 8366 | ORDER BY date_count DESC"; |
| 8367 | 8367 | } else { |
| 8368 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
| 8368 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
| 8369 | 8369 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 8370 | 8370 | GROUP BY year_name, month_name |
| 8371 | 8371 | ORDER BY date_count DESC"; |
@@ -8377,7 +8377,7 @@ discard block |
||
| 8377 | 8377 | $date_array = array(); |
| 8378 | 8378 | $temp_array = array(); |
| 8379 | 8379 | |
| 8380 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8380 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8381 | 8381 | { |
| 8382 | 8382 | $temp_array['month_name'] = $row['month_name']; |
| 8383 | 8383 | $temp_array['year_name'] = $row['year_name']; |
@@ -8403,15 +8403,15 @@ discard block |
||
| 8403 | 8403 | $datetime = new DateTime(); |
| 8404 | 8404 | $offset = $datetime->format('P'); |
| 8405 | 8405 | } else $offset = '+00:00'; |
| 8406 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8406 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8407 | 8407 | |
| 8408 | 8408 | if ($globalDBdriver == 'mysql') { |
| 8409 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8409 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8410 | 8410 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 8411 | 8411 | GROUP BY year_name, month_name |
| 8412 | 8412 | ORDER BY date_count DESC"; |
| 8413 | 8413 | } else { |
| 8414 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8414 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8415 | 8415 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 8416 | 8416 | GROUP BY year_name, month_name |
| 8417 | 8417 | ORDER BY date_count DESC"; |
@@ -8423,7 +8423,7 @@ discard block |
||
| 8423 | 8423 | $date_array = array(); |
| 8424 | 8424 | $temp_array = array(); |
| 8425 | 8425 | |
| 8426 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8426 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8427 | 8427 | { |
| 8428 | 8428 | $temp_array['month_name'] = $row['month_name']; |
| 8429 | 8429 | $temp_array['year_name'] = $row['year_name']; |
@@ -8445,7 +8445,7 @@ discard block |
||
| 8445 | 8445 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 8446 | 8446 | { |
| 8447 | 8447 | global $globalTimezone, $globalDBdriver; |
| 8448 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8448 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8449 | 8449 | if ($globalTimezone != '') { |
| 8450 | 8450 | date_default_timezone_set($globalTimezone); |
| 8451 | 8451 | $datetime = new DateTime(); |
@@ -8453,12 +8453,12 @@ discard block |
||
| 8453 | 8453 | } else $offset = '+00:00'; |
| 8454 | 8454 | |
| 8455 | 8455 | if ($globalDBdriver == 'mysql') { |
| 8456 | - $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8456 | + $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8457 | 8457 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 8458 | 8458 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8459 | 8459 | ORDER BY date_count DESC"; |
| 8460 | 8460 | } else { |
| 8461 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8461 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8462 | 8462 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 8463 | 8463 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8464 | 8464 | ORDER BY date_count DESC"; |
@@ -8470,7 +8470,7 @@ discard block |
||
| 8470 | 8470 | $date_array = array(); |
| 8471 | 8471 | $temp_array = array(); |
| 8472 | 8472 | |
| 8473 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8473 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8474 | 8474 | { |
| 8475 | 8475 | $temp_array['month_name'] = $row['month_name']; |
| 8476 | 8476 | $temp_array['year_name'] = $row['year_name']; |
@@ -8497,15 +8497,15 @@ discard block |
||
| 8497 | 8497 | $datetime = new DateTime(); |
| 8498 | 8498 | $offset = $datetime->format('P'); |
| 8499 | 8499 | } else $offset = '+00:00'; |
| 8500 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8500 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8501 | 8501 | |
| 8502 | 8502 | if ($globalDBdriver == 'mysql') { |
| 8503 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8503 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8504 | 8504 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 8505 | 8505 | GROUP BY year_name, month_name |
| 8506 | 8506 | ORDER BY date_count DESC"; |
| 8507 | 8507 | } else { |
| 8508 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8508 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8509 | 8509 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 8510 | 8510 | GROUP BY year_name, month_name |
| 8511 | 8511 | ORDER BY date_count DESC"; |
@@ -8517,7 +8517,7 @@ discard block |
||
| 8517 | 8517 | $date_array = array(); |
| 8518 | 8518 | $temp_array = array(); |
| 8519 | 8519 | |
| 8520 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8520 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8521 | 8521 | { |
| 8522 | 8522 | $temp_array['month_name'] = $row['month_name']; |
| 8523 | 8523 | $temp_array['year_name'] = $row['year_name']; |
@@ -8539,7 +8539,7 @@ discard block |
||
| 8539 | 8539 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 8540 | 8540 | { |
| 8541 | 8541 | global $globalTimezone, $globalDBdriver; |
| 8542 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8542 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8543 | 8543 | if ($globalTimezone != '') { |
| 8544 | 8544 | date_default_timezone_set($globalTimezone); |
| 8545 | 8545 | $datetime = new DateTime(); |
@@ -8547,12 +8547,12 @@ discard block |
||
| 8547 | 8547 | } else $offset = '+00:00'; |
| 8548 | 8548 | |
| 8549 | 8549 | if ($globalDBdriver == 'mysql') { |
| 8550 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8550 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8551 | 8551 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 8552 | 8552 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8553 | 8553 | ORDER BY date_count DESC"; |
| 8554 | 8554 | } else { |
| 8555 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8555 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8556 | 8556 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 8557 | 8557 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8558 | 8558 | ORDER BY date_count DESC"; |
@@ -8564,7 +8564,7 @@ discard block |
||
| 8564 | 8564 | $date_array = array(); |
| 8565 | 8565 | $temp_array = array(); |
| 8566 | 8566 | |
| 8567 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8567 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8568 | 8568 | { |
| 8569 | 8569 | $temp_array['month_name'] = $row['month_name']; |
| 8570 | 8570 | $temp_array['year_name'] = $row['year_name']; |
@@ -8592,7 +8592,7 @@ discard block |
||
| 8592 | 8592 | $datetime = new DateTime(); |
| 8593 | 8593 | $offset = $datetime->format('P'); |
| 8594 | 8594 | } else $offset = '+00:00'; |
| 8595 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8595 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8596 | 8596 | if ($globalDBdriver == 'mysql') { |
| 8597 | 8597 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
| 8598 | 8598 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -8613,7 +8613,7 @@ discard block |
||
| 8613 | 8613 | $date_array = array(); |
| 8614 | 8614 | $temp_array = array(); |
| 8615 | 8615 | |
| 8616 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8616 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8617 | 8617 | { |
| 8618 | 8618 | $temp_array['year_name'] = $row['year_name']; |
| 8619 | 8619 | $temp_array['month_name'] = $row['month_name']; |
@@ -8633,7 +8633,7 @@ discard block |
||
| 8633 | 8633 | * @return Array the hour list |
| 8634 | 8634 | * |
| 8635 | 8635 | */ |
| 8636 | - public function countAllHours($orderby,$filters = array()) |
|
| 8636 | + public function countAllHours($orderby, $filters = array()) |
|
| 8637 | 8637 | { |
| 8638 | 8638 | global $globalTimezone, $globalDBdriver; |
| 8639 | 8639 | if ($globalTimezone != '') { |
@@ -8681,7 +8681,7 @@ discard block |
||
| 8681 | 8681 | $hour_array = array(); |
| 8682 | 8682 | $temp_array = array(); |
| 8683 | 8683 | |
| 8684 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8684 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8685 | 8685 | { |
| 8686 | 8686 | $temp_array['hour_name'] = $row['hour_name']; |
| 8687 | 8687 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8701,7 +8701,7 @@ discard block |
||
| 8701 | 8701 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 8702 | 8702 | { |
| 8703 | 8703 | global $globalTimezone, $globalDBdriver; |
| 8704 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8704 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8705 | 8705 | if ($globalTimezone != '') { |
| 8706 | 8706 | date_default_timezone_set($globalTimezone); |
| 8707 | 8707 | $datetime = new DateTime(); |
@@ -8719,7 +8719,7 @@ discard block |
||
| 8719 | 8719 | } |
| 8720 | 8720 | |
| 8721 | 8721 | if ($globalDBdriver == 'mysql') { |
| 8722 | - $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8722 | + $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8723 | 8723 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8724 | 8724 | GROUP BY spotter_output.airline_icao, hour_name |
| 8725 | 8725 | ".$orderby_sql; |
@@ -8732,7 +8732,7 @@ discard block |
||
| 8732 | 8732 | */ |
| 8733 | 8733 | $query_data = array(':offset' => $offset); |
| 8734 | 8734 | } else { |
| 8735 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8735 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8736 | 8736 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8737 | 8737 | GROUP BY spotter_output.airline_icao, hour_name |
| 8738 | 8738 | ".$orderby_sql; |
@@ -8745,7 +8745,7 @@ discard block |
||
| 8745 | 8745 | $hour_array = array(); |
| 8746 | 8746 | $temp_array = array(); |
| 8747 | 8747 | |
| 8748 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8748 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8749 | 8749 | { |
| 8750 | 8750 | $temp_array['hour_name'] = $row['hour_name']; |
| 8751 | 8751 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8768,34 +8768,34 @@ discard block |
||
| 8768 | 8768 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 8769 | 8769 | { |
| 8770 | 8770 | global $globalTimezone, $globalDBdriver; |
| 8771 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8771 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8772 | 8772 | if ($globalTimezone != '') { |
| 8773 | 8773 | date_default_timezone_set($globalTimezone); |
| 8774 | 8774 | $datetime = new DateTime(); |
| 8775 | 8775 | $offset = $datetime->format('P'); |
| 8776 | 8776 | } else $offset = '+00:00'; |
| 8777 | 8777 | |
| 8778 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 8778 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 8779 | 8779 | |
| 8780 | 8780 | if ($globalDBdriver == 'mysql') { |
| 8781 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8781 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8782 | 8782 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 8783 | 8783 | GROUP BY hour_name |
| 8784 | 8784 | ORDER BY hour_name ASC"; |
| 8785 | 8785 | } else { |
| 8786 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8786 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8787 | 8787 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 8788 | 8788 | GROUP BY hour_name |
| 8789 | 8789 | ORDER BY hour_name ASC"; |
| 8790 | 8790 | } |
| 8791 | 8791 | |
| 8792 | 8792 | $sth = $this->db->prepare($query); |
| 8793 | - $sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset)); |
|
| 8793 | + $sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset)); |
|
| 8794 | 8794 | |
| 8795 | 8795 | $hour_array = array(); |
| 8796 | 8796 | $temp_array = array(); |
| 8797 | 8797 | |
| 8798 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8798 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8799 | 8799 | { |
| 8800 | 8800 | $temp_array['hour_name'] = $row['hour_name']; |
| 8801 | 8801 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8818,8 +8818,8 @@ discard block |
||
| 8818 | 8818 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 8819 | 8819 | { |
| 8820 | 8820 | global $globalTimezone, $globalDBdriver; |
| 8821 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8822 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 8821 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8822 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 8823 | 8823 | if ($globalTimezone != '') { |
| 8824 | 8824 | date_default_timezone_set($globalTimezone); |
| 8825 | 8825 | $datetime = new DateTime(); |
@@ -8827,24 +8827,24 @@ discard block |
||
| 8827 | 8827 | } else $offset = '+00:00'; |
| 8828 | 8828 | |
| 8829 | 8829 | if ($globalDBdriver == 'mysql') { |
| 8830 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8830 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8831 | 8831 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 8832 | 8832 | GROUP BY hour_name |
| 8833 | 8833 | ORDER BY hour_name ASC"; |
| 8834 | 8834 | } else { |
| 8835 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8835 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8836 | 8836 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 8837 | 8837 | GROUP BY hour_name |
| 8838 | 8838 | ORDER BY hour_name ASC"; |
| 8839 | 8839 | } |
| 8840 | 8840 | |
| 8841 | 8841 | $sth = $this->db->prepare($query); |
| 8842 | - $sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset)); |
|
| 8842 | + $sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset)); |
|
| 8843 | 8843 | |
| 8844 | 8844 | $hour_array = array(); |
| 8845 | 8845 | $temp_array = array(); |
| 8846 | 8846 | |
| 8847 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8847 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8848 | 8848 | { |
| 8849 | 8849 | $temp_array['hour_name'] = $row['hour_name']; |
| 8850 | 8850 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8865,8 +8865,8 @@ discard block |
||
| 8865 | 8865 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 8866 | 8866 | { |
| 8867 | 8867 | global $globalTimezone, $globalDBdriver; |
| 8868 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8869 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 8868 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8869 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 8870 | 8870 | if ($globalTimezone != '') { |
| 8871 | 8871 | date_default_timezone_set($globalTimezone); |
| 8872 | 8872 | $datetime = new DateTime(); |
@@ -8874,24 +8874,24 @@ discard block |
||
| 8874 | 8874 | } else $offset = '+00:00'; |
| 8875 | 8875 | |
| 8876 | 8876 | if ($globalDBdriver == 'mysql') { |
| 8877 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8877 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8878 | 8878 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 8879 | 8879 | GROUP BY hour_name |
| 8880 | 8880 | ORDER BY hour_name ASC"; |
| 8881 | 8881 | } else { |
| 8882 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8882 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8883 | 8883 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 8884 | 8884 | GROUP BY hour_name |
| 8885 | 8885 | ORDER BY hour_name ASC"; |
| 8886 | 8886 | } |
| 8887 | 8887 | |
| 8888 | 8888 | $sth = $this->db->prepare($query); |
| 8889 | - $sth->execute(array(':registration' => $registration,':offset' => $offset)); |
|
| 8889 | + $sth->execute(array(':registration' => $registration, ':offset' => $offset)); |
|
| 8890 | 8890 | |
| 8891 | 8891 | $hour_array = array(); |
| 8892 | 8892 | $temp_array = array(); |
| 8893 | 8893 | |
| 8894 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8894 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8895 | 8895 | { |
| 8896 | 8896 | $temp_array['hour_name'] = $row['hour_name']; |
| 8897 | 8897 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8912,8 +8912,8 @@ discard block |
||
| 8912 | 8912 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 8913 | 8913 | { |
| 8914 | 8914 | global $globalTimezone, $globalDBdriver; |
| 8915 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8916 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 8915 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8916 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 8917 | 8917 | if ($globalTimezone != '') { |
| 8918 | 8918 | date_default_timezone_set($globalTimezone); |
| 8919 | 8919 | $datetime = new DateTime(); |
@@ -8921,24 +8921,24 @@ discard block |
||
| 8921 | 8921 | } else $offset = '+00:00'; |
| 8922 | 8922 | |
| 8923 | 8923 | if ($globalDBdriver == 'mysql') { |
| 8924 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8924 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8925 | 8925 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 8926 | 8926 | GROUP BY hour_name |
| 8927 | 8927 | ORDER BY hour_name ASC"; |
| 8928 | 8928 | } else { |
| 8929 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8929 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8930 | 8930 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 8931 | 8931 | GROUP BY hour_name |
| 8932 | 8932 | ORDER BY hour_name ASC"; |
| 8933 | 8933 | } |
| 8934 | 8934 | |
| 8935 | 8935 | $sth = $this->db->prepare($query); |
| 8936 | - $sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset)); |
|
| 8936 | + $sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset)); |
|
| 8937 | 8937 | |
| 8938 | 8938 | $hour_array = array(); |
| 8939 | 8939 | $temp_array = array(); |
| 8940 | 8940 | |
| 8941 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8941 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8942 | 8942 | { |
| 8943 | 8943 | $temp_array['hour_name'] = $row['hour_name']; |
| 8944 | 8944 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8957,11 +8957,11 @@ discard block |
||
| 8957 | 8957 | * @return Array the hour list |
| 8958 | 8958 | * |
| 8959 | 8959 | */ |
| 8960 | - public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
|
| 8960 | + public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 8961 | 8961 | { |
| 8962 | 8962 | global $globalTimezone, $globalDBdriver; |
| 8963 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8964 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 8963 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8964 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 8965 | 8965 | if ($globalTimezone != '') { |
| 8966 | 8966 | date_default_timezone_set($globalTimezone); |
| 8967 | 8967 | $datetime = new DateTime(); |
@@ -8969,24 +8969,24 @@ discard block |
||
| 8969 | 8969 | } else $offset = '+00:00'; |
| 8970 | 8970 | |
| 8971 | 8971 | if ($globalDBdriver == 'mysql') { |
| 8972 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8972 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8973 | 8973 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 8974 | 8974 | GROUP BY hour_name |
| 8975 | 8975 | ORDER BY hour_name ASC"; |
| 8976 | 8976 | } else { |
| 8977 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8977 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8978 | 8978 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 8979 | 8979 | GROUP BY hour_name |
| 8980 | 8980 | ORDER BY hour_name ASC"; |
| 8981 | 8981 | } |
| 8982 | 8982 | |
| 8983 | 8983 | $sth = $this->db->prepare($query); |
| 8984 | - $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset)); |
|
| 8984 | + $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset)); |
|
| 8985 | 8985 | |
| 8986 | 8986 | $hour_array = array(); |
| 8987 | 8987 | $temp_array = array(); |
| 8988 | 8988 | |
| 8989 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8989 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8990 | 8990 | { |
| 8991 | 8991 | $temp_array['hour_name'] = $row['hour_name']; |
| 8992 | 8992 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9008,8 +9008,8 @@ discard block |
||
| 9008 | 9008 | public function countAllHoursByDate($date, $filters = array()) |
| 9009 | 9009 | { |
| 9010 | 9010 | global $globalTimezone, $globalDBdriver; |
| 9011 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9012 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 9011 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9012 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 9013 | 9013 | if ($globalTimezone != '') { |
| 9014 | 9014 | date_default_timezone_set($globalTimezone); |
| 9015 | 9015 | $datetime = new DateTime($date); |
@@ -9017,12 +9017,12 @@ discard block |
||
| 9017 | 9017 | } else $offset = '+00:00'; |
| 9018 | 9018 | |
| 9019 | 9019 | if ($globalDBdriver == 'mysql') { |
| 9020 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9020 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9021 | 9021 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 9022 | 9022 | GROUP BY hour_name |
| 9023 | 9023 | ORDER BY hour_name ASC"; |
| 9024 | 9024 | } else { |
| 9025 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9025 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9026 | 9026 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 9027 | 9027 | GROUP BY hour_name |
| 9028 | 9028 | ORDER BY hour_name ASC"; |
@@ -9034,7 +9034,7 @@ discard block |
||
| 9034 | 9034 | $hour_array = array(); |
| 9035 | 9035 | $temp_array = array(); |
| 9036 | 9036 | |
| 9037 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9037 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9038 | 9038 | { |
| 9039 | 9039 | $temp_array['hour_name'] = $row['hour_name']; |
| 9040 | 9040 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9056,8 +9056,8 @@ discard block |
||
| 9056 | 9056 | public function countAllHoursByIdent($ident, $filters = array()) |
| 9057 | 9057 | { |
| 9058 | 9058 | global $globalTimezone, $globalDBdriver; |
| 9059 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9060 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 9059 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9060 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 9061 | 9061 | if ($globalTimezone != '') { |
| 9062 | 9062 | date_default_timezone_set($globalTimezone); |
| 9063 | 9063 | $datetime = new DateTime(); |
@@ -9065,12 +9065,12 @@ discard block |
||
| 9065 | 9065 | } else $offset = '+00:00'; |
| 9066 | 9066 | |
| 9067 | 9067 | if ($globalDBdriver == 'mysql') { |
| 9068 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9068 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9069 | 9069 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 9070 | 9070 | GROUP BY hour_name |
| 9071 | 9071 | ORDER BY hour_name ASC"; |
| 9072 | 9072 | } else { |
| 9073 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9073 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9074 | 9074 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 9075 | 9075 | GROUP BY hour_name |
| 9076 | 9076 | ORDER BY hour_name ASC"; |
@@ -9078,12 +9078,12 @@ discard block |
||
| 9078 | 9078 | |
| 9079 | 9079 | |
| 9080 | 9080 | $sth = $this->db->prepare($query); |
| 9081 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
| 9081 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
| 9082 | 9082 | |
| 9083 | 9083 | $hour_array = array(); |
| 9084 | 9084 | $temp_array = array(); |
| 9085 | 9085 | |
| 9086 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9086 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9087 | 9087 | { |
| 9088 | 9088 | $temp_array['hour_name'] = $row['hour_name']; |
| 9089 | 9089 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9102,12 +9102,12 @@ discard block |
||
| 9102 | 9102 | * @return Array the hour list |
| 9103 | 9103 | * |
| 9104 | 9104 | */ |
| 9105 | - public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
|
| 9105 | + public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 9106 | 9106 | { |
| 9107 | 9107 | global $globalTimezone, $globalDBdriver; |
| 9108 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9109 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 9110 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 9108 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9109 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 9110 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 9111 | 9111 | if ($globalTimezone != '') { |
| 9112 | 9112 | date_default_timezone_set($globalTimezone); |
| 9113 | 9113 | $datetime = new DateTime(); |
@@ -9115,24 +9115,24 @@ discard block |
||
| 9115 | 9115 | } else $offset = '+00:00'; |
| 9116 | 9116 | |
| 9117 | 9117 | if ($globalDBdriver == 'mysql') { |
| 9118 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9118 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9119 | 9119 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 9120 | 9120 | GROUP BY hour_name |
| 9121 | 9121 | ORDER BY hour_name ASC"; |
| 9122 | 9122 | } else { |
| 9123 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9123 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9124 | 9124 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 9125 | 9125 | GROUP BY hour_name |
| 9126 | 9126 | ORDER BY hour_name ASC"; |
| 9127 | 9127 | } |
| 9128 | 9128 | |
| 9129 | 9129 | $sth = $this->db->prepare($query); |
| 9130 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset)); |
|
| 9130 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset)); |
|
| 9131 | 9131 | |
| 9132 | 9132 | $hour_array = array(); |
| 9133 | 9133 | $temp_array = array(); |
| 9134 | 9134 | |
| 9135 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9135 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9136 | 9136 | { |
| 9137 | 9137 | $temp_array['hour_name'] = $row['hour_name']; |
| 9138 | 9138 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9153,8 +9153,8 @@ discard block |
||
| 9153 | 9153 | public function countAllHoursByCountry($country, $filters = array()) |
| 9154 | 9154 | { |
| 9155 | 9155 | global $globalTimezone, $globalDBdriver; |
| 9156 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9157 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 9156 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9157 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 9158 | 9158 | if ($globalTimezone != '') { |
| 9159 | 9159 | date_default_timezone_set($globalTimezone); |
| 9160 | 9160 | $datetime = new DateTime(); |
@@ -9162,24 +9162,24 @@ discard block |
||
| 9162 | 9162 | } else $offset = '+00:00'; |
| 9163 | 9163 | |
| 9164 | 9164 | if ($globalDBdriver == 'mysql') { |
| 9165 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9165 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9166 | 9166 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 9167 | 9167 | GROUP BY hour_name |
| 9168 | 9168 | ORDER BY hour_name ASC"; |
| 9169 | 9169 | } else { |
| 9170 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9170 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9171 | 9171 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 9172 | 9172 | GROUP BY hour_name |
| 9173 | 9173 | ORDER BY hour_name ASC"; |
| 9174 | 9174 | } |
| 9175 | 9175 | |
| 9176 | 9176 | $sth = $this->db->prepare($query); |
| 9177 | - $sth->execute(array(':country' => $country,':offset' => $offset)); |
|
| 9177 | + $sth->execute(array(':country' => $country, ':offset' => $offset)); |
|
| 9178 | 9178 | |
| 9179 | 9179 | $hour_array = array(); |
| 9180 | 9180 | $temp_array = array(); |
| 9181 | 9181 | |
| 9182 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9182 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9183 | 9183 | { |
| 9184 | 9184 | $temp_array['hour_name'] = $row['hour_name']; |
| 9185 | 9185 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9201,8 +9201,8 @@ discard block |
||
| 9201 | 9201 | */ |
| 9202 | 9202 | public function countOverallAircrafts($filters = array()) |
| 9203 | 9203 | { |
| 9204 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9205 | - $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 9204 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9205 | + $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 9206 | 9206 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 9207 | 9207 | $sth = $this->db->prepare($query); |
| 9208 | 9208 | $sth->execute(); |
@@ -9217,8 +9217,8 @@ discard block |
||
| 9217 | 9217 | */ |
| 9218 | 9218 | public function countOverallArrival($filters = array()) |
| 9219 | 9219 | { |
| 9220 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9221 | - $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 9220 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9221 | + $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 9222 | 9222 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''"; |
| 9223 | 9223 | |
| 9224 | 9224 | $sth = $this->db->prepare($query); |
@@ -9234,8 +9234,8 @@ discard block |
||
| 9234 | 9234 | */ |
| 9235 | 9235 | public function countOverallPilots($filters = array()) |
| 9236 | 9236 | { |
| 9237 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9238 | - $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 9237 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9238 | + $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 9239 | 9239 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''"; |
| 9240 | 9240 | $sth = $this->db->prepare($query); |
| 9241 | 9241 | $sth->execute(); |
@@ -9250,8 +9250,8 @@ discard block |
||
| 9250 | 9250 | */ |
| 9251 | 9251 | public function countOverallOwners($filters = array()) |
| 9252 | 9252 | { |
| 9253 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9254 | - $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 9253 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9254 | + $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 9255 | 9255 | FROM spotter_output".$filter_query." spotter_output.owner_name <> ''"; |
| 9256 | 9256 | $sth = $this->db->prepare($query); |
| 9257 | 9257 | $sth->execute(); |
@@ -9284,8 +9284,8 @@ discard block |
||
| 9284 | 9284 | */ |
| 9285 | 9285 | public function countOverallMilitaryFlights($filters = array()) |
| 9286 | 9286 | { |
| 9287 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9288 | - $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 9287 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9288 | + $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 9289 | 9289 | FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'"; |
| 9290 | 9290 | |
| 9291 | 9291 | $sth = $this->db->prepare($query); |
@@ -9322,7 +9322,7 @@ discard block |
||
| 9322 | 9322 | public function countAllHoursFromToday($filters = array()) |
| 9323 | 9323 | { |
| 9324 | 9324 | global $globalTimezone, $globalDBdriver; |
| 9325 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9325 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9326 | 9326 | if ($globalTimezone != '') { |
| 9327 | 9327 | date_default_timezone_set($globalTimezone); |
| 9328 | 9328 | $datetime = new DateTime(); |
@@ -9330,12 +9330,12 @@ discard block |
||
| 9330 | 9330 | } else $offset = '+00:00'; |
| 9331 | 9331 | |
| 9332 | 9332 | if ($globalDBdriver == 'mysql') { |
| 9333 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9333 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9334 | 9334 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE() |
| 9335 | 9335 | GROUP BY hour_name |
| 9336 | 9336 | ORDER BY hour_name ASC"; |
| 9337 | 9337 | } else { |
| 9338 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9338 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9339 | 9339 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
| 9340 | 9340 | GROUP BY hour_name |
| 9341 | 9341 | ORDER BY hour_name ASC"; |
@@ -9347,7 +9347,7 @@ discard block |
||
| 9347 | 9347 | $hour_array = array(); |
| 9348 | 9348 | $temp_array = array(); |
| 9349 | 9349 | |
| 9350 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9350 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9351 | 9351 | { |
| 9352 | 9352 | $temp_array['hour_name'] = $row['hour_name']; |
| 9353 | 9353 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9366,14 +9366,14 @@ discard block |
||
| 9366 | 9366 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 9367 | 9367 | { |
| 9368 | 9368 | global $global_query, $globalDBdriver, $globalTimezone; |
| 9369 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9369 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9370 | 9370 | date_default_timezone_set('UTC'); |
| 9371 | 9371 | $limit_query = ''; |
| 9372 | 9372 | if ($limit != "") |
| 9373 | 9373 | { |
| 9374 | 9374 | $limit_array = explode(",", $limit); |
| 9375 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 9376 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 9375 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 9376 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 9377 | 9377 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 9378 | 9378 | { |
| 9379 | 9379 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -9426,7 +9426,7 @@ discard block |
||
| 9426 | 9426 | GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH') |
| 9427 | 9427 | HAVING count(spotter_output.ident) > 5$orderby_query"; |
| 9428 | 9428 | //echo $query; |
| 9429 | - $spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone)); |
|
| 9429 | + $spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone)); |
|
| 9430 | 9430 | /* |
| 9431 | 9431 | $sth = $this->db->prepare($query); |
| 9432 | 9432 | $sth->execute(array(':timezone' => $globalTimezone)); |
@@ -9445,9 +9445,9 @@ discard block |
||
| 9445 | 9445 | */ |
| 9446 | 9446 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 9447 | 9447 | { |
| 9448 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 9448 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 9449 | 9449 | |
| 9450 | - $query = "SELECT spotter_output.spotter_id |
|
| 9450 | + $query = "SELECT spotter_output.spotter_id |
|
| 9451 | 9451 | FROM spotter_output |
| 9452 | 9452 | WHERE spotter_output.flightaware_id = '".$flightaware_id."'"; |
| 9453 | 9453 | |
@@ -9455,7 +9455,7 @@ discard block |
||
| 9455 | 9455 | $sth = $this->db->prepare($query); |
| 9456 | 9456 | $sth->execute(); |
| 9457 | 9457 | |
| 9458 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9458 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9459 | 9459 | { |
| 9460 | 9460 | return $row['spotter_id']; |
| 9461 | 9461 | } |
@@ -9480,23 +9480,23 @@ discard block |
||
| 9480 | 9480 | } |
| 9481 | 9481 | |
| 9482 | 9482 | $current_date = date("Y-m-d H:i:s"); |
| 9483 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
| 9483 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
| 9484 | 9484 | |
| 9485 | 9485 | $diff = abs(strtotime($current_date) - strtotime($date)); |
| 9486 | 9486 | |
| 9487 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
| 9487 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
| 9488 | 9488 | $years = $time_array['years']; |
| 9489 | 9489 | |
| 9490 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
| 9490 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
| 9491 | 9491 | $months = $time_array['months']; |
| 9492 | 9492 | |
| 9493 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
| 9493 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
| 9494 | 9494 | $days = $time_array['days']; |
| 9495 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
| 9495 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
| 9496 | 9496 | $hours = $time_array['hours']; |
| 9497 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
| 9497 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
| 9498 | 9498 | $minutes = $time_array['minutes']; |
| 9499 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 9499 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 9500 | 9500 | |
| 9501 | 9501 | return $time_array; |
| 9502 | 9502 | } |
@@ -9522,63 +9522,63 @@ discard block |
||
| 9522 | 9522 | $temp_array['direction_degree'] = $direction; |
| 9523 | 9523 | $temp_array['direction_shortname'] = "N"; |
| 9524 | 9524 | $temp_array['direction_fullname'] = "North"; |
| 9525 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
| 9525 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
| 9526 | 9526 | $temp_array['direction_degree'] = $direction; |
| 9527 | 9527 | $temp_array['direction_shortname'] = "NNE"; |
| 9528 | 9528 | $temp_array['direction_fullname'] = "North-Northeast"; |
| 9529 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
| 9529 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
| 9530 | 9530 | $temp_array['direction_degree'] = $direction; |
| 9531 | 9531 | $temp_array['direction_shortname'] = "NE"; |
| 9532 | 9532 | $temp_array['direction_fullname'] = "Northeast"; |
| 9533 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
| 9533 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
| 9534 | 9534 | $temp_array['direction_degree'] = $direction; |
| 9535 | 9535 | $temp_array['direction_shortname'] = "ENE"; |
| 9536 | 9536 | $temp_array['direction_fullname'] = "East-Northeast"; |
| 9537 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
| 9537 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
| 9538 | 9538 | $temp_array['direction_degree'] = $direction; |
| 9539 | 9539 | $temp_array['direction_shortname'] = "E"; |
| 9540 | 9540 | $temp_array['direction_fullname'] = "East"; |
| 9541 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
| 9541 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
| 9542 | 9542 | $temp_array['direction_degree'] = $direction; |
| 9543 | 9543 | $temp_array['direction_shortname'] = "ESE"; |
| 9544 | 9544 | $temp_array['direction_fullname'] = "East-Southeast"; |
| 9545 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
| 9545 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
| 9546 | 9546 | $temp_array['direction_degree'] = $direction; |
| 9547 | 9547 | $temp_array['direction_shortname'] = "SE"; |
| 9548 | 9548 | $temp_array['direction_fullname'] = "Southeast"; |
| 9549 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
| 9549 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
| 9550 | 9550 | $temp_array['direction_degree'] = $direction; |
| 9551 | 9551 | $temp_array['direction_shortname'] = "SSE"; |
| 9552 | 9552 | $temp_array['direction_fullname'] = "South-Southeast"; |
| 9553 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
| 9553 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
| 9554 | 9554 | $temp_array['direction_degree'] = $direction; |
| 9555 | 9555 | $temp_array['direction_shortname'] = "S"; |
| 9556 | 9556 | $temp_array['direction_fullname'] = "South"; |
| 9557 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
| 9557 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
| 9558 | 9558 | $temp_array['direction_degree'] = $direction; |
| 9559 | 9559 | $temp_array['direction_shortname'] = "SSW"; |
| 9560 | 9560 | $temp_array['direction_fullname'] = "South-Southwest"; |
| 9561 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
| 9561 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
| 9562 | 9562 | $temp_array['direction_degree'] = $direction; |
| 9563 | 9563 | $temp_array['direction_shortname'] = "SW"; |
| 9564 | 9564 | $temp_array['direction_fullname'] = "Southwest"; |
| 9565 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
| 9565 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
| 9566 | 9566 | $temp_array['direction_degree'] = $direction; |
| 9567 | 9567 | $temp_array['direction_shortname'] = "WSW"; |
| 9568 | 9568 | $temp_array['direction_fullname'] = "West-Southwest"; |
| 9569 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
| 9569 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
| 9570 | 9570 | $temp_array['direction_degree'] = $direction; |
| 9571 | 9571 | $temp_array['direction_shortname'] = "W"; |
| 9572 | 9572 | $temp_array['direction_fullname'] = "West"; |
| 9573 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
| 9573 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
| 9574 | 9574 | $temp_array['direction_degree'] = $direction; |
| 9575 | 9575 | $temp_array['direction_shortname'] = "WNW"; |
| 9576 | 9576 | $temp_array['direction_fullname'] = "West-Northwest"; |
| 9577 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
| 9577 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
| 9578 | 9578 | $temp_array['direction_degree'] = $direction; |
| 9579 | 9579 | $temp_array['direction_shortname'] = "NW"; |
| 9580 | 9580 | $temp_array['direction_fullname'] = "Northwest"; |
| 9581 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
| 9581 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
| 9582 | 9582 | $temp_array['direction_degree'] = $direction; |
| 9583 | 9583 | $temp_array['direction_shortname'] = "NNW"; |
| 9584 | 9584 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -9631,9 +9631,9 @@ discard block |
||
| 9631 | 9631 | */ |
| 9632 | 9632 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
| 9633 | 9633 | { |
| 9634 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 9634 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 9635 | 9635 | |
| 9636 | - $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
| 9636 | + $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
| 9637 | 9637 | |
| 9638 | 9638 | $sth = $this->db->prepare($query); |
| 9639 | 9639 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9656,9 +9656,9 @@ discard block |
||
| 9656 | 9656 | */ |
| 9657 | 9657 | public function getAircraftTypeBymodeS($aircraft_modes) |
| 9658 | 9658 | { |
| 9659 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 9659 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 9660 | 9660 | |
| 9661 | - $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
| 9661 | + $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
| 9662 | 9662 | |
| 9663 | 9663 | $sth = $this->db->prepare($query); |
| 9664 | 9664 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9679,11 +9679,11 @@ discard block |
||
| 9679 | 9679 | * @param Float $longitude longitute of the flight |
| 9680 | 9680 | * @return String the countrie |
| 9681 | 9681 | */ |
| 9682 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
| 9682 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
| 9683 | 9683 | { |
| 9684 | 9684 | global $globalDBdriver, $globalDebug; |
| 9685 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 9686 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 9685 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 9686 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 9687 | 9687 | |
| 9688 | 9688 | $Connection = new Connection($this->db); |
| 9689 | 9689 | if (!$Connection->tableExists('countries')) return ''; |
@@ -9723,19 +9723,19 @@ discard block |
||
| 9723 | 9723 | */ |
| 9724 | 9724 | public function convertAircraftRegistration($registration) |
| 9725 | 9725 | { |
| 9726 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 9726 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 9727 | 9727 | $registration_prefix = ''; |
| 9728 | 9728 | $registration_1 = substr($registration, 0, 1); |
| 9729 | 9729 | $registration_2 = substr($registration, 0, 2); |
| 9730 | 9730 | |
| 9731 | 9731 | //first get the prefix based on two characters |
| 9732 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 9732 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 9733 | 9733 | |
| 9734 | 9734 | |
| 9735 | 9735 | $sth = $this->db->prepare($query); |
| 9736 | 9736 | $sth->execute(array(':registration_2' => $registration_2)); |
| 9737 | 9737 | |
| 9738 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9738 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9739 | 9739 | { |
| 9740 | 9740 | $registration_prefix = $row['registration_prefix']; |
| 9741 | 9741 | } |
@@ -9743,11 +9743,11 @@ discard block |
||
| 9743 | 9743 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 9744 | 9744 | if ($registration_prefix == '') |
| 9745 | 9745 | { |
| 9746 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 9746 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 9747 | 9747 | $sth = $this->db->prepare($query); |
| 9748 | 9748 | $sth->execute(array(':registration_1' => $registration_1)); |
| 9749 | 9749 | |
| 9750 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9750 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9751 | 9751 | { |
| 9752 | 9752 | $registration_prefix = $row['registration_prefix']; |
| 9753 | 9753 | } |
@@ -9761,7 +9761,7 @@ discard block |
||
| 9761 | 9761 | } else { |
| 9762 | 9762 | $registration = preg_replace("/^(.{1})/", "$1-", $registration); |
| 9763 | 9763 | } |
| 9764 | - } else if(strlen($registration_prefix) == 2){ |
|
| 9764 | + } else if (strlen($registration_prefix) == 2) { |
|
| 9765 | 9765 | if (0 === strpos($registration, 'N')) { |
| 9766 | 9766 | $registration = preg_replace("/^(.{2})/", "$1", $registration); |
| 9767 | 9767 | } else { |
@@ -9780,17 +9780,17 @@ discard block |
||
| 9780 | 9780 | */ |
| 9781 | 9781 | public function countryFromAircraftRegistration($registration) |
| 9782 | 9782 | { |
| 9783 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 9783 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 9784 | 9784 | |
| 9785 | 9785 | $registration_prefix = ''; |
| 9786 | - $registration_test = explode('-',$registration); |
|
| 9786 | + $registration_test = explode('-', $registration); |
|
| 9787 | 9787 | $country = ''; |
| 9788 | 9788 | if ($registration_test[0] != $registration) { |
| 9789 | 9789 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
| 9790 | 9790 | |
| 9791 | 9791 | $sth = $this->db->prepare($query); |
| 9792 | 9792 | $sth->execute(array(':registration_1' => $registration_test[0])); |
| 9793 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9793 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9794 | 9794 | { |
| 9795 | 9795 | //$registration_prefix = $row['registration_prefix']; |
| 9796 | 9796 | $country = $row['country']; |
@@ -9801,13 +9801,13 @@ discard block |
||
| 9801 | 9801 | |
| 9802 | 9802 | $country = ''; |
| 9803 | 9803 | //first get the prefix based on two characters |
| 9804 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 9804 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 9805 | 9805 | |
| 9806 | 9806 | |
| 9807 | 9807 | $sth = $this->db->prepare($query); |
| 9808 | 9808 | $sth->execute(array(':registration_2' => $registration_2)); |
| 9809 | 9809 | |
| 9810 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9810 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9811 | 9811 | { |
| 9812 | 9812 | $registration_prefix = $row['registration_prefix']; |
| 9813 | 9813 | $country = $row['country']; |
@@ -9816,12 +9816,12 @@ discard block |
||
| 9816 | 9816 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 9817 | 9817 | if ($registration_prefix == "") |
| 9818 | 9818 | { |
| 9819 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 9819 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 9820 | 9820 | |
| 9821 | 9821 | $sth = $this->db->prepare($query); |
| 9822 | 9822 | $sth->execute(array(':registration_1' => $registration_1)); |
| 9823 | 9823 | |
| 9824 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9824 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9825 | 9825 | { |
| 9826 | 9826 | //$registration_prefix = $row['registration_prefix']; |
| 9827 | 9827 | $country = $row['country']; |
@@ -9838,9 +9838,9 @@ discard block |
||
| 9838 | 9838 | * @param String $flightaware_id flightaware_id from spotter_output table |
| 9839 | 9839 | * @param String $highlight New highlight value |
| 9840 | 9840 | */ |
| 9841 | - public function setHighlightFlight($flightaware_id,$highlight) { |
|
| 9841 | + public function setHighlightFlight($flightaware_id, $highlight) { |
|
| 9842 | 9842 | |
| 9843 | - $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 9843 | + $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 9844 | 9844 | $sth = $this->db->prepare($query); |
| 9845 | 9845 | $sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight)); |
| 9846 | 9846 | } |
@@ -9869,7 +9869,7 @@ discard block |
||
| 9869 | 9869 | |
| 9870 | 9870 | $bitly_data = json_decode($bitly_data); |
| 9871 | 9871 | $bitly_url = ''; |
| 9872 | - if ($bitly_data->status_txt = "OK"){ |
|
| 9872 | + if ($bitly_data->status_txt = "OK") { |
|
| 9873 | 9873 | $bitly_url = $bitly_data->data->url; |
| 9874 | 9874 | } |
| 9875 | 9875 | |
@@ -9879,7 +9879,7 @@ discard block |
||
| 9879 | 9879 | |
| 9880 | 9880 | public function getOrderBy() |
| 9881 | 9881 | { |
| 9882 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
| 9882 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
| 9883 | 9883 | |
| 9884 | 9884 | return $orderby; |
| 9885 | 9885 | |
@@ -10013,14 +10013,14 @@ discard block |
||
| 10013 | 10013 | } |
| 10014 | 10014 | $sth = $this->db->prepare($query); |
| 10015 | 10015 | $sth->execute(); |
| 10016 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10016 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10017 | 10017 | { |
| 10018 | 10018 | $departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']); |
| 10019 | 10019 | $arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']); |
| 10020 | 10020 | if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) { |
| 10021 | - $update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
| 10021 | + $update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
| 10022 | 10022 | $sthu = $this->db->prepare($update_query); |
| 10023 | - $sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
| 10023 | + $sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
| 10024 | 10024 | } |
| 10025 | 10025 | } |
| 10026 | 10026 | |
@@ -10033,7 +10033,7 @@ discard block |
||
| 10033 | 10033 | } |
| 10034 | 10034 | $sth = $this->db->prepare($query); |
| 10035 | 10035 | $sth->execute(); |
| 10036 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10036 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10037 | 10037 | { |
| 10038 | 10038 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 10039 | 10039 | { |
@@ -10042,11 +10042,11 @@ discard block |
||
| 10042 | 10042 | elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 10043 | 10043 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 10044 | 10044 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 10045 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 10045 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 10046 | 10046 | if (isset($airline_array[0]['name'])) { |
| 10047 | - $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10047 | + $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10048 | 10048 | $sthu = $this->db->prepare($update_query); |
| 10049 | - $sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
| 10049 | + $sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
| 10050 | 10050 | } |
| 10051 | 10051 | } |
| 10052 | 10052 | } |
@@ -10066,18 +10066,18 @@ discard block |
||
| 10066 | 10066 | } |
| 10067 | 10067 | $sth = $this->db->prepare($query); |
| 10068 | 10068 | $sth->execute(); |
| 10069 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10069 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10070 | 10070 | { |
| 10071 | 10071 | if ($row['aircraft_icao'] != '') { |
| 10072 | 10072 | $aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']); |
| 10073 | - if ($row['registration'] != ""){ |
|
| 10073 | + if ($row['registration'] != "") { |
|
| 10074 | 10074 | $image_array = $Image->getSpotterImage($row['registration']); |
| 10075 | 10075 | if (!isset($image_array[0]['registration'])) { |
| 10076 | 10076 | $Image->addSpotterImage($row['registration']); |
| 10077 | 10077 | } |
| 10078 | 10078 | } |
| 10079 | 10079 | if (count($aircraft_name) > 0) { |
| 10080 | - $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10080 | + $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10081 | 10081 | $sthu = $this->db->prepare($update_query); |
| 10082 | 10082 | $sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id'])); |
| 10083 | 10083 | } |
@@ -10092,10 +10092,10 @@ discard block |
||
| 10092 | 10092 | $query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output"; |
| 10093 | 10093 | $sth = $this->db->prepare($query); |
| 10094 | 10094 | $sth->execute(); |
| 10095 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10095 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10096 | 10096 | { |
| 10097 | 10097 | if ($row['last_latitude'] != '' && $row['last_longitude'] != '') { |
| 10098 | - $closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist); |
|
| 10098 | + $closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist); |
|
| 10099 | 10099 | $airport_icao = ''; |
| 10100 | 10100 | if (isset($closestAirports[0])) { |
| 10101 | 10101 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
@@ -10109,7 +10109,7 @@ discard block |
||
| 10109 | 10109 | break; |
| 10110 | 10110 | } |
| 10111 | 10111 | } |
| 10112 | - } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
|
| 10112 | + } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) { |
|
| 10113 | 10113 | $airport_icao = $closestAirports[0]['icao']; |
| 10114 | 10114 | if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
| 10115 | 10115 | } else { |
@@ -10120,28 +10120,28 @@ discard block |
||
| 10120 | 10120 | } |
| 10121 | 10121 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 10122 | 10122 | if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
| 10123 | - $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 10123 | + $update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 10124 | 10124 | $sthu = $this->db->prepare($update_query); |
| 10125 | - $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
|
| 10125 | + $sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id'])); |
|
| 10126 | 10126 | } |
| 10127 | 10127 | } |
| 10128 | 10128 | } |
| 10129 | 10129 | } |
| 10130 | 10130 | |
| 10131 | - public function closestAirports($origLat,$origLon,$dist = 10) { |
|
| 10131 | + public function closestAirports($origLat, $origLon, $dist = 10) { |
|
| 10132 | 10132 | global $globalDBdriver; |
| 10133 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 10133 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 10134 | 10134 | /* |
| 10135 | 10135 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
| 10136 | 10136 | FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10137 | 10137 | having distance < $dist ORDER BY distance limit 100;"; |
| 10138 | 10138 | */ |
| 10139 | 10139 | if ($globalDBdriver == 'mysql') { |
| 10140 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
| 10140 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
| 10141 | 10141 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10142 | 10142 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 10143 | 10143 | } else { |
| 10144 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
| 10144 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
| 10145 | 10145 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10146 | 10146 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 10147 | 10147 | } |