@@ -9,16 +9,16 @@ discard block |
||
| 9 | 9 | require_once(dirname(__FILE__).'/class.Source.php'); |
| 10 | 10 | |
| 11 | 11 | class SpotterImport { |
| 12 | - private $all_flights = array(); |
|
| 13 | - private $last_delete_hourly = 0; |
|
| 14 | - private $last_delete = 0; |
|
| 15 | - private $stats = array(); |
|
| 16 | - private $tmd = 0; |
|
| 17 | - private $source_location = array(); |
|
| 18 | - public $db = null; |
|
| 19 | - public $nb = 0; |
|
| 20 | - |
|
| 21 | - public function __construct($dbc = null) { |
|
| 12 | + private $all_flights = array(); |
|
| 13 | + private $last_delete_hourly = 0; |
|
| 14 | + private $last_delete = 0; |
|
| 15 | + private $stats = array(); |
|
| 16 | + private $tmd = 0; |
|
| 17 | + private $source_location = array(); |
|
| 18 | + public $db = null; |
|
| 19 | + public $nb = 0; |
|
| 20 | + |
|
| 21 | + public function __construct($dbc = null) { |
|
| 22 | 22 | global $globalBeta; |
| 23 | 23 | $Connection = new Connection($dbc); |
| 24 | 24 | $this->db = $Connection->db(); |
@@ -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) { |
|
| 33 | - $type = $srcst['stats_type']; |
|
| 32 | + foreach($sourcestat as $srcst) { |
|
| 33 | + $type = $srcst['stats_type']; |
|
| 34 | 34 | if ($type == 'polar' || $type == 'hist') { |
| 35 | - $source = $srcst['source_name']; |
|
| 36 | - $data = $srcst['source_data']; |
|
| 37 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 38 | - } |
|
| 39 | - } |
|
| 35 | + $source = $srcst['source_name']; |
|
| 36 | + $data = $srcst['source_data']; |
|
| 37 | + $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 38 | + } |
|
| 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 | |
@@ -59,35 +59,35 @@ discard block |
||
| 59 | 59 | $Translation = new Translation($dbc); |
| 60 | 60 | $operator = $Spotter->getOperator($ident); |
| 61 | 61 | if ($Schedule->checkSchedule($operator) == 0) { |
| 62 | - $operator = $Translation->checkTranslation($ident); |
|
| 63 | - if ($Schedule->checkSchedule($operator) == 0) { |
|
| 62 | + $operator = $Translation->checkTranslation($ident); |
|
| 63 | + if ($Schedule->checkSchedule($operator) == 0) { |
|
| 64 | 64 | $schedule = $Schedule->fetchSchedule($operator); |
| 65 | 65 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 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'])); |
|
| 69 | - // Should also check if route schedule = route from DB |
|
| 70 | - if ($schedule['DepartureAirportIATA'] != '') { |
|
| 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'])); |
|
| 69 | + // Should also check if route schedule = route from DB |
|
| 70 | + if ($schedule['DepartureAirportIATA'] != '') { |
|
| 71 | 71 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
| 72 | - $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
| 73 | - if ($airport_icao != '') { |
|
| 72 | + $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
| 73 | + if ($airport_icao != '') { |
|
| 74 | 74 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
| 75 | 75 | if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
| 76 | - } |
|
| 76 | + } |
|
| 77 | + } |
|
| 77 | 78 | } |
| 78 | - } |
|
| 79 | - if ($schedule['ArrivalAirportIATA'] != '') { |
|
| 79 | + if ($schedule['ArrivalAirportIATA'] != '') { |
|
| 80 | 80 | if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) { |
| 81 | - $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
| 82 | - if ($airport_icao != '') { |
|
| 81 | + $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
| 82 | + if ($airport_icao != '') { |
|
| 83 | 83 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
| 84 | 84 | if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
| 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 | } |
| 92 | 92 | // close connection, at least one way will work ? |
| 93 | 93 | |
@@ -105,92 +105,92 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | */ |
| 107 | 107 | } |
| 108 | - } |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - public function checkAll() { |
|
| 110 | + public function checkAll() { |
|
| 111 | 111 | global $globalDebug; |
| 112 | 112 | if ($globalDebug) echo "Update last seen flights data...\n"; |
| 113 | 113 | foreach ($this->all_flights as $key => $flight) { |
| 114 | - if (isset($this->all_flights[$key]['id'])) { |
|
| 114 | + if (isset($this->all_flights[$key]['id'])) { |
|
| 115 | 115 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 116 | - $Spotter = new Spotter($this->db); |
|
| 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']); |
|
| 119 | - } |
|
| 116 | + $Spotter = new Spotter($this->db); |
|
| 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']); |
|
| 119 | + } |
|
| 120 | + } |
|
| 120 | 121 | } |
| 121 | - } |
|
| 122 | 122 | |
| 123 | - public function arrival($key) { |
|
| 123 | + public function arrival($key) { |
|
| 124 | 124 | global $globalClosestMinDist, $globalDebug; |
| 125 | 125 | if ($globalDebug) echo 'Update arrival...'."\n"; |
| 126 | 126 | $Spotter = new Spotter($this->db); |
| 127 | - $airport_icao = ''; |
|
| 128 | - $airport_time = ''; |
|
| 129 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 127 | + $airport_icao = ''; |
|
| 128 | + $airport_time = ''; |
|
| 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); |
|
| 132 | - if (isset($closestAirports[0])) { |
|
| 133 | - if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
| 134 | - $airport_icao = $closestAirports[0]['icao']; |
|
| 135 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 136 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 137 | - } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
| 138 | - foreach ($closestAirports as $airport) { |
|
| 139 | - if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
| 140 | - $airport_icao = $airport['icao']; |
|
| 141 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 142 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 143 | - break; |
|
| 144 | - } |
|
| 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))) { |
|
| 147 | - $airport_icao = $closestAirports[0]['icao']; |
|
| 148 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 149 | - } else { |
|
| 150 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 151 | - } |
|
| 152 | - } else { |
|
| 153 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - } else { |
|
| 157 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 158 | - } |
|
| 159 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - |
|
| 163 | - |
|
| 164 | - public function del() { |
|
| 131 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 132 | + if (isset($closestAirports[0])) { |
|
| 133 | + if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
| 134 | + $airport_icao = $closestAirports[0]['icao']; |
|
| 135 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 136 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 137 | + } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
| 138 | + foreach ($closestAirports as $airport) { |
|
| 139 | + if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
| 140 | + $airport_icao = $airport['icao']; |
|
| 141 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 142 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 143 | + break; |
|
| 144 | + } |
|
| 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))) { |
|
| 147 | + $airport_icao = $closestAirports[0]['icao']; |
|
| 148 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 149 | + } else { |
|
| 150 | + if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 151 | + } |
|
| 152 | + } else { |
|
| 153 | + if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + } else { |
|
| 157 | + if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 158 | + } |
|
| 159 | + return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + |
|
| 163 | + |
|
| 164 | + public function del() { |
|
| 165 | 165 | global $globalDebug; |
| 166 | 166 | // Delete old infos |
| 167 | 167 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 168 | 168 | foreach ($this->all_flights as $key => $flight) { |
| 169 | - if (isset($flight['lastupdate'])) { |
|
| 170 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 171 | - if (isset($this->all_flights[$key]['id'])) { |
|
| 172 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 169 | + if (isset($flight['lastupdate'])) { |
|
| 170 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
| 171 | + if (isset($this->all_flights[$key]['id'])) { |
|
| 172 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 173 | 173 | /* |
| 174 | 174 | $SpotterLive = new SpotterLive(); |
| 175 | 175 | $SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']); |
| 176 | 176 | $SpotterLive->db = null; |
| 177 | 177 | */ |
| 178 | - $real_arrival = $this->arrival($key); |
|
| 179 | - $Spotter = new Spotter($this->db); |
|
| 180 | - if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
|
| 178 | + $real_arrival = $this->arrival($key); |
|
| 179 | + $Spotter = new Spotter($this->db); |
|
| 180 | + if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
|
| 181 | 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 |
| 185 | 185 | // $Spotter->db = null; |
| 186 | - } |
|
| 187 | - unset($this->all_flights[$key]); |
|
| 188 | - } |
|
| 189 | - } |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - public function add($line) { |
|
| 186 | + } |
|
| 187 | + unset($this->all_flights[$key]); |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + public function add($line) { |
|
| 194 | 194 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights; |
| 195 | 195 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
| 196 | 196 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
@@ -215,18 +215,18 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | // SBS format is CSV format |
| 217 | 217 | if(is_array($line) && isset($line['hex'])) { |
| 218 | - //print_r($line); |
|
| 219 | - if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
|
| 218 | + //print_r($line); |
|
| 219 | + if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
|
| 220 | 220 | |
| 221 | 221 | // Increment message number |
| 222 | 222 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 223 | - $current_date = date('Y-m-d'); |
|
| 224 | - $source = $line['source_name']; |
|
| 225 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 226 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 227 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 228 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 229 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 223 | + $current_date = date('Y-m-d'); |
|
| 224 | + $source = $line['source_name']; |
|
| 225 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 226 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 227 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 228 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 229 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /* |
@@ -242,17 +242,17 @@ discard block |
||
| 242 | 242 | //$this->db = $dbc; |
| 243 | 243 | |
| 244 | 244 | $hex = trim($line['hex']); |
| 245 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 246 | - else $id = trim($line['id']); |
|
| 245 | + if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 246 | + else $id = trim($line['id']); |
|
| 247 | 247 | |
| 248 | 248 | //print_r($this->all_flights); |
| 249 | 249 | if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) { |
| 250 | - $this->all_flights[$id] = array('hex' => $hex); |
|
| 251 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 252 | - //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
| 250 | + $this->all_flights[$id] = array('hex' => $hex); |
|
| 251 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 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 | - //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 255 | - if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) { |
|
| 254 | + //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 255 | + if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) { |
|
| 256 | 256 | |
| 257 | 257 | $timeelapsed = microtime(true); |
| 258 | 258 | $Spotter = new Spotter($this->db); |
@@ -261,38 +261,38 @@ discard block |
||
| 261 | 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 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
| 265 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
| 266 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
| 267 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
| 264 | + if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
| 265 | + elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
| 266 | + elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
| 267 | + elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
| 268 | 268 | } |
| 269 | 269 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
| 270 | - } else if (isset($line['aircraft_name'])) { |
|
| 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 | 275 | if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
| 276 | 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 | - if (!isset($line['id'])) { |
|
| 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 | + 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 | 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 | - //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'])); |
|
| 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'])); |
|
| 287 | 287 | |
| 288 | - if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
| 289 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 288 | + if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
| 289 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 293 | - if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
| 293 | + if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
| 294 | 294 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 295 | - } else { |
|
| 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"; |
| 298 | 298 | /* |
@@ -301,38 +301,38 @@ discard block |
||
| 301 | 301 | print_r($line); |
| 302 | 302 | */ |
| 303 | 303 | return ''; |
| 304 | - } |
|
| 304 | + } |
|
| 305 | 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']))); |
|
| 322 | - if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 321 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 322 | + if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 323 | 323 | $timeelapsed = microtime(true); |
| 324 | - $Spotter = new Spotter($this->db); |
|
| 325 | - $fromsource = NULL; |
|
| 326 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 327 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 324 | + $Spotter = new Spotter($this->db); |
|
| 325 | + $fromsource = NULL; |
|
| 326 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 327 | + elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 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 | 334 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 335 | - } |
|
| 335 | + } |
|
| 336 | 336 | |
| 337 | 337 | /* |
| 338 | 338 | if (!isset($line['id'])) { |
@@ -342,26 +342,26 @@ 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 | - //$putinarchive = true; |
|
| 348 | - if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
| 347 | + //$putinarchive = true; |
|
| 348 | + if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
| 349 | 349 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
| 350 | - } |
|
| 351 | - if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
| 350 | + } |
|
| 351 | + if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
| 352 | 352 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
| 353 | - } |
|
| 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' => '')); |
|
| 356 | - } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
| 353 | + } |
|
| 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' => '')); |
|
| 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' => '')); |
|
| 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 | 362 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 363 | 363 | |
| 364 | - } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
| 364 | + } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
| 365 | 365 | $timeelapsed = microtime(true); |
| 366 | 366 | $Spotter = new Spotter($this->db); |
| 367 | 367 | $route = $Spotter->getRouteInfo(trim($line['ident'])); |
@@ -375,43 +375,43 @@ discard block |
||
| 375 | 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 | - //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
| 379 | - if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
| 378 | + //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
| 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'])); |
|
| 382 | - } |
|
| 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 | + } |
|
| 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 | 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)); |
|
| 395 | - //$dataFound = 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 | + //$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'); |
|
| 398 | - if ($distance > 1000 && $distance < 10000) { |
|
| 399 | - // use datetime |
|
| 397 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 398 | + if ($distance > 1000 && $distance < 10000) { |
|
| 399 | + // use datetime |
|
| 400 | 400 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 401 | 401 | $speed = $speed*3.6; |
| 402 | 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 | } |
| 406 | 406 | |
| 407 | 407 | |
| 408 | 408 | |
| 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']); |
|
| 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')))) { |
|
| 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']); |
|
| 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')))) { |
|
| 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; |
@@ -425,16 +425,16 @@ discard block |
||
| 425 | 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 | + } |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 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) { |
|
| 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 | 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 | - $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
| 436 | - $dataFound = true; |
|
| 437 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 435 | + $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
| 436 | + $dataFound = true; |
|
| 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 | 440 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
@@ -445,20 +445,20 @@ discard block |
||
| 445 | 445 | //$putinarchive = true; |
| 446 | 446 | } |
| 447 | 447 | */ |
| 448 | - /* |
|
| 448 | + /* |
|
| 449 | 449 | } elseif (isset($this->all_flights[$id]['latitude'])) { |
| 450 | 450 | if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n"; |
| 451 | 451 | } |
| 452 | 452 | */ |
| 453 | 453 | } |
| 454 | 454 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 455 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 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) { |
|
| 455 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 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 | 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 | - $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
| 460 | - $dataFound = true; |
|
| 461 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 459 | + $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
| 460 | + $dataFound = true; |
|
| 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 | 464 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
@@ -476,53 +476,53 @@ discard block |
||
| 476 | 476 | */ |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | - } else if ($globalDebug && $timediff > 20) { |
|
| 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 | 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 | 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 | - 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'])); |
|
| 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'])); |
|
| 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'])); |
|
| 493 | - //$dataFound = true; |
|
| 492 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 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'])); |
|
| 503 | - //$dataFound = true; |
|
| 502 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 503 | + //$dataFound = true; |
|
| 504 | 504 | } |
| 505 | 505 | if (isset($line['ground']) && $line['ground'] != '') { |
| 506 | - if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
| 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 | 508 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 509 | 509 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 510 | 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'])); |
|
| 511 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 512 | 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 | - } |
|
| 514 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 515 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 516 | - //$dataFound = true; |
|
| 513 | + } |
|
| 514 | + if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 515 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 516 | + //$dataFound = true; |
|
| 517 | 517 | } |
| 518 | 518 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 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'])); |
|
| 521 | - $highlight = ''; |
|
| 522 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 523 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 524 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 525 | - if ($highlight != '') { |
|
| 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'])); |
|
| 521 | + $highlight = ''; |
|
| 522 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 523 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 524 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 525 | + if ($highlight != '') { |
|
| 526 | 526 | $timeelapsed = microtime(true); |
| 527 | 527 | $Spotter = new Spotter($this->db); |
| 528 | 528 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
@@ -532,38 +532,38 @@ discard block |
||
| 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'])); |
|
| 538 | - //$dataFound = true; |
|
| 537 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 538 | + //$dataFound = true; |
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 542 | - //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 542 | + //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 543 | 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 | 544 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
| 545 | 545 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
| 546 | 546 | //$dataFound = true; |
| 547 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 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)); |
|
| 558 | - //$dataFound = 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 | + //$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; |
|
| 563 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 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 | + 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 | - // If not enough messages and ACARS set heading to 0 |
|
| 566 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 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)); |
|
| 567 | 567 | } |
| 568 | 568 | if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 569 | 569 | elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
@@ -574,119 +574,119 @@ discard block |
||
| 574 | 574 | //if ($dataFound == true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 575 | 575 | //if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 576 | 576 | if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
| 577 | - $this->all_flights[$id]['lastupdate'] = time(); |
|
| 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'])) { |
|
| 580 | - //print_r($this->all_flights); |
|
| 581 | - //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
| 582 | - //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
| 583 | - if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
| 577 | + $this->all_flights[$id]['lastupdate'] = time(); |
|
| 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'])) { |
|
| 580 | + //print_r($this->all_flights); |
|
| 581 | + //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
| 582 | + //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
| 583 | + if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
| 584 | 584 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
| 585 | 585 | $timeelapsed = microtime(true); |
| 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 | - $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"; |
|
| 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"; |
|
| 590 | 590 | } elseif (isset($line['id'])) { |
| 591 | - $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
|
| 592 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 591 | + $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
|
| 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 | - $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"; |
|
| 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"; |
|
| 596 | 596 | } else $recent_ident = ''; |
| 597 | 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 | - } else { |
|
| 601 | + } else { |
|
| 602 | 602 | $recent_ident = ''; |
| 603 | 603 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
| 604 | - } |
|
| 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 == "") |
|
| 607 | - { |
|
| 604 | + } |
|
| 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 == "") |
|
| 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 | 613 | foreach($globalAirportIgnore as $airportIgnore) { |
| 614 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 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 | - $ignoreImport = true; |
|
| 620 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 619 | + $ignoreImport = true; |
|
| 620 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 621 | 621 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 622 | - $ignoreImport = false; |
|
| 622 | + $ignoreImport = false; |
|
| 623 | + } |
|
| 623 | 624 | } |
| 624 | - } |
|
| 625 | 625 | } |
| 626 | 626 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 627 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 627 | + foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 628 | 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 | - $ignoreImport = true; |
|
| 629 | + $ignoreImport = true; |
|
| 630 | + } |
|
| 630 | 631 | } |
| 631 | - } |
|
| 632 | 632 | } |
| 633 | 633 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 634 | - $ignoreImport = true; |
|
| 635 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 634 | + $ignoreImport = true; |
|
| 635 | + foreach($globalAirlineAccept as $airlineAccept) { |
|
| 636 | 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 | - $ignoreImport = false; |
|
| 637 | + $ignoreImport = false; |
|
| 638 | + } |
|
| 638 | 639 | } |
| 639 | - } |
|
| 640 | 640 | } |
| 641 | 641 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 642 | - $ignoreImport = true; |
|
| 643 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 642 | + $ignoreImport = true; |
|
| 643 | + foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 644 | 644 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 645 | - $ignoreImport = false; |
|
| 645 | + $ignoreImport = false; |
|
| 646 | + } |
|
| 646 | 647 | } |
| 647 | - } |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | if (!$ignoreImport) { |
| 651 | - $highlight = ''; |
|
| 652 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 653 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 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'))); |
|
| 656 | - $timeelapsed = microtime(true); |
|
| 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']); |
|
| 659 | - $Spotter->db = null; |
|
| 660 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 661 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 651 | + $highlight = ''; |
|
| 652 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 653 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 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'))); |
|
| 656 | + $timeelapsed = microtime(true); |
|
| 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']); |
|
| 659 | + $Spotter->db = null; |
|
| 660 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 661 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 662 | 662 | |
| 663 | - // Add source stat in DB |
|
| 664 | - $Stats = new Stats($this->db); |
|
| 665 | - if (!empty($this->stats)) { |
|
| 663 | + // Add source stat in DB |
|
| 664 | + $Stats = new Stats($this->db); |
|
| 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) { |
|
| 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); |
|
| 672 | - if (isset($sourced['msg'])) { |
|
| 673 | - if (time() - $sourced['msg']['date'] > 10) { |
|
| 674 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 675 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 676 | - unset($this->stats[$date][$source]['msg']); |
|
| 677 | - } |
|
| 678 | - } |
|
| 679 | - } |
|
| 680 | - if ($date != date('Y-m-d')) { |
|
| 681 | - unset($this->stats[$date]); |
|
| 682 | - } |
|
| 683 | - } |
|
| 684 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 685 | - |
|
| 686 | - } |
|
| 687 | - $Stats->db = null; |
|
| 667 | + foreach($this->stats as $date => $data) { |
|
| 668 | + foreach($data as $source => $sourced) { |
|
| 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); |
|
| 672 | + if (isset($sourced['msg'])) { |
|
| 673 | + if (time() - $sourced['msg']['date'] > 10) { |
|
| 674 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 675 | + echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 676 | + unset($this->stats[$date][$source]['msg']); |
|
| 677 | + } |
|
| 678 | + } |
|
| 679 | + } |
|
| 680 | + if ($date != date('Y-m-d')) { |
|
| 681 | + unset($this->stats[$date]); |
|
| 682 | + } |
|
| 683 | + } |
|
| 684 | + if ($globalDebug) echo 'Done'."\n"; |
|
| 685 | + |
|
| 686 | + } |
|
| 687 | + $Stats->db = null; |
|
| 688 | 688 | |
| 689 | - $this->del(); |
|
| 689 | + $this->del(); |
|
| 690 | 690 | } elseif ($globalDebug) echo 'Ignore data'."\n"; |
| 691 | 691 | //$ignoreImport = false; |
| 692 | 692 | $this->all_flights[$id]['addedSpotter'] = 1; |
@@ -704,18 +704,18 @@ discard block |
||
| 704 | 704 | */ |
| 705 | 705 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
| 706 | 706 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 707 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 708 | - //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 709 | - $SpotterLive = new SpotterLive($this->db); |
|
| 710 | - $SpotterLive->deleteLiveSpotterData(); |
|
| 711 | - $SpotterLive->db=null; |
|
| 712 | - if ($globalDebug) echo " Done\n"; |
|
| 713 | - $this->last_delete = time(); |
|
| 707 | + if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 708 | + //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 709 | + $SpotterLive = new SpotterLive($this->db); |
|
| 710 | + $SpotterLive->deleteLiveSpotterData(); |
|
| 711 | + $SpotterLive->db=null; |
|
| 712 | + if ($globalDebug) echo " Done\n"; |
|
| 713 | + $this->last_delete = time(); |
|
| 714 | 714 | } |
| 715 | - } else { |
|
| 715 | + } else { |
|
| 716 | 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 | - $this->all_flights[$id]['id'] = $recent_ident; |
|
| 718 | - $this->all_flights[$id]['addedSpotter'] = 1; |
|
| 717 | + $this->all_flights[$id]['id'] = $recent_ident; |
|
| 718 | + $this->all_flights[$id]['addedSpotter'] = 1; |
|
| 719 | 719 | } |
| 720 | 720 | if (isset($globalDaemon) && !$globalDaemon) { |
| 721 | 721 | $Spotter = new Spotter($this->db); |
@@ -723,14 +723,14 @@ discard block |
||
| 723 | 723 | $Spotter->db = null; |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | - } |
|
| 726 | + } |
|
| 727 | + } |
|
| 727 | 728 | } |
| 728 | - } |
|
| 729 | - //adds the spotter LIVE data |
|
| 730 | - //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
| 731 | - //echo "\nAdd in Live !! \n"; |
|
| 732 | - //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
| 733 | - if ($globalDebug) { |
|
| 729 | + //adds the spotter LIVE data |
|
| 730 | + //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
| 731 | + //echo "\nAdd in Live !! \n"; |
|
| 732 | + //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
| 733 | + if ($globalDebug) { |
|
| 734 | 734 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
| 735 | 735 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
| 736 | 736 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
@@ -738,49 +738,49 @@ discard block |
||
| 738 | 738 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
| 739 | 739 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
| 740 | 740 | } |
| 741 | - } |
|
| 742 | - $ignoreImport = false; |
|
| 743 | - if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
| 744 | - if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
| 741 | + } |
|
| 742 | + $ignoreImport = false; |
|
| 743 | + if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
| 744 | + if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
| 745 | 745 | |
| 746 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 747 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 748 | - $ignoreImport = true; |
|
| 746 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 747 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 748 | + $ignoreImport = true; |
|
| 749 | + } |
|
| 749 | 750 | } |
| 750 | - } |
|
| 751 | - if (count($globalAirportAccept) > 0) { |
|
| 752 | - $ignoreImport = true; |
|
| 753 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 754 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 751 | + if (count($globalAirportAccept) > 0) { |
|
| 752 | + $ignoreImport = true; |
|
| 753 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 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 | - } |
|
| 759 | - if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
| 758 | + } |
|
| 759 | + if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
| 760 | 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)) { |
|
| 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 | - } |
|
| 766 | - if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
| 765 | + } |
|
| 766 | + if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
| 767 | 767 | $ignoreImport = true; |
| 768 | 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)) { |
|
| 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 | - } |
|
| 774 | - if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
| 773 | + } |
|
| 774 | + if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
| 775 | 775 | $ignoreImport = true; |
| 776 | 776 | foreach($globalPilotIdAccept as $pilotIdAccept) { |
| 777 | - if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
| 778 | - $ignoreImport = false; |
|
| 779 | - } |
|
| 777 | + if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
| 778 | + $ignoreImport = false; |
|
| 779 | + } |
|
| 780 | + } |
|
| 780 | 781 | } |
| 781 | - } |
|
| 782 | 782 | |
| 783 | - if (!$ignoreImport) { |
|
| 783 | + if (!$ignoreImport) { |
|
| 784 | 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); |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | if ($stats_heading == 16) $stats_heading = 0; |
| 819 | 819 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 820 | 820 | for ($i=0;$i<=15;$i++) { |
| 821 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 821 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 822 | 822 | } |
| 823 | 823 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
| 824 | 824 | } else { |
@@ -831,11 +831,11 @@ discard block |
||
| 831 | 831 | //var_dump($this->stats); |
| 832 | 832 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 833 | 833 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 834 | - end($this->stats[$current_date][$source]['hist']); |
|
| 835 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 834 | + end($this->stats[$current_date][$source]['hist']); |
|
| 835 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 836 | 836 | } else $mini = 0; |
| 837 | 837 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 838 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 838 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 839 | 839 | } |
| 840 | 840 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
| 841 | 841 | } else { |
@@ -852,22 +852,22 @@ discard block |
||
| 852 | 852 | |
| 853 | 853 | |
| 854 | 854 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 855 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 856 | - $SpotterLive = new SpotterLive($this->db); |
|
| 857 | - $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 858 | - $SpotterLive->db = null; |
|
| 859 | - //SpotterLive->deleteLiveSpotterData(); |
|
| 860 | - if ($globalDebug) echo " Done\n"; |
|
| 861 | - $this->last_delete_hourly = time(); |
|
| 855 | + if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 856 | + $SpotterLive = new SpotterLive($this->db); |
|
| 857 | + $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 858 | + $SpotterLive->db = null; |
|
| 859 | + //SpotterLive->deleteLiveSpotterData(); |
|
| 860 | + if ($globalDebug) echo " Done\n"; |
|
| 861 | + $this->last_delete_hourly = time(); |
|
| 862 | 862 | } |
| 863 | 863 | |
| 864 | - } |
|
| 865 | - //$ignoreImport = false; |
|
| 864 | + } |
|
| 865 | + //$ignoreImport = false; |
|
| 866 | 866 | } |
| 867 | 867 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 868 | 868 | if ($send) return $this->all_flights[$id]; |
| 869 | - } |
|
| 869 | + } |
|
| 870 | + } |
|
| 870 | 871 | } |
| 871 | - } |
|
| 872 | 872 | } |
| 873 | 873 | ?> |
@@ -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 | |
@@ -53,7 +53,9 @@ discard block |
||
| 53 | 53 | $dbc = $this->db; |
| 54 | 54 | $this->all_flights[$id]['schedule_check'] = true; |
| 55 | 55 | if ($globalSchedulesFetch) { |
| 56 | - if ($globalDebug) echo 'Getting schedule info...'."\n"; |
|
| 56 | + if ($globalDebug) { |
|
| 57 | + echo 'Getting schedule info...'."\n"; |
|
| 58 | + } |
|
| 57 | 59 | $Spotter = new Spotter($dbc); |
| 58 | 60 | $Schedule = new Schedule($dbc); |
| 59 | 61 | $Translation = new Translation($dbc); |
@@ -63,7 +65,9 @@ discard block |
||
| 63 | 65 | if ($Schedule->checkSchedule($operator) == 0) { |
| 64 | 66 | $schedule = $Schedule->fetchSchedule($operator); |
| 65 | 67 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 66 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 68 | + if ($globalDebug) { |
|
| 69 | + echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 70 | + } |
|
| 67 | 71 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
| 68 | 72 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
| 69 | 73 | // Should also check if route schedule = route from DB |
@@ -72,7 +76,9 @@ discard block |
||
| 72 | 76 | $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
| 73 | 77 | if ($airport_icao != '') { |
| 74 | 78 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
| 75 | - if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
| 79 | + if ($globalDebug) { |
|
| 80 | + echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
| 81 | + } |
|
| 76 | 82 | } |
| 77 | 83 | } |
| 78 | 84 | } |
@@ -81,7 +87,9 @@ discard block |
||
| 81 | 87 | $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
| 82 | 88 | if ($airport_icao != '') { |
| 83 | 89 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
| 84 | - if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
| 90 | + if ($globalDebug) { |
|
| 91 | + echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
| 92 | + } |
|
| 85 | 93 | } |
| 86 | 94 | } |
| 87 | 95 | } |
@@ -109,7 +117,9 @@ discard block |
||
| 109 | 117 | |
| 110 | 118 | public function checkAll() { |
| 111 | 119 | global $globalDebug; |
| 112 | - if ($globalDebug) echo "Update last seen flights data...\n"; |
|
| 120 | + if ($globalDebug) { |
|
| 121 | + echo "Update last seen flights data...\n"; |
|
| 122 | + } |
|
| 113 | 123 | foreach ($this->all_flights as $key => $flight) { |
| 114 | 124 | if (isset($this->all_flights[$key]['id'])) { |
| 115 | 125 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
@@ -122,24 +132,32 @@ discard block |
||
| 122 | 132 | |
| 123 | 133 | public function arrival($key) { |
| 124 | 134 | global $globalClosestMinDist, $globalDebug; |
| 125 | - if ($globalDebug) echo 'Update arrival...'."\n"; |
|
| 135 | + if ($globalDebug) { |
|
| 136 | + echo 'Update arrival...'."\n"; |
|
| 137 | + } |
|
| 126 | 138 | $Spotter = new Spotter($this->db); |
| 127 | 139 | $airport_icao = ''; |
| 128 | 140 | $airport_time = ''; |
| 129 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 141 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') { |
|
| 142 | + $globalClosestMinDist = 50; |
|
| 143 | + } |
|
| 130 | 144 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 131 | 145 | $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
| 132 | 146 | if (isset($closestAirports[0])) { |
| 133 | 147 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
| 134 | 148 | $airport_icao = $closestAirports[0]['icao']; |
| 135 | 149 | $airport_time = $this->all_flights[$key]['datetime']; |
| 136 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 150 | + if ($globalDebug) { |
|
| 151 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 152 | + } |
|
| 137 | 153 | } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
| 138 | 154 | foreach ($closestAirports as $airport) { |
| 139 | 155 | if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
| 140 | 156 | $airport_icao = $airport['icao']; |
| 141 | 157 | $airport_time = $this->all_flights[$key]['datetime']; |
| 142 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 158 | + if ($globalDebug) { |
|
| 159 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 160 | + } |
|
| 143 | 161 | break; |
| 144 | 162 | } |
| 145 | 163 | } |
@@ -147,14 +165,20 @@ discard block |
||
| 147 | 165 | $airport_icao = $closestAirports[0]['icao']; |
| 148 | 166 | $airport_time = $this->all_flights[$key]['datetime']; |
| 149 | 167 | } else { |
| 150 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 168 | + if ($globalDebug) { |
|
| 169 | + echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 170 | + } |
|
| 151 | 171 | } |
| 152 | 172 | } else { |
| 153 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 173 | + if ($globalDebug) { |
|
| 174 | + echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 175 | + } |
|
| 154 | 176 | } |
| 155 | 177 | |
| 156 | 178 | } else { |
| 157 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 179 | + if ($globalDebug) { |
|
| 180 | + echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 181 | + } |
|
| 158 | 182 | } |
| 159 | 183 | return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
| 160 | 184 | } |
@@ -164,12 +188,16 @@ discard block |
||
| 164 | 188 | public function del() { |
| 165 | 189 | global $globalDebug; |
| 166 | 190 | // Delete old infos |
| 167 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
| 191 | + if ($globalDebug) { |
|
| 192 | + echo 'Delete old values and update latest data...'."\n"; |
|
| 193 | + } |
|
| 168 | 194 | foreach ($this->all_flights as $key => $flight) { |
| 169 | 195 | if (isset($flight['lastupdate'])) { |
| 170 | 196 | if ($flight['lastupdate'] < (time()-3000)) { |
| 171 | 197 | if (isset($this->all_flights[$key]['id'])) { |
| 172 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 198 | + if ($globalDebug) { |
|
| 199 | + echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 200 | + } |
|
| 173 | 201 | /* |
| 174 | 202 | $SpotterLive = new SpotterLive(); |
| 175 | 203 | $SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']); |
@@ -179,7 +207,9 @@ discard block |
||
| 179 | 207 | $Spotter = new Spotter($this->db); |
| 180 | 208 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 181 | 209 | $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 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 210 | + if ($globalDebug && $result != 'success') { |
|
| 211 | + echo '!!! ERROR : '.$result."\n"; |
|
| 212 | + } |
|
| 183 | 213 | } |
| 184 | 214 | // Put in archive |
| 185 | 215 | // $Spotter->db = null; |
@@ -193,8 +223,10 @@ discard block |
||
| 193 | 223 | public function add($line) { |
| 194 | 224 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights; |
| 195 | 225 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
| 196 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
|
| 197 | -/* |
|
| 226 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
| 227 | + $globalCoordMinChange = '0.02'; |
|
| 228 | + } |
|
| 229 | + /* |
|
| 198 | 230 | $Spotter = new Spotter(); |
| 199 | 231 | $dbc = $Spotter->db; |
| 200 | 232 | $SpotterLive = new SpotterLive($dbc); |
@@ -222,11 +254,15 @@ discard block |
||
| 222 | 254 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 223 | 255 | $current_date = date('Y-m-d'); |
| 224 | 256 | $source = $line['source_name']; |
| 225 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 257 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
| 258 | + $source = $line['format_source']; |
|
| 259 | + } |
|
| 226 | 260 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
| 227 | 261 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
| 228 | 262 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
| 229 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 263 | + } else { |
|
| 264 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 265 | + } |
|
| 230 | 266 | } |
| 231 | 267 | |
| 232 | 268 | /* |
@@ -242,8 +278,11 @@ discard block |
||
| 242 | 278 | //$this->db = $dbc; |
| 243 | 279 | |
| 244 | 280 | $hex = trim($line['hex']); |
| 245 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 246 | - else $id = trim($line['id']); |
|
| 281 | + if (!isset($line['id'])) { |
|
| 282 | + $id = trim($line['hex']); |
|
| 283 | + } else { |
|
| 284 | + $id = trim($line['id']); |
|
| 285 | + } |
|
| 247 | 286 | |
| 248 | 287 | //print_r($this->all_flights); |
| 249 | 288 | if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) { |
@@ -258,13 +297,20 @@ discard block |
||
| 258 | 297 | $Spotter = new Spotter($this->db); |
| 259 | 298 | $aircraft_icao = $Spotter->getAllAircraftType($hex); |
| 260 | 299 | $Spotter->db = null; |
| 261 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 300 | + if ($globalDebugTimeElapsed) { |
|
| 301 | + echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 302 | + } |
|
| 262 | 303 | |
| 263 | 304 | if ($aircraft_icao == '' && isset($line['aircraft_type'])) { |
| 264 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
| 265 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
| 266 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
| 267 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
| 305 | + if ($line['aircraft_type'] == 'PARA_GLIDER') { |
|
| 306 | + $aircraft_icao = 'GLID'; |
|
| 307 | + } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') { |
|
| 308 | + $aircraft_icao = 'UHEL'; |
|
| 309 | + } elseif ($line['aircraft_type'] == 'TOW_PLANE') { |
|
| 310 | + $aircraft_icao = 'TOWPLANE'; |
|
| 311 | + } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') { |
|
| 312 | + $aircraft_icao = 'POWAIRC'; |
|
| 313 | + } |
|
| 268 | 314 | } |
| 269 | 315 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
| 270 | 316 | } else if (isset($line['aircraft_name'])) { |
@@ -272,29 +318,47 @@ discard block |
||
| 272 | 318 | $Spotter = new Spotter($this->db); |
| 273 | 319 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 274 | 320 | $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'])); |
|
| 321 | + if ($aircraft_icao != '') { |
|
| 322 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 323 | + } else { |
|
| 324 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
| 325 | + } |
|
| 326 | + } else { |
|
| 327 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
| 328 | + } |
|
| 278 | 329 | $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 | 330 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
| 280 | 331 | if (!isset($line['id'])) { |
| 281 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 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'))); |
|
| 332 | + if (!isset($globalDaemon)) { |
|
| 333 | + $globalDaemon = TRUE; |
|
| 334 | + } |
|
| 335 | + // 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 | 336 | // 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'))); |
|
| 337 | + 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')) { |
|
| 338 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 339 | + } |
|
| 285 | 340 | //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'])); |
|
| 341 | + } else { |
|
| 342 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 343 | + } |
|
| 287 | 344 | |
| 288 | - if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
| 289 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 345 | + if ($globalDebug) { |
|
| 346 | + echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
| 347 | + } |
|
| 348 | + if ($globalAllFlights !== FALSE) { |
|
| 349 | + $dataFound = true; |
|
| 350 | + } |
|
| 290 | 351 | } |
| 291 | 352 | |
| 292 | 353 | if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 293 | 354 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
| 294 | 355 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 295 | 356 | } else { |
| 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 | - 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"; |
|
| 357 | + if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
| 358 | + echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 359 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
| 360 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 361 | + } |
|
| 298 | 362 | /* |
| 299 | 363 | echo strtotime($line['datetime']).' > '.strtotime($this->all_flights[$id]['datetime']); |
| 300 | 364 | print_r($this->all_flights[$id]); |
@@ -302,7 +366,9 @@ discard block |
||
| 302 | 366 | */ |
| 303 | 367 | return ''; |
| 304 | 368 | } |
| 305 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 369 | + } else { |
|
| 370 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 371 | + } |
|
| 306 | 372 | |
| 307 | 373 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
| 308 | 374 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
@@ -323,15 +389,25 @@ discard block |
||
| 323 | 389 | $timeelapsed = microtime(true); |
| 324 | 390 | $Spotter = new Spotter($this->db); |
| 325 | 391 | $fromsource = NULL; |
| 326 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 327 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 328 | - elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 329 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 330 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 392 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 393 | + $fromsource = $globalAirlinesSource; |
|
| 394 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') { |
|
| 395 | + $fromsource = 'vatsim'; |
|
| 396 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') { |
|
| 397 | + $fromsource = 'ivao'; |
|
| 398 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 399 | + $fromsource = 'vatsim'; |
|
| 400 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 401 | + $fromsource = 'ivao'; |
|
| 402 | + } |
|
| 331 | 403 | $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
| 332 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 404 | + if ($globalDebug && $result != 'success') { |
|
| 405 | + echo '!!! ERROR : '.$result."\n"; |
|
| 406 | + } |
|
| 333 | 407 | $Spotter->db = null; |
| 334 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 408 | + if ($globalDebugTimeElapsed) { |
|
| 409 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 410 | + } |
|
| 335 | 411 | } |
| 336 | 412 | |
| 337 | 413 | /* |
@@ -342,7 +418,9 @@ discard block |
||
| 342 | 418 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 343 | 419 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 344 | 420 | */ |
| 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'])); |
|
| 421 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 422 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 423 | + } |
|
| 346 | 424 | |
| 347 | 425 | //$putinarchive = true; |
| 348 | 426 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
@@ -359,7 +437,9 @@ discard block |
||
| 359 | 437 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 360 | 438 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 361 | 439 | $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"; |
|
| 440 | + if ($globalDebugTimeElapsed) { |
|
| 441 | + echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 442 | + } |
|
| 363 | 443 | |
| 364 | 444 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
| 365 | 445 | $timeelapsed = microtime(true); |
@@ -372,7 +452,9 @@ discard block |
||
| 372 | 452 | $Translation->db = null; |
| 373 | 453 | } |
| 374 | 454 | $Spotter->db = null; |
| 375 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 455 | + if ($globalDebugTimeElapsed) { |
|
| 456 | + echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 457 | + } |
|
| 376 | 458 | |
| 377 | 459 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 378 | 460 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
@@ -381,9 +463,13 @@ discard block |
||
| 381 | 463 | $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 | 464 | } |
| 383 | 465 | } |
| 384 | - if (!isset($globalFork)) $globalFork = TRUE; |
|
| 466 | + if (!isset($globalFork)) { |
|
| 467 | + $globalFork = TRUE; |
|
| 468 | + } |
|
| 385 | 469 | 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'])); |
|
| 470 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) { |
|
| 471 | + $this->get_Schedule($id,trim($line['ident'])); |
|
| 472 | + } |
|
| 387 | 473 | } |
| 388 | 474 | } |
| 389 | 475 | } |
@@ -399,16 +485,23 @@ discard block |
||
| 399 | 485 | // use datetime |
| 400 | 486 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 401 | 487 | $speed = $speed*3.6; |
| 402 | - if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
| 403 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
| 488 | + if ($speed < 1000) { |
|
| 489 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
| 490 | + } |
|
| 491 | + if ($globalDebug) { |
|
| 492 | + echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
| 493 | + } |
|
| 404 | 494 | } |
| 405 | 495 | } |
| 406 | 496 | |
| 407 | 497 | |
| 408 | 498 | |
| 409 | 499 | 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']); |
|
| 411 | - else unset($timediff); |
|
| 500 | + if (isset($this->all_flights[$id]['time_last_coord'])) { |
|
| 501 | + $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 502 | + } else { |
|
| 503 | + unset($timediff); |
|
| 504 | + } |
|
| 412 | 505 | 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 | 506 | 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 | 507 | 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'])) { |
@@ -416,21 +509,31 @@ discard block |
||
| 416 | 509 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 417 | 510 | $this->all_flights[$id]['putinarchive'] = true; |
| 418 | 511 | |
| 419 | - if ($globalDebug) echo "\n".' ------- Check Country.... '; |
|
| 512 | + if ($globalDebug) { |
|
| 513 | + echo "\n".' ------- Check Country.... '; |
|
| 514 | + } |
|
| 420 | 515 | $timeelapsed = microtime(true); |
| 421 | 516 | $Spotter = new Spotter($this->db); |
| 422 | 517 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
| 423 | - if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
| 518 | + if (!empty($all_country)) { |
|
| 519 | + $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
| 520 | + } |
|
| 424 | 521 | $Spotter->db = null; |
| 425 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 522 | + if ($globalDebugTimeElapsed) { |
|
| 523 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 524 | + } |
|
| 426 | 525 | $this->tmd = 0; |
| 427 | - if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
| 526 | + if ($globalDebug) { |
|
| 527 | + echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
| 528 | + } |
|
| 428 | 529 | } |
| 429 | 530 | } |
| 430 | 531 | |
| 431 | 532 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 432 | 533 | //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 | - if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
|
| 534 | + if (!isset($this->all_flights[$id]['archive_latitude'])) { |
|
| 535 | + $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
|
| 536 | + } |
|
| 434 | 537 | 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 | 538 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
| 436 | 539 | $dataFound = true; |
@@ -452,9 +555,13 @@ discard block |
||
| 452 | 555 | */ |
| 453 | 556 | } |
| 454 | 557 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 455 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 558 | + if ($line['longitude'] > 180) { |
|
| 559 | + $line['longitude'] = $line['longitude'] - 360; |
|
| 560 | + } |
|
| 456 | 561 | //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 | - if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
|
| 562 | + if (!isset($this->all_flights[$id]['archive_longitude'])) { |
|
| 563 | + $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
|
| 564 | + } |
|
| 458 | 565 | 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 | 566 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
| 460 | 567 | $dataFound = true; |
@@ -485,7 +592,9 @@ discard block |
||
| 485 | 592 | } |
| 486 | 593 | } |
| 487 | 594 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 488 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 595 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) { |
|
| 596 | + $dataFound = true; |
|
| 597 | + } |
|
| 489 | 598 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
| 490 | 599 | } |
| 491 | 600 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
@@ -507,11 +616,17 @@ discard block |
||
| 507 | 616 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 508 | 617 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 509 | 618 | $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'])); |
|
| 619 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) { |
|
| 620 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
| 621 | + } elseif (isset($line['id'])) { |
|
| 622 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 623 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
| 624 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 625 | + } |
|
| 626 | + } |
|
| 627 | + if ($line['ground'] != 1) { |
|
| 628 | + $line['ground'] = 0; |
|
| 513 | 629 | } |
| 514 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 515 | 630 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
| 516 | 631 | //$dataFound = true; |
| 517 | 632 | } |
@@ -519,28 +634,40 @@ discard block |
||
| 519 | 634 | 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 | 635 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
| 521 | 636 | $highlight = ''; |
| 522 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 523 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 524 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 637 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
| 638 | + $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 639 | + } |
|
| 640 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
| 641 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 642 | + } |
|
| 643 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
| 644 | + $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 645 | + } |
|
| 525 | 646 | if ($highlight != '') { |
| 526 | 647 | $timeelapsed = microtime(true); |
| 527 | 648 | $Spotter = new Spotter($this->db); |
| 528 | 649 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
| 529 | 650 | $Spotter->db = null; |
| 530 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 651 | + if ($globalDebugTimeElapsed) { |
|
| 652 | + echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 653 | + } |
|
| 531 | 654 | |
| 532 | 655 | $this->all_flights[$id]['putinarchive'] = true; |
| 533 | 656 | //$putinarchive = true; |
| 534 | 657 | //$highlight = ''; |
| 535 | 658 | } |
| 536 | 659 | |
| 537 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 660 | + } else { |
|
| 661 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 662 | + } |
|
| 538 | 663 | //$dataFound = true; |
| 539 | 664 | } |
| 540 | 665 | |
| 541 | 666 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 542 | 667 | //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; |
|
| 668 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) { |
|
| 669 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 670 | + } |
|
| 544 | 671 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
| 545 | 672 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
| 546 | 673 | //$dataFound = true; |
@@ -552,21 +679,30 @@ discard block |
||
| 552 | 679 | } |
| 553 | 680 | |
| 554 | 681 | 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; |
|
| 682 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) { |
|
| 683 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 684 | + } |
|
| 556 | 685 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
| 557 | 686 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
| 558 | 687 | //$dataFound = true; |
| 559 | 688 | } 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 | 689 | $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 | 690 | $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 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 691 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) { |
|
| 692 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 693 | + } |
|
| 694 | + if ($globalDebug) { |
|
| 695 | + echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 696 | + } |
|
| 564 | 697 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 565 | 698 | // If not enough messages and ACARS set heading to 0 |
| 566 | 699 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
| 567 | 700 | } |
| 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; |
|
| 701 | + if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) { |
|
| 702 | + $dataFound = false; |
|
| 703 | + } elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) { |
|
| 704 | + $dataFound = false; |
|
| 705 | + } |
|
| 570 | 706 | |
| 571 | 707 | // print_r($this->all_flights[$id]); |
| 572 | 708 | //gets the callsign from the last hour |
@@ -581,23 +717,36 @@ discard block |
||
| 581 | 717 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
| 582 | 718 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
| 583 | 719 | if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
| 584 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 720 | + if ($globalDebug) { |
|
| 721 | + echo "Check if aircraft is already in DB..."; |
|
| 722 | + } |
|
| 585 | 723 | $timeelapsed = microtime(true); |
| 586 | 724 | $SpotterLive = new SpotterLive($this->db); |
| 587 | 725 | 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 | 726 | $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"; |
|
| 727 | + if ($globalDebugTimeElapsed) { |
|
| 728 | + echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 729 | + } |
|
| 590 | 730 | } elseif (isset($line['id'])) { |
| 591 | 731 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 592 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 732 | + if ($globalDebugTimeElapsed) { |
|
| 733 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 734 | + } |
|
| 593 | 735 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 594 | 736 | $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"; |
|
| 596 | - } else $recent_ident = ''; |
|
| 737 | + if ($globalDebugTimeElapsed) { |
|
| 738 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 739 | + } |
|
| 740 | + } else { |
|
| 741 | + $recent_ident = ''; |
|
| 742 | + } |
|
| 597 | 743 | $SpotterLive->db=null; |
| 598 | 744 | |
| 599 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 600 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 745 | + if ($globalDebug && $recent_ident == '') { |
|
| 746 | + echo " Not in DB.\n"; |
|
| 747 | + } elseif ($globalDebug && $recent_ident != '') { |
|
| 748 | + echo " Already in DB.\n"; |
|
| 749 | + } |
|
| 601 | 750 | } else { |
| 602 | 751 | $recent_ident = ''; |
| 603 | 752 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
@@ -605,7 +754,9 @@ discard block |
||
| 605 | 754 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 606 | 755 | if($recent_ident == "") |
| 607 | 756 | { |
| 608 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
| 757 | + if ($globalDebug) { |
|
| 758 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
| 759 | + } |
|
| 609 | 760 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 610 | 761 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 611 | 762 | //adds the spotter data for the archive |
@@ -649,26 +800,44 @@ discard block |
||
| 649 | 800 | |
| 650 | 801 | if (!$ignoreImport) { |
| 651 | 802 | $highlight = ''; |
| 652 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 653 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 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'))); |
|
| 803 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
| 804 | + $highlight = 'Squawk 7500 : Hijack'; |
|
| 805 | + } |
|
| 806 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
| 807 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 808 | + } |
|
| 809 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
| 810 | + $highlight = 'Squawk 7700 : Emergency'; |
|
| 811 | + } |
|
| 812 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 813 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 814 | + } |
|
| 656 | 815 | $timeelapsed = microtime(true); |
| 657 | 816 | $Spotter = new Spotter($this->db); |
| 658 | 817 | $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 | 818 | $Spotter->db = null; |
| 660 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 661 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 819 | + if ($globalDebug && isset($result)) { |
|
| 820 | + echo $result."\n"; |
|
| 821 | + } |
|
| 822 | + if ($globalDebugTimeElapsed) { |
|
| 823 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 824 | + } |
|
| 662 | 825 | |
| 663 | 826 | // Add source stat in DB |
| 664 | 827 | $Stats = new Stats($this->db); |
| 665 | 828 | if (!empty($this->stats)) { |
| 666 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 829 | + if ($globalDebug) { |
|
| 830 | + echo 'Add source stats : '; |
|
| 831 | + } |
|
| 667 | 832 | foreach($this->stats as $date => $data) { |
| 668 | 833 | foreach($data as $source => $sourced) { |
| 669 | 834 | //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); |
|
| 835 | + if (isset($sourced['polar'])) { |
|
| 836 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 837 | + } |
|
| 838 | + if (isset($sourced['hist'])) { |
|
| 839 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 840 | + } |
|
| 672 | 841 | if (isset($sourced['msg'])) { |
| 673 | 842 | if (time() - $sourced['msg']['date'] > 10) { |
| 674 | 843 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -681,13 +850,17 @@ discard block |
||
| 681 | 850 | unset($this->stats[$date]); |
| 682 | 851 | } |
| 683 | 852 | } |
| 684 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 853 | + if ($globalDebug) { |
|
| 854 | + echo 'Done'."\n"; |
|
| 855 | + } |
|
| 685 | 856 | |
| 686 | 857 | } |
| 687 | 858 | $Stats->db = null; |
| 688 | 859 | |
| 689 | 860 | $this->del(); |
| 690 | - } elseif ($globalDebug) echo 'Ignore data'."\n"; |
|
| 861 | + } elseif ($globalDebug) { |
|
| 862 | + echo 'Ignore data'."\n"; |
|
| 863 | + } |
|
| 691 | 864 | //$ignoreImport = false; |
| 692 | 865 | $this->all_flights[$id]['addedSpotter'] = 1; |
| 693 | 866 | //print_r($this->all_flights[$id]); |
@@ -704,12 +877,16 @@ discard block |
||
| 704 | 877 | */ |
| 705 | 878 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
| 706 | 879 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 707 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 880 | + if ($globalDebug) { |
|
| 881 | + echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 882 | + } |
|
| 708 | 883 | //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 709 | 884 | $SpotterLive = new SpotterLive($this->db); |
| 710 | 885 | $SpotterLive->deleteLiveSpotterData(); |
| 711 | 886 | $SpotterLive->db=null; |
| 712 | - if ($globalDebug) echo " Done\n"; |
|
| 887 | + if ($globalDebug) { |
|
| 888 | + echo " Done\n"; |
|
| 889 | + } |
|
| 713 | 890 | $this->last_delete = time(); |
| 714 | 891 | } |
| 715 | 892 | } else { |
@@ -732,11 +909,17 @@ discard block |
||
| 732 | 909 | //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
| 733 | 910 | if ($globalDebug) { |
| 734 | 911 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
| 735 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 736 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
| 912 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
| 913 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 914 | + } else { |
|
| 915 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
| 916 | + } |
|
| 737 | 917 | } else { |
| 738 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 739 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
| 918 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
| 919 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 920 | + } else { |
|
| 921 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
| 922 | + } |
|
| 740 | 923 | } |
| 741 | 924 | } |
| 742 | 925 | $ignoreImport = false; |
@@ -782,19 +965,25 @@ discard block |
||
| 782 | 965 | |
| 783 | 966 | if (!$ignoreImport) { |
| 784 | 967 | 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 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
| 968 | + if ($globalDebug) { |
|
| 969 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
| 970 | + } |
|
| 786 | 971 | $timeelapsed = microtime(true); |
| 787 | 972 | $SpotterLive = new SpotterLive($this->db); |
| 788 | 973 | $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 | 974 | $SpotterLive->db = null; |
| 790 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 975 | + if ($globalDebugTimeElapsed) { |
|
| 976 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 977 | + } |
|
| 791 | 978 | |
| 792 | 979 | // Put statistics in $this->stats variable |
| 793 | 980 | //if ($line['format_source'] != 'aprs') { |
| 794 | 981 | //if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt')) { |
| 795 | 982 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 796 | 983 | $source = $this->all_flights[$id]['source_name']; |
| 797 | - if ($source == '') $source = $this->all_flights[$id]['format_source']; |
|
| 984 | + if ($source == '') { |
|
| 985 | + $source = $this->all_flights[$id]['format_source']; |
|
| 986 | + } |
|
| 798 | 987 | if (!isset($this->source_location[$source])) { |
| 799 | 988 | $Location = new Source(); |
| 800 | 989 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -815,7 +1004,9 @@ discard block |
||
| 815 | 1004 | $stats_heading = round($stats_heading/22.5); |
| 816 | 1005 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
| 817 | 1006 | $current_date = date('Y-m-d'); |
| 818 | - if ($stats_heading == 16) $stats_heading = 0; |
|
| 1007 | + if ($stats_heading == 16) { |
|
| 1008 | + $stats_heading = 0; |
|
| 1009 | + } |
|
| 819 | 1010 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 820 | 1011 | for ($i=0;$i<=15;$i++) { |
| 821 | 1012 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -833,7 +1024,9 @@ discard block |
||
| 833 | 1024 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 834 | 1025 | end($this->stats[$current_date][$source]['hist']); |
| 835 | 1026 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
| 836 | - } else $mini = 0; |
|
| 1027 | + } else { |
|
| 1028 | + $mini = 0; |
|
| 1029 | + } |
|
| 837 | 1030 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 838 | 1031 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 839 | 1032 | } |
@@ -844,20 +1037,30 @@ discard block |
||
| 844 | 1037 | } |
| 845 | 1038 | |
| 846 | 1039 | $this->all_flights[$id]['lastupdate'] = time(); |
| 847 | - if ($this->all_flights[$id]['putinarchive']) $send = true; |
|
| 1040 | + if ($this->all_flights[$id]['putinarchive']) { |
|
| 1041 | + $send = true; |
|
| 1042 | + } |
|
| 848 | 1043 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
| 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"; |
|
| 1044 | + if ($globalDebug) { |
|
| 1045 | + echo $result."\n"; |
|
| 1046 | + } |
|
| 1047 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
| 1048 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1049 | + } |
|
| 851 | 1050 | //$this->del(); |
| 852 | 1051 | |
| 853 | 1052 | |
| 854 | 1053 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 855 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 1054 | + if ($globalDebug) { |
|
| 1055 | + echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 1056 | + } |
|
| 856 | 1057 | $SpotterLive = new SpotterLive($this->db); |
| 857 | 1058 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 858 | 1059 | $SpotterLive->db = null; |
| 859 | 1060 | //SpotterLive->deleteLiveSpotterData(); |
| 860 | - if ($globalDebug) echo " Done\n"; |
|
| 1061 | + if ($globalDebug) { |
|
| 1062 | + echo " Done\n"; |
|
| 1063 | + } |
|
| 861 | 1064 | $this->last_delete_hourly = time(); |
| 862 | 1065 | } |
| 863 | 1066 | |
@@ -865,7 +1068,9 @@ discard block |
||
| 865 | 1068 | //$ignoreImport = false; |
| 866 | 1069 | } |
| 867 | 1070 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 868 | - if ($send) return $this->all_flights[$id]; |
|
| 1071 | + if ($send) { |
|
| 1072 | + return $this->all_flights[$id]; |
|
| 1073 | + } |
|
| 869 | 1074 | } |
| 870 | 1075 | } |
| 871 | 1076 | } |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * Get SQL query part for filter used |
|
| 17 | - * @param Array $filter the filter |
|
| 18 | - * @return Array the SQL part |
|
| 19 | - */ |
|
| 16 | + * Get SQL query part for filter used |
|
| 17 | + * @param Array $filter the filter |
|
| 18 | + * @return Array the SQL part |
|
| 19 | + */ |
|
| 20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 22 | 22 | $filters = array(); |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | - * Executes the SQL statements to get the spotter information |
|
| 88 | - * |
|
| 89 | - * @param String $query the SQL query |
|
| 90 | - * @param Array $params parameter of the query |
|
| 91 | - * @param String $limitQuery the limit query |
|
| 92 | - * @return Array the spotter information |
|
| 93 | - * |
|
| 94 | - */ |
|
| 87 | + * Executes the SQL statements to get the spotter information |
|
| 88 | + * |
|
| 89 | + * @param String $query the SQL query |
|
| 90 | + * @param Array $params parameter of the query |
|
| 91 | + * @param String $limitQuery the limit query |
|
| 92 | + * @return Array the spotter information |
|
| 93 | + * |
|
| 94 | + */ |
|
| 95 | 95 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 96 | 96 | { |
| 97 | 97 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
@@ -255,11 +255,11 @@ discard block |
||
| 255 | 255 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 256 | 256 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 257 | 257 | } else $temp_array['aircraft_shadow'] = 'default.png'; |
| 258 | - } else { |
|
| 259 | - $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 258 | + } else { |
|
| 259 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 260 | 260 | $temp_array['aircraft_name'] = 'N/A'; |
| 261 | 261 | $temp_array['aircraft_manufacturer'] = 'N/A'; |
| 262 | - } |
|
| 262 | + } |
|
| 263 | 263 | } |
| 264 | 264 | $fromsource = NULL; |
| 265 | 265 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
@@ -454,11 +454,11 @@ discard block |
||
| 454 | 454 | |
| 455 | 455 | |
| 456 | 456 | /** |
| 457 | - * Gets all the spotter information |
|
| 458 | - * |
|
| 459 | - * @return Array the spotter information |
|
| 460 | - * |
|
| 461 | - */ |
|
| 457 | + * Gets all the spotter information |
|
| 458 | + * |
|
| 459 | + * @return Array the spotter information |
|
| 460 | + * |
|
| 461 | + */ |
|
| 462 | 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; |
@@ -805,11 +805,11 @@ discard block |
||
| 805 | 805 | |
| 806 | 806 | |
| 807 | 807 | /** |
| 808 | - * Gets all the spotter information based on the latest data entry |
|
| 809 | - * |
|
| 810 | - * @return Array the spotter information |
|
| 811 | - * |
|
| 812 | - */ |
|
| 808 | + * Gets all the spotter information based on the latest data entry |
|
| 809 | + * |
|
| 810 | + * @return Array the spotter information |
|
| 811 | + * |
|
| 812 | + */ |
|
| 813 | 813 | public function getLatestSpotterData($limit = '', $sort = '', $filter = array()) |
| 814 | 814 | { |
| 815 | 815 | global $global_query; |
@@ -848,12 +848,12 @@ discard block |
||
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | |
| 851 | - /** |
|
| 852 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 853 | - * |
|
| 854 | - * @return Array the spotter information |
|
| 855 | - * |
|
| 856 | - */ |
|
| 851 | + /** |
|
| 852 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 853 | + * |
|
| 854 | + * @return Array the spotter information |
|
| 855 | + * |
|
| 856 | + */ |
|
| 857 | 857 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
| 858 | 858 | { |
| 859 | 859 | date_default_timezone_set('UTC'); |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | return false; |
| 882 | 882 | } |
| 883 | 883 | } |
| 884 | - $additional_query = ''; |
|
| 884 | + $additional_query = ''; |
|
| 885 | 885 | if ($interval != "") |
| 886 | 886 | { |
| 887 | 887 | if (!is_string($interval)) |
@@ -921,12 +921,12 @@ discard block |
||
| 921 | 921 | } |
| 922 | 922 | |
| 923 | 923 | |
| 924 | - /** |
|
| 925 | - * Gets all the spotter information sorted by the newest aircraft type |
|
| 926 | - * |
|
| 927 | - * @return Array the spotter information |
|
| 928 | - * |
|
| 929 | - */ |
|
| 924 | + /** |
|
| 925 | + * Gets all the spotter information sorted by the newest aircraft type |
|
| 926 | + * |
|
| 927 | + * @return Array the spotter information |
|
| 928 | + * |
|
| 929 | + */ |
|
| 930 | 930 | public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
| 931 | 931 | { |
| 932 | 932 | global $global_query; |
@@ -967,11 +967,11 @@ discard block |
||
| 967 | 967 | |
| 968 | 968 | |
| 969 | 969 | /** |
| 970 | - * Gets all the spotter information sorted by the newest aircraft registration |
|
| 971 | - * |
|
| 972 | - * @return Array the spotter information |
|
| 973 | - * |
|
| 974 | - */ |
|
| 970 | + * Gets all the spotter information sorted by the newest aircraft registration |
|
| 971 | + * |
|
| 972 | + * @return Array the spotter information |
|
| 973 | + * |
|
| 974 | + */ |
|
| 975 | 975 | public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array()) |
| 976 | 976 | { |
| 977 | 977 | global $global_query; |
@@ -1011,11 +1011,11 @@ discard block |
||
| 1011 | 1011 | |
| 1012 | 1012 | |
| 1013 | 1013 | /** |
| 1014 | - * Gets all the spotter information sorted by the newest airline |
|
| 1015 | - * |
|
| 1016 | - * @return Array the spotter information |
|
| 1017 | - * |
|
| 1018 | - */ |
|
| 1014 | + * Gets all the spotter information sorted by the newest airline |
|
| 1015 | + * |
|
| 1016 | + * @return Array the spotter information |
|
| 1017 | + * |
|
| 1018 | + */ |
|
| 1019 | 1019 | public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
| 1020 | 1020 | { |
| 1021 | 1021 | global $global_query; |
@@ -1054,12 +1054,12 @@ discard block |
||
| 1054 | 1054 | } |
| 1055 | 1055 | |
| 1056 | 1056 | |
| 1057 | - /** |
|
| 1058 | - * Gets all the spotter information sorted by the newest departure airport |
|
| 1059 | - * |
|
| 1060 | - * @return Array the spotter information |
|
| 1061 | - * |
|
| 1062 | - */ |
|
| 1057 | + /** |
|
| 1058 | + * Gets all the spotter information sorted by the newest departure airport |
|
| 1059 | + * |
|
| 1060 | + * @return Array the spotter information |
|
| 1061 | + * |
|
| 1062 | + */ |
|
| 1063 | 1063 | public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array()) |
| 1064 | 1064 | { |
| 1065 | 1065 | global $global_query; |
@@ -1101,11 +1101,11 @@ discard block |
||
| 1101 | 1101 | |
| 1102 | 1102 | |
| 1103 | 1103 | /** |
| 1104 | - * Gets all the spotter information sorted by the newest arrival airport |
|
| 1105 | - * |
|
| 1106 | - * @return Array the spotter information |
|
| 1107 | - * |
|
| 1108 | - */ |
|
| 1104 | + * Gets all the spotter information sorted by the newest arrival airport |
|
| 1105 | + * |
|
| 1106 | + * @return Array the spotter information |
|
| 1107 | + * |
|
| 1108 | + */ |
|
| 1109 | 1109 | public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array()) |
| 1110 | 1110 | { |
| 1111 | 1111 | global $global_query; |
@@ -1144,11 +1144,11 @@ discard block |
||
| 1144 | 1144 | |
| 1145 | 1145 | |
| 1146 | 1146 | /** |
| 1147 | - * Gets all the spotter information based on the spotter id |
|
| 1148 | - * |
|
| 1149 | - * @return Array the spotter information |
|
| 1150 | - * |
|
| 1151 | - */ |
|
| 1147 | + * Gets all the spotter information based on the spotter id |
|
| 1148 | + * |
|
| 1149 | + * @return Array the spotter information |
|
| 1150 | + * |
|
| 1151 | + */ |
|
| 1152 | 1152 | public function getSpotterDataByID($id = '') |
| 1153 | 1153 | { |
| 1154 | 1154 | global $global_query; |
@@ -1170,11 +1170,11 @@ discard block |
||
| 1170 | 1170 | |
| 1171 | 1171 | |
| 1172 | 1172 | /** |
| 1173 | - * Gets all the spotter information based on the callsign |
|
| 1174 | - * |
|
| 1175 | - * @return Array the spotter information |
|
| 1176 | - * |
|
| 1177 | - */ |
|
| 1173 | + * Gets all the spotter information based on the callsign |
|
| 1174 | + * |
|
| 1175 | + * @return Array the spotter information |
|
| 1176 | + * |
|
| 1177 | + */ |
|
| 1178 | 1178 | public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
| 1179 | 1179 | { |
| 1180 | 1180 | global $global_query; |
@@ -1227,11 +1227,11 @@ discard block |
||
| 1227 | 1227 | |
| 1228 | 1228 | |
| 1229 | 1229 | /** |
| 1230 | - * Gets all the spotter information based on the aircraft type |
|
| 1231 | - * |
|
| 1232 | - * @return Array the spotter information |
|
| 1233 | - * |
|
| 1234 | - */ |
|
| 1230 | + * Gets all the spotter information based on the aircraft type |
|
| 1231 | + * |
|
| 1232 | + * @return Array the spotter information |
|
| 1233 | + * |
|
| 1234 | + */ |
|
| 1235 | 1235 | public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array()) |
| 1236 | 1236 | { |
| 1237 | 1237 | global $global_query; |
@@ -1285,11 +1285,11 @@ discard block |
||
| 1285 | 1285 | |
| 1286 | 1286 | |
| 1287 | 1287 | /** |
| 1288 | - * Gets all the spotter information based on the aircraft registration |
|
| 1289 | - * |
|
| 1290 | - * @return Array the spotter information |
|
| 1291 | - * |
|
| 1292 | - */ |
|
| 1288 | + * Gets all the spotter information based on the aircraft registration |
|
| 1289 | + * |
|
| 1290 | + * @return Array the spotter information |
|
| 1291 | + * |
|
| 1292 | + */ |
|
| 1293 | 1293 | public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array()) |
| 1294 | 1294 | { |
| 1295 | 1295 | global $global_query; |
@@ -1346,11 +1346,11 @@ discard block |
||
| 1346 | 1346 | |
| 1347 | 1347 | |
| 1348 | 1348 | /** |
| 1349 | - * Gets all the spotter information based on the airline |
|
| 1350 | - * |
|
| 1351 | - * @return Array the spotter information |
|
| 1352 | - * |
|
| 1353 | - */ |
|
| 1349 | + * Gets all the spotter information based on the airline |
|
| 1350 | + * |
|
| 1351 | + * @return Array the spotter information |
|
| 1352 | + * |
|
| 1353 | + */ |
|
| 1354 | 1354 | public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
| 1355 | 1355 | { |
| 1356 | 1356 | global $global_query; |
@@ -1403,11 +1403,11 @@ discard block |
||
| 1403 | 1403 | |
| 1404 | 1404 | |
| 1405 | 1405 | /** |
| 1406 | - * Gets all the spotter information based on the airport |
|
| 1407 | - * |
|
| 1408 | - * @return Array the spotter information |
|
| 1409 | - * |
|
| 1410 | - */ |
|
| 1406 | + * Gets all the spotter information based on the airport |
|
| 1407 | + * |
|
| 1408 | + * @return Array the spotter information |
|
| 1409 | + * |
|
| 1410 | + */ |
|
| 1411 | 1411 | public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
| 1412 | 1412 | { |
| 1413 | 1413 | global $global_query; |
@@ -1461,11 +1461,11 @@ discard block |
||
| 1461 | 1461 | |
| 1462 | 1462 | |
| 1463 | 1463 | /** |
| 1464 | - * Gets all the spotter information based on the date |
|
| 1465 | - * |
|
| 1466 | - * @return Array the spotter information |
|
| 1467 | - * |
|
| 1468 | - */ |
|
| 1464 | + * Gets all the spotter information based on the date |
|
| 1465 | + * |
|
| 1466 | + * @return Array the spotter information |
|
| 1467 | + * |
|
| 1468 | + */ |
|
| 1469 | 1469 | public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
| 1470 | 1470 | { |
| 1471 | 1471 | global $global_query, $globalTimezone, $globalDBdriver; |
@@ -1526,11 +1526,11 @@ discard block |
||
| 1526 | 1526 | |
| 1527 | 1527 | |
| 1528 | 1528 | /** |
| 1529 | - * Gets all the spotter information based on the country name |
|
| 1530 | - * |
|
| 1531 | - * @return Array the spotter information |
|
| 1532 | - * |
|
| 1533 | - */ |
|
| 1529 | + * Gets all the spotter information based on the country name |
|
| 1530 | + * |
|
| 1531 | + * @return Array the spotter information |
|
| 1532 | + * |
|
| 1533 | + */ |
|
| 1534 | 1534 | public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
| 1535 | 1535 | { |
| 1536 | 1536 | global $global_query; |
@@ -1584,11 +1584,11 @@ discard block |
||
| 1584 | 1584 | |
| 1585 | 1585 | |
| 1586 | 1586 | /** |
| 1587 | - * Gets all the spotter information based on the manufacturer name |
|
| 1588 | - * |
|
| 1589 | - * @return Array the spotter information |
|
| 1590 | - * |
|
| 1591 | - */ |
|
| 1587 | + * Gets all the spotter information based on the manufacturer name |
|
| 1588 | + * |
|
| 1589 | + * @return Array the spotter information |
|
| 1590 | + * |
|
| 1591 | + */ |
|
| 1592 | 1592 | public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array()) |
| 1593 | 1593 | { |
| 1594 | 1594 | global $global_query; |
@@ -1644,13 +1644,13 @@ discard block |
||
| 1644 | 1644 | |
| 1645 | 1645 | |
| 1646 | 1646 | /** |
| 1647 | - * Gets a list of all aircraft that take a route |
|
| 1648 | - * |
|
| 1649 | - * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1650 | - * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1651 | - * @return Array the spotter information |
|
| 1652 | - * |
|
| 1653 | - */ |
|
| 1647 | + * Gets a list of all aircraft that take a route |
|
| 1648 | + * |
|
| 1649 | + * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1650 | + * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1651 | + * @return Array the spotter information |
|
| 1652 | + * |
|
| 1653 | + */ |
|
| 1654 | 1654 | public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array()) |
| 1655 | 1655 | { |
| 1656 | 1656 | global $global_query; |
@@ -1717,11 +1717,11 @@ discard block |
||
| 1717 | 1717 | |
| 1718 | 1718 | |
| 1719 | 1719 | /** |
| 1720 | - * Gets all the spotter information based on the special column in the table |
|
| 1721 | - * |
|
| 1722 | - * @return Array the spotter information |
|
| 1723 | - * |
|
| 1724 | - */ |
|
| 1720 | + * Gets all the spotter information based on the special column in the table |
|
| 1721 | + * |
|
| 1722 | + * @return Array the spotter information |
|
| 1723 | + * |
|
| 1724 | + */ |
|
| 1725 | 1725 | public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array()) |
| 1726 | 1726 | { |
| 1727 | 1727 | global $global_query; |
@@ -1760,11 +1760,11 @@ discard block |
||
| 1760 | 1760 | } |
| 1761 | 1761 | |
| 1762 | 1762 | /** |
| 1763 | - * Gets all the highlight based on a aircraft registration |
|
| 1764 | - * |
|
| 1765 | - * @return String the highlight text |
|
| 1766 | - * |
|
| 1767 | - */ |
|
| 1763 | + * Gets all the highlight based on a aircraft registration |
|
| 1764 | + * |
|
| 1765 | + * @return String the highlight text |
|
| 1766 | + * |
|
| 1767 | + */ |
|
| 1768 | 1768 | public function getHighlightByRegistration($registration,$filter = array()) |
| 1769 | 1769 | { |
| 1770 | 1770 | global $global_query; |
@@ -1786,13 +1786,13 @@ discard block |
||
| 1786 | 1786 | |
| 1787 | 1787 | |
| 1788 | 1788 | /** |
| 1789 | - * Gets the squawk usage from squawk code |
|
| 1790 | - * |
|
| 1791 | - * @param String $squawk squawk code |
|
| 1792 | - * @param String $country country |
|
| 1793 | - * @return String usage |
|
| 1794 | - * |
|
| 1795 | - */ |
|
| 1789 | + * Gets the squawk usage from squawk code |
|
| 1790 | + * |
|
| 1791 | + * @param String $squawk squawk code |
|
| 1792 | + * @param String $country country |
|
| 1793 | + * @return String usage |
|
| 1794 | + * |
|
| 1795 | + */ |
|
| 1796 | 1796 | public function getSquawkUsage($squawk = '',$country = 'FR') |
| 1797 | 1797 | { |
| 1798 | 1798 | |
@@ -1813,12 +1813,12 @@ discard block |
||
| 1813 | 1813 | } |
| 1814 | 1814 | |
| 1815 | 1815 | /** |
| 1816 | - * Gets the airport icao from the iata |
|
| 1817 | - * |
|
| 1818 | - * @param String $airport_iata the iata code of the airport |
|
| 1819 | - * @return String airport iata |
|
| 1820 | - * |
|
| 1821 | - */ |
|
| 1816 | + * Gets the airport icao from the iata |
|
| 1817 | + * |
|
| 1818 | + * @param String $airport_iata the iata code of the airport |
|
| 1819 | + * @return String airport iata |
|
| 1820 | + * |
|
| 1821 | + */ |
|
| 1822 | 1822 | public function getAirportIcao($airport_iata = '') |
| 1823 | 1823 | { |
| 1824 | 1824 | |
@@ -1838,14 +1838,14 @@ discard block |
||
| 1838 | 1838 | } |
| 1839 | 1839 | |
| 1840 | 1840 | /** |
| 1841 | - * Gets the airport distance |
|
| 1842 | - * |
|
| 1843 | - * @param String $airport_icao the icao code of the airport |
|
| 1844 | - * @param Float $latitude the latitude |
|
| 1845 | - * @param Float $longitude the longitude |
|
| 1846 | - * @return Float distance to the airport |
|
| 1847 | - * |
|
| 1848 | - */ |
|
| 1841 | + * Gets the airport distance |
|
| 1842 | + * |
|
| 1843 | + * @param String $airport_icao the icao code of the airport |
|
| 1844 | + * @param Float $latitude the latitude |
|
| 1845 | + * @param Float $longitude the longitude |
|
| 1846 | + * @return Float distance to the airport |
|
| 1847 | + * |
|
| 1848 | + */ |
|
| 1849 | 1849 | public function getAirportDistance($airport_icao,$latitude,$longitude) |
| 1850 | 1850 | { |
| 1851 | 1851 | |
@@ -1866,12 +1866,12 @@ discard block |
||
| 1866 | 1866 | } |
| 1867 | 1867 | |
| 1868 | 1868 | /** |
| 1869 | - * Gets the airport info based on the icao |
|
| 1870 | - * |
|
| 1871 | - * @param String $airport the icao code of the airport |
|
| 1872 | - * @return Array airport information |
|
| 1873 | - * |
|
| 1874 | - */ |
|
| 1869 | + * Gets the airport info based on the icao |
|
| 1870 | + * |
|
| 1871 | + * @param String $airport the icao code of the airport |
|
| 1872 | + * @return Array airport information |
|
| 1873 | + * |
|
| 1874 | + */ |
|
| 1875 | 1875 | public function getAllAirportInfo($airport = '') |
| 1876 | 1876 | { |
| 1877 | 1877 | |
@@ -1917,12 +1917,12 @@ discard block |
||
| 1917 | 1917 | } |
| 1918 | 1918 | |
| 1919 | 1919 | /** |
| 1920 | - * Gets the airport info based on the country |
|
| 1921 | - * |
|
| 1922 | - * @param Array $countries Airports countries |
|
| 1923 | - * @return Array airport information |
|
| 1924 | - * |
|
| 1925 | - */ |
|
| 1920 | + * Gets the airport info based on the country |
|
| 1921 | + * |
|
| 1922 | + * @param Array $countries Airports countries |
|
| 1923 | + * @return Array airport information |
|
| 1924 | + * |
|
| 1925 | + */ |
|
| 1926 | 1926 | public function getAllAirportInfobyCountry($countries) |
| 1927 | 1927 | { |
| 1928 | 1928 | $lst_countries = ''; |
@@ -1960,12 +1960,12 @@ discard block |
||
| 1960 | 1960 | } |
| 1961 | 1961 | |
| 1962 | 1962 | /** |
| 1963 | - * Gets airports info based on the coord |
|
| 1964 | - * |
|
| 1965 | - * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 1966 | - * @return Array airport information |
|
| 1967 | - * |
|
| 1968 | - */ |
|
| 1963 | + * Gets airports info based on the coord |
|
| 1964 | + * |
|
| 1965 | + * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 1966 | + * @return Array airport information |
|
| 1967 | + * |
|
| 1968 | + */ |
|
| 1969 | 1969 | public function getAllAirportInfobyCoord($coord) |
| 1970 | 1970 | { |
| 1971 | 1971 | global $globalDBdriver; |
@@ -1996,12 +1996,12 @@ discard block |
||
| 1996 | 1996 | } |
| 1997 | 1997 | |
| 1998 | 1998 | /** |
| 1999 | - * Gets waypoints info based on the coord |
|
| 2000 | - * |
|
| 2001 | - * @param Array $coord waypoints coord |
|
| 2002 | - * @return Array airport information |
|
| 2003 | - * |
|
| 2004 | - */ |
|
| 1999 | + * Gets waypoints info based on the coord |
|
| 2000 | + * |
|
| 2001 | + * @param Array $coord waypoints coord |
|
| 2002 | + * @return Array airport information |
|
| 2003 | + * |
|
| 2004 | + */ |
|
| 2005 | 2005 | public function getAllWaypointsInfobyCoord($coord) |
| 2006 | 2006 | { |
| 2007 | 2007 | if (is_array($coord)) { |
@@ -2035,12 +2035,12 @@ discard block |
||
| 2035 | 2035 | |
| 2036 | 2036 | |
| 2037 | 2037 | /** |
| 2038 | - * Gets the airline info based on the icao code or iata code |
|
| 2039 | - * |
|
| 2040 | - * @param String $airline_icao the iata code of the airport |
|
| 2041 | - * @return Array airport information |
|
| 2042 | - * |
|
| 2043 | - */ |
|
| 2038 | + * Gets the airline info based on the icao code or iata code |
|
| 2039 | + * |
|
| 2040 | + * @param String $airline_icao the iata code of the airport |
|
| 2041 | + * @return Array airport information |
|
| 2042 | + * |
|
| 2043 | + */ |
|
| 2044 | 2044 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2045 | 2045 | { |
| 2046 | 2046 | global $globalUseRealAirlines; |
@@ -2071,7 +2071,7 @@ discard block |
||
| 2071 | 2071 | } else { |
| 2072 | 2072 | $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
| 2073 | 2073 | } |
| 2074 | - /* |
|
| 2074 | + /* |
|
| 2075 | 2075 | $airline_array = array(); |
| 2076 | 2076 | $temp_array = array(); |
| 2077 | 2077 | |
@@ -2103,12 +2103,12 @@ discard block |
||
| 2103 | 2103 | |
| 2104 | 2104 | |
| 2105 | 2105 | /** |
| 2106 | - * Gets the aircraft info based on the aircraft type |
|
| 2107 | - * |
|
| 2108 | - * @param String $aircraft_type the aircraft type |
|
| 2109 | - * @return Array aircraft information |
|
| 2110 | - * |
|
| 2111 | - */ |
|
| 2106 | + * Gets the aircraft info based on the aircraft type |
|
| 2107 | + * |
|
| 2108 | + * @param String $aircraft_type the aircraft type |
|
| 2109 | + * @return Array aircraft information |
|
| 2110 | + * |
|
| 2111 | + */ |
|
| 2112 | 2112 | public function getAllAircraftInfo($aircraft_type) |
| 2113 | 2113 | { |
| 2114 | 2114 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2140,12 +2140,12 @@ discard block |
||
| 2140 | 2140 | } |
| 2141 | 2141 | |
| 2142 | 2142 | /** |
| 2143 | - * Gets the aircraft icao based on the aircraft name/type |
|
| 2144 | - * |
|
| 2145 | - * @param String $aircraft_type the aircraft type |
|
| 2146 | - * @return String aircraft information |
|
| 2147 | - * |
|
| 2148 | - */ |
|
| 2143 | + * Gets the aircraft icao based on the aircraft name/type |
|
| 2144 | + * |
|
| 2145 | + * @param String $aircraft_type the aircraft type |
|
| 2146 | + * @return String aircraft information |
|
| 2147 | + * |
|
| 2148 | + */ |
|
| 2149 | 2149 | public function getAircraftIcao($aircraft_type) |
| 2150 | 2150 | { |
| 2151 | 2151 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2170,12 +2170,12 @@ discard block |
||
| 2170 | 2170 | } |
| 2171 | 2171 | |
| 2172 | 2172 | /** |
| 2173 | - * Gets the aircraft info based on the aircraft ident |
|
| 2174 | - * |
|
| 2175 | - * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2176 | - * @return String aircraft type |
|
| 2177 | - * |
|
| 2178 | - */ |
|
| 2173 | + * Gets the aircraft info based on the aircraft ident |
|
| 2174 | + * |
|
| 2175 | + * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2176 | + * @return String aircraft type |
|
| 2177 | + * |
|
| 2178 | + */ |
|
| 2179 | 2179 | public function getAllAircraftType($aircraft_modes) |
| 2180 | 2180 | { |
| 2181 | 2181 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -2193,12 +2193,12 @@ discard block |
||
| 2193 | 2193 | } |
| 2194 | 2194 | |
| 2195 | 2195 | /** |
| 2196 | - * Gets correct aircraft operator corde |
|
| 2197 | - * |
|
| 2198 | - * @param String $operator the aircraft operator code (callsign) |
|
| 2199 | - * @return String aircraft operator code |
|
| 2200 | - * |
|
| 2201 | - */ |
|
| 2196 | + * Gets correct aircraft operator corde |
|
| 2197 | + * |
|
| 2198 | + * @param String $operator the aircraft operator code (callsign) |
|
| 2199 | + * @return String aircraft operator code |
|
| 2200 | + * |
|
| 2201 | + */ |
|
| 2202 | 2202 | public function getOperator($operator) |
| 2203 | 2203 | { |
| 2204 | 2204 | $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
@@ -2215,16 +2215,16 @@ discard block |
||
| 2215 | 2215 | } |
| 2216 | 2216 | |
| 2217 | 2217 | /** |
| 2218 | - * Gets the aircraft route based on the aircraft callsign |
|
| 2219 | - * |
|
| 2220 | - * @param String $callsign the aircraft callsign |
|
| 2221 | - * @return Array aircraft type |
|
| 2222 | - * |
|
| 2223 | - */ |
|
| 2218 | + * Gets the aircraft route based on the aircraft callsign |
|
| 2219 | + * |
|
| 2220 | + * @param String $callsign the aircraft callsign |
|
| 2221 | + * @return Array aircraft type |
|
| 2222 | + * |
|
| 2223 | + */ |
|
| 2224 | 2224 | public function getRouteInfo($callsign) |
| 2225 | 2225 | { |
| 2226 | 2226 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2227 | - if ($callsign == '') return array(); |
|
| 2227 | + if ($callsign == '') return array(); |
|
| 2228 | 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); |
@@ -2238,12 +2238,12 @@ discard block |
||
| 2238 | 2238 | } |
| 2239 | 2239 | |
| 2240 | 2240 | /** |
| 2241 | - * Gets the aircraft info based on the aircraft registration |
|
| 2242 | - * |
|
| 2243 | - * @param String $registration the aircraft registration |
|
| 2244 | - * @return Array aircraft information |
|
| 2245 | - * |
|
| 2246 | - */ |
|
| 2241 | + * Gets the aircraft info based on the aircraft registration |
|
| 2242 | + * |
|
| 2243 | + * @param String $registration the aircraft registration |
|
| 2244 | + * @return Array aircraft information |
|
| 2245 | + * |
|
| 2246 | + */ |
|
| 2247 | 2247 | public function getAircraftInfoByRegistration($registration) |
| 2248 | 2248 | { |
| 2249 | 2249 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2270,12 +2270,12 @@ discard block |
||
| 2270 | 2270 | } |
| 2271 | 2271 | |
| 2272 | 2272 | /** |
| 2273 | - * Gets the aircraft owner & base based on the aircraft registration |
|
| 2274 | - * |
|
| 2275 | - * @param String $registration the aircraft registration |
|
| 2276 | - * @return Array aircraft information |
|
| 2277 | - * |
|
| 2278 | - */ |
|
| 2273 | + * Gets the aircraft owner & base based on the aircraft registration |
|
| 2274 | + * |
|
| 2275 | + * @param String $registration the aircraft registration |
|
| 2276 | + * @return Array aircraft information |
|
| 2277 | + * |
|
| 2278 | + */ |
|
| 2279 | 2279 | public function getAircraftOwnerByRegistration($registration) |
| 2280 | 2280 | { |
| 2281 | 2281 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2292,11 +2292,11 @@ discard block |
||
| 2292 | 2292 | |
| 2293 | 2293 | |
| 2294 | 2294 | /** |
| 2295 | - * Gets all flights (but with only little info) |
|
| 2296 | - * |
|
| 2297 | - * @return Array basic flight information |
|
| 2298 | - * |
|
| 2299 | - */ |
|
| 2295 | + * Gets all flights (but with only little info) |
|
| 2296 | + * |
|
| 2297 | + * @return Array basic flight information |
|
| 2298 | + * |
|
| 2299 | + */ |
|
| 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 "; |
@@ -2304,7 +2304,7 @@ discard block |
||
| 2304 | 2304 | |
| 2305 | 2305 | $sth = $this->db->prepare($query); |
| 2306 | 2306 | $sth->execute(); |
| 2307 | - /* |
|
| 2307 | + /* |
|
| 2308 | 2308 | $flight_array = array(); |
| 2309 | 2309 | $temp_array = array(); |
| 2310 | 2310 | |
@@ -2326,11 +2326,11 @@ discard block |
||
| 2326 | 2326 | } |
| 2327 | 2327 | |
| 2328 | 2328 | /** |
| 2329 | - * Gets a list of all aircraft manufacturers |
|
| 2330 | - * |
|
| 2331 | - * @return Array list of aircraft types |
|
| 2332 | - * |
|
| 2333 | - */ |
|
| 2329 | + * Gets a list of all aircraft manufacturers |
|
| 2330 | + * |
|
| 2331 | + * @return Array list of aircraft types |
|
| 2332 | + * |
|
| 2333 | + */ |
|
| 2334 | 2334 | public function getAllManufacturers() |
| 2335 | 2335 | { |
| 2336 | 2336 | /* |
@@ -2359,11 +2359,11 @@ discard block |
||
| 2359 | 2359 | |
| 2360 | 2360 | |
| 2361 | 2361 | /** |
| 2362 | - * Gets a list of all aircraft types |
|
| 2363 | - * |
|
| 2364 | - * @return Array list of aircraft types |
|
| 2365 | - * |
|
| 2366 | - */ |
|
| 2362 | + * Gets a list of all aircraft types |
|
| 2363 | + * |
|
| 2364 | + * @return Array list of aircraft types |
|
| 2365 | + * |
|
| 2366 | + */ |
|
| 2367 | 2367 | public function getAllAircraftTypes($filters = array()) |
| 2368 | 2368 | { |
| 2369 | 2369 | /* |
@@ -2396,11 +2396,11 @@ discard block |
||
| 2396 | 2396 | |
| 2397 | 2397 | |
| 2398 | 2398 | /** |
| 2399 | - * Gets a list of all aircraft registrations |
|
| 2400 | - * |
|
| 2401 | - * @return Array list of aircraft registrations |
|
| 2402 | - * |
|
| 2403 | - */ |
|
| 2399 | + * Gets a list of all aircraft registrations |
|
| 2400 | + * |
|
| 2401 | + * @return Array list of aircraft registrations |
|
| 2402 | + * |
|
| 2403 | + */ |
|
| 2404 | 2404 | public function getAllAircraftRegistrations($filters = array()) |
| 2405 | 2405 | { |
| 2406 | 2406 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2425,12 +2425,12 @@ discard block |
||
| 2425 | 2425 | } |
| 2426 | 2426 | |
| 2427 | 2427 | /** |
| 2428 | - * Gets all source name |
|
| 2429 | - * |
|
| 2430 | - * @param String type format of source |
|
| 2431 | - * @return Array list of source name |
|
| 2432 | - * |
|
| 2433 | - */ |
|
| 2428 | + * Gets all source name |
|
| 2429 | + * |
|
| 2430 | + * @param String type format of source |
|
| 2431 | + * @return Array list of source name |
|
| 2432 | + * |
|
| 2433 | + */ |
|
| 2434 | 2434 | public function getAllSourceName($type = '',$filters = array()) |
| 2435 | 2435 | { |
| 2436 | 2436 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2461,11 +2461,11 @@ discard block |
||
| 2461 | 2461 | |
| 2462 | 2462 | |
| 2463 | 2463 | /** |
| 2464 | - * Gets a list of all airline names |
|
| 2465 | - * |
|
| 2466 | - * @return Array list of airline names |
|
| 2467 | - * |
|
| 2468 | - */ |
|
| 2464 | + * Gets a list of all airline names |
|
| 2465 | + * |
|
| 2466 | + * @return Array list of airline names |
|
| 2467 | + * |
|
| 2468 | + */ |
|
| 2469 | 2469 | public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
| 2470 | 2470 | { |
| 2471 | 2471 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2515,11 +2515,11 @@ discard block |
||
| 2515 | 2515 | |
| 2516 | 2516 | |
| 2517 | 2517 | /** |
| 2518 | - * Gets a list of all airline countries |
|
| 2519 | - * |
|
| 2520 | - * @return Array list of airline countries |
|
| 2521 | - * |
|
| 2522 | - */ |
|
| 2518 | + * Gets a list of all airline countries |
|
| 2519 | + * |
|
| 2520 | + * @return Array list of airline countries |
|
| 2521 | + * |
|
| 2522 | + */ |
|
| 2523 | 2523 | public function getAllAirlineCountries($filters = array()) |
| 2524 | 2524 | { |
| 2525 | 2525 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2547,11 +2547,11 @@ discard block |
||
| 2547 | 2547 | |
| 2548 | 2548 | |
| 2549 | 2549 | /** |
| 2550 | - * Gets a list of all departure & arrival names |
|
| 2551 | - * |
|
| 2552 | - * @return Array list of airport names |
|
| 2553 | - * |
|
| 2554 | - */ |
|
| 2550 | + * Gets a list of all departure & arrival names |
|
| 2551 | + * |
|
| 2552 | + * @return Array list of airport names |
|
| 2553 | + * |
|
| 2554 | + */ |
|
| 2555 | 2555 | public function getAllAirportNames($filters = array()) |
| 2556 | 2556 | { |
| 2557 | 2557 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2600,11 +2600,11 @@ discard block |
||
| 2600 | 2600 | |
| 2601 | 2601 | |
| 2602 | 2602 | /** |
| 2603 | - * Gets a list of all departure & arrival airport countries |
|
| 2604 | - * |
|
| 2605 | - * @return Array list of airport countries |
|
| 2606 | - * |
|
| 2607 | - */ |
|
| 2603 | + * Gets a list of all departure & arrival airport countries |
|
| 2604 | + * |
|
| 2605 | + * @return Array list of airport countries |
|
| 2606 | + * |
|
| 2607 | + */ |
|
| 2608 | 2608 | public function getAllAirportCountries($filters = array()) |
| 2609 | 2609 | { |
| 2610 | 2610 | $airport_array = array(); |
@@ -2652,11 +2652,11 @@ discard block |
||
| 2652 | 2652 | |
| 2653 | 2653 | |
| 2654 | 2654 | /** |
| 2655 | - * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 2656 | - * |
|
| 2657 | - * @return Array list of countries |
|
| 2658 | - * |
|
| 2659 | - */ |
|
| 2655 | + * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 2656 | + * |
|
| 2657 | + * @return Array list of countries |
|
| 2658 | + * |
|
| 2659 | + */ |
|
| 2660 | 2660 | public function getAllCountries($filters = array()) |
| 2661 | 2661 | { |
| 2662 | 2662 | $Connection= new Connection($this->db); |
@@ -2733,11 +2733,11 @@ discard block |
||
| 2733 | 2733 | |
| 2734 | 2734 | |
| 2735 | 2735 | /** |
| 2736 | - * Gets a list of all idents/callsigns |
|
| 2737 | - * |
|
| 2738 | - * @return Array list of ident/callsign names |
|
| 2739 | - * |
|
| 2740 | - */ |
|
| 2736 | + * Gets a list of all idents/callsigns |
|
| 2737 | + * |
|
| 2738 | + * @return Array list of ident/callsign names |
|
| 2739 | + * |
|
| 2740 | + */ |
|
| 2741 | 2741 | public function getAllIdents($filters = array()) |
| 2742 | 2742 | { |
| 2743 | 2743 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2761,9 +2761,9 @@ discard block |
||
| 2761 | 2761 | } |
| 2762 | 2762 | |
| 2763 | 2763 | /** |
| 2764 | - * Get a list of flights from airport since 7 days |
|
| 2765 | - * @return Array number, icao, name and city of airports |
|
| 2766 | - */ |
|
| 2764 | + * Get a list of flights from airport since 7 days |
|
| 2765 | + * @return Array number, icao, name and city of airports |
|
| 2766 | + */ |
|
| 2767 | 2767 | |
| 2768 | 2768 | public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
| 2769 | 2769 | global $globalTimezone, $globalDBdriver; |
@@ -2794,9 +2794,9 @@ discard block |
||
| 2794 | 2794 | } |
| 2795 | 2795 | |
| 2796 | 2796 | /** |
| 2797 | - * Get a list of flights from airport since 7 days |
|
| 2798 | - * @return Array number, icao, name and city of airports |
|
| 2799 | - */ |
|
| 2797 | + * Get a list of flights from airport since 7 days |
|
| 2798 | + * @return Array number, icao, name and city of airports |
|
| 2799 | + */ |
|
| 2800 | 2800 | |
| 2801 | 2801 | public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') { |
| 2802 | 2802 | global $globalTimezone, $globalDBdriver; |
@@ -2826,9 +2826,9 @@ discard block |
||
| 2826 | 2826 | } |
| 2827 | 2827 | |
| 2828 | 2828 | /** |
| 2829 | - * Get a list of flights from detected airport since 7 days |
|
| 2830 | - * @return Array number, icao, name and city of airports |
|
| 2831 | - */ |
|
| 2829 | + * Get a list of flights from detected airport since 7 days |
|
| 2830 | + * @return Array number, icao, name and city of airports |
|
| 2831 | + */ |
|
| 2832 | 2832 | |
| 2833 | 2833 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 2834 | 2834 | global $globalTimezone, $globalDBdriver; |
@@ -2866,9 +2866,9 @@ discard block |
||
| 2866 | 2866 | } |
| 2867 | 2867 | |
| 2868 | 2868 | /** |
| 2869 | - * Get a list of flights from detected airport since 7 days |
|
| 2870 | - * @return Array number, icao, name and city of airports |
|
| 2871 | - */ |
|
| 2869 | + * Get a list of flights from detected airport since 7 days |
|
| 2870 | + * @return Array number, icao, name and city of airports |
|
| 2871 | + */ |
|
| 2872 | 2872 | |
| 2873 | 2873 | public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') { |
| 2874 | 2874 | global $globalTimezone, $globalDBdriver; |
@@ -2910,9 +2910,9 @@ discard block |
||
| 2910 | 2910 | |
| 2911 | 2911 | |
| 2912 | 2912 | /** |
| 2913 | - * Get a list of flights to airport since 7 days |
|
| 2914 | - * @return Array number, icao, name and city of airports |
|
| 2915 | - */ |
|
| 2913 | + * Get a list of flights to airport since 7 days |
|
| 2914 | + * @return Array number, icao, name and city of airports |
|
| 2915 | + */ |
|
| 2916 | 2916 | |
| 2917 | 2917 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 2918 | 2918 | global $globalTimezone, $globalDBdriver; |
@@ -2945,9 +2945,9 @@ discard block |
||
| 2945 | 2945 | |
| 2946 | 2946 | |
| 2947 | 2947 | /** |
| 2948 | - * Get a list of flights detected to airport since 7 days |
|
| 2949 | - * @return Array number, icao, name and city of airports |
|
| 2950 | - */ |
|
| 2948 | + * Get a list of flights detected to airport since 7 days |
|
| 2949 | + * @return Array number, icao, name and city of airports |
|
| 2950 | + */ |
|
| 2951 | 2951 | |
| 2952 | 2952 | public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
| 2953 | 2953 | global $globalTimezone, $globalDBdriver; |
@@ -2988,9 +2988,9 @@ discard block |
||
| 2988 | 2988 | |
| 2989 | 2989 | |
| 2990 | 2990 | /** |
| 2991 | - * Get a list of flights to airport since 7 days |
|
| 2992 | - * @return Array number, icao, name and city of airports |
|
| 2993 | - */ |
|
| 2991 | + * Get a list of flights to airport since 7 days |
|
| 2992 | + * @return Array number, icao, name and city of airports |
|
| 2993 | + */ |
|
| 2994 | 2994 | |
| 2995 | 2995 | public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') { |
| 2996 | 2996 | global $globalTimezone, $globalDBdriver; |
@@ -3022,9 +3022,9 @@ discard block |
||
| 3022 | 3022 | |
| 3023 | 3023 | |
| 3024 | 3024 | /** |
| 3025 | - * Get a list of flights detected to airport since 7 days |
|
| 3026 | - * @return Array number, icao, name and city of airports |
|
| 3027 | - */ |
|
| 3025 | + * Get a list of flights detected to airport since 7 days |
|
| 3026 | + * @return Array number, icao, name and city of airports |
|
| 3027 | + */ |
|
| 3028 | 3028 | |
| 3029 | 3029 | public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') { |
| 3030 | 3030 | global $globalTimezone, $globalDBdriver; |
@@ -3068,11 +3068,11 @@ discard block |
||
| 3068 | 3068 | |
| 3069 | 3069 | |
| 3070 | 3070 | /** |
| 3071 | - * Gets a list of all dates |
|
| 3072 | - * |
|
| 3073 | - * @return Array list of date names |
|
| 3074 | - * |
|
| 3075 | - */ |
|
| 3071 | + * Gets a list of all dates |
|
| 3072 | + * |
|
| 3073 | + * @return Array list of date names |
|
| 3074 | + * |
|
| 3075 | + */ |
|
| 3076 | 3076 | public function getAllDates() |
| 3077 | 3077 | { |
| 3078 | 3078 | global $globalTimezone, $globalDBdriver; |
@@ -3113,11 +3113,11 @@ discard block |
||
| 3113 | 3113 | |
| 3114 | 3114 | |
| 3115 | 3115 | /** |
| 3116 | - * Gets all route combinations |
|
| 3117 | - * |
|
| 3118 | - * @return Array the route list |
|
| 3119 | - * |
|
| 3120 | - */ |
|
| 3116 | + * Gets all route combinations |
|
| 3117 | + * |
|
| 3118 | + * @return Array the route list |
|
| 3119 | + * |
|
| 3120 | + */ |
|
| 3121 | 3121 | public function getAllRoutes() |
| 3122 | 3122 | { |
| 3123 | 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 |
@@ -3143,13 +3143,13 @@ discard block |
||
| 3143 | 3143 | } |
| 3144 | 3144 | |
| 3145 | 3145 | /** |
| 3146 | - * Update ident spotter data |
|
| 3147 | - * |
|
| 3148 | - * @param String $flightaware_id the ID from flightaware |
|
| 3149 | - * @param String $ident the flight ident |
|
| 3150 | - * @return String success or false |
|
| 3151 | - * |
|
| 3152 | - */ |
|
| 3146 | + * Update ident spotter data |
|
| 3147 | + * |
|
| 3148 | + * @param String $flightaware_id the ID from flightaware |
|
| 3149 | + * @param String $ident the flight ident |
|
| 3150 | + * @return String success or false |
|
| 3151 | + * |
|
| 3152 | + */ |
|
| 3153 | 3153 | public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
| 3154 | 3154 | { |
| 3155 | 3155 | if (!is_numeric(substr($ident, 0, 3))) |
@@ -3170,14 +3170,14 @@ discard block |
||
| 3170 | 3170 | } else { |
| 3171 | 3171 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3172 | 3172 | } |
| 3173 | - $airline_name = $airline_array[0]['name']; |
|
| 3174 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3175 | - $airline_country = $airline_array[0]['country']; |
|
| 3176 | - $airline_type = $airline_array[0]['type']; |
|
| 3173 | + $airline_name = $airline_array[0]['name']; |
|
| 3174 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3175 | + $airline_country = $airline_array[0]['country']; |
|
| 3176 | + $airline_type = $airline_array[0]['type']; |
|
| 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); |
@@ -3190,19 +3190,19 @@ discard block |
||
| 3190 | 3190 | |
| 3191 | 3191 | } |
| 3192 | 3192 | /** |
| 3193 | - * Update latest spotter data |
|
| 3194 | - * |
|
| 3195 | - * @param String $flightaware_id the ID from flightaware |
|
| 3196 | - * @param String $ident the flight ident |
|
| 3197 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3198 | - * @return String success or false |
|
| 3199 | - * |
|
| 3200 | - */ |
|
| 3193 | + * Update latest spotter data |
|
| 3194 | + * |
|
| 3195 | + * @param String $flightaware_id the ID from flightaware |
|
| 3196 | + * @param String $ident the flight ident |
|
| 3197 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3198 | + * @return String success or false |
|
| 3199 | + * |
|
| 3200 | + */ |
|
| 3201 | 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); |
@@ -3216,32 +3216,32 @@ discard block |
||
| 3216 | 3216 | } |
| 3217 | 3217 | |
| 3218 | 3218 | /** |
| 3219 | - * Adds a new spotter data |
|
| 3220 | - * |
|
| 3221 | - * @param String $flightaware_id the ID from flightaware |
|
| 3222 | - * @param String $ident the flight ident |
|
| 3223 | - * @param String $aircraft_icao the aircraft type |
|
| 3224 | - * @param String $departure_airport_icao the departure airport |
|
| 3225 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3226 | - * @param String $latitude latitude of flight |
|
| 3227 | - * @param String $longitude latitude of flight |
|
| 3228 | - * @param String $waypoints waypoints of flight |
|
| 3229 | - * @param String $altitude altitude of flight |
|
| 3230 | - * @param String $heading heading of flight |
|
| 3231 | - * @param String $groundspeed speed of flight |
|
| 3232 | - * @param String $date date of flight |
|
| 3233 | - * @param String $departure_airport_time departure time of flight |
|
| 3234 | - * @param String $arrival_airport_time arrival time of flight |
|
| 3235 | - * @param String $squawk squawk code of flight |
|
| 3236 | - * @param String $route_stop route stop of flight |
|
| 3237 | - * @param String $highlight highlight or not |
|
| 3238 | - * @param String $ModeS ModesS code of flight |
|
| 3239 | - * @param String $registration registration code of flight |
|
| 3240 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3241 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3242 | - * @param String $verticalrate vertival rate of flight |
|
| 3243 | - * @return String success or false |
|
| 3244 | - */ |
|
| 3219 | + * Adds a new spotter data |
|
| 3220 | + * |
|
| 3221 | + * @param String $flightaware_id the ID from flightaware |
|
| 3222 | + * @param String $ident the flight ident |
|
| 3223 | + * @param String $aircraft_icao the aircraft type |
|
| 3224 | + * @param String $departure_airport_icao the departure airport |
|
| 3225 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3226 | + * @param String $latitude latitude of flight |
|
| 3227 | + * @param String $longitude latitude of flight |
|
| 3228 | + * @param String $waypoints waypoints of flight |
|
| 3229 | + * @param String $altitude altitude of flight |
|
| 3230 | + * @param String $heading heading of flight |
|
| 3231 | + * @param String $groundspeed speed of flight |
|
| 3232 | + * @param String $date date of flight |
|
| 3233 | + * @param String $departure_airport_time departure time of flight |
|
| 3234 | + * @param String $arrival_airport_time arrival time of flight |
|
| 3235 | + * @param String $squawk squawk code of flight |
|
| 3236 | + * @param String $route_stop route stop of flight |
|
| 3237 | + * @param String $highlight highlight or not |
|
| 3238 | + * @param String $ModeS ModesS code of flight |
|
| 3239 | + * @param String $registration registration code of flight |
|
| 3240 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3241 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3242 | + * @param String $verticalrate vertival rate of flight |
|
| 3243 | + * @return String success or false |
|
| 3244 | + */ |
|
| 3245 | 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; |
@@ -3455,8 +3455,8 @@ discard block |
||
| 3455 | 3455 | |
| 3456 | 3456 | if ($globalIVAO && $aircraft_icao != '') |
| 3457 | 3457 | { |
| 3458 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3459 | - else $airline_icao = ''; |
|
| 3458 | + if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3459 | + else $airline_icao = ''; |
|
| 3460 | 3460 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3461 | 3461 | if (!isset($image_array[0]['registration'])) |
| 3462 | 3462 | { |
@@ -3487,52 +3487,52 @@ discard block |
||
| 3487 | 3487 | |
| 3488 | 3488 | if (count($airline_array) == 0) |
| 3489 | 3489 | { |
| 3490 | - $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3491 | - } |
|
| 3492 | - if (count($aircraft_array) == 0) |
|
| 3493 | - { |
|
| 3494 | - $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3495 | - } |
|
| 3496 | - if (count($departure_airport_array) == 0) |
|
| 3497 | - { |
|
| 3498 | - $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3499 | - } |
|
| 3500 | - if (count($arrival_airport_array) == 0) |
|
| 3501 | - { |
|
| 3502 | - $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3503 | - } |
|
| 3504 | - if ($registration == '') $registration = 'NA'; |
|
| 3505 | - if ($latitude == '' && $longitude == '') { |
|
| 3506 | - $latitude = 0; |
|
| 3507 | - $longitude = 0; |
|
| 3508 | - } |
|
| 3509 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3510 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3511 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3512 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 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) |
|
| 3490 | + $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3491 | + } |
|
| 3492 | + if (count($aircraft_array) == 0) |
|
| 3493 | + { |
|
| 3494 | + $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3495 | + } |
|
| 3496 | + if (count($departure_airport_array) == 0) |
|
| 3497 | + { |
|
| 3498 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3499 | + } |
|
| 3500 | + if (count($arrival_airport_array) == 0) |
|
| 3501 | + { |
|
| 3502 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3503 | + } |
|
| 3504 | + if ($registration == '') $registration = 'NA'; |
|
| 3505 | + if ($latitude == '' && $longitude == '') { |
|
| 3506 | + $latitude = 0; |
|
| 3507 | + $longitude = 0; |
|
| 3508 | + } |
|
| 3509 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3510 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3511 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3512 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 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) |
|
| 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 | - $airline_name = $airline_array[0]['name']; |
|
| 3518 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3519 | - $airline_country = $airline_array[0]['country']; |
|
| 3520 | - $airline_type = $airline_array[0]['type']; |
|
| 3517 | + $airline_name = $airline_array[0]['name']; |
|
| 3518 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3519 | + $airline_country = $airline_array[0]['country']; |
|
| 3520 | + $airline_type = $airline_array[0]['type']; |
|
| 3521 | 3521 | if ($airline_type == '') { |
| 3522 | 3522 | $timeelapsed = microtime(true); |
| 3523 | 3523 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3524 | 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 | - $aircraft_type = $aircraft_array[0]['type']; |
|
| 3528 | - $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3529 | - $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3530 | - $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3531 | - $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3532 | - $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3533 | - $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 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); |
|
| 3527 | + $aircraft_type = $aircraft_array[0]['type']; |
|
| 3528 | + $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3529 | + $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3530 | + $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3531 | + $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3532 | + $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3533 | + $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 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); |
|
| 3536 | 3536 | |
| 3537 | 3537 | try { |
| 3538 | 3538 | |
@@ -3540,7 +3540,7 @@ discard block |
||
| 3540 | 3540 | $sth->execute($query_values); |
| 3541 | 3541 | $this->db = null; |
| 3542 | 3542 | } catch (PDOException $e) { |
| 3543 | - return "error : ".$e->getMessage(); |
|
| 3543 | + return "error : ".$e->getMessage(); |
|
| 3544 | 3544 | } |
| 3545 | 3545 | |
| 3546 | 3546 | return "success"; |
@@ -3549,11 +3549,11 @@ discard block |
||
| 3549 | 3549 | |
| 3550 | 3550 | |
| 3551 | 3551 | /** |
| 3552 | - * Gets the aircraft ident within the last hour |
|
| 3553 | - * |
|
| 3554 | - * @return String the ident |
|
| 3555 | - * |
|
| 3556 | - */ |
|
| 3552 | + * Gets the aircraft ident within the last hour |
|
| 3553 | + * |
|
| 3554 | + * @return String the ident |
|
| 3555 | + * |
|
| 3556 | + */ |
|
| 3557 | 3557 | public function getIdentFromLastHour($ident) |
| 3558 | 3558 | { |
| 3559 | 3559 | global $globalDBdriver, $globalTimezone; |
@@ -3569,11 +3569,11 @@ discard block |
||
| 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'"; |
| 3571 | 3571 | $query_data = array(':ident' => $ident); |
| 3572 | - } |
|
| 3572 | + } |
|
| 3573 | 3573 | |
| 3574 | 3574 | $sth = $this->db->prepare($query); |
| 3575 | 3575 | $sth->execute($query_data); |
| 3576 | - $ident_result=''; |
|
| 3576 | + $ident_result=''; |
|
| 3577 | 3577 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 3578 | 3578 | { |
| 3579 | 3579 | $ident_result = $row['ident']; |
@@ -3584,11 +3584,11 @@ discard block |
||
| 3584 | 3584 | |
| 3585 | 3585 | |
| 3586 | 3586 | /** |
| 3587 | - * Gets the aircraft data from the last 20 seconds |
|
| 3588 | - * |
|
| 3589 | - * @return Array the spotter data |
|
| 3590 | - * |
|
| 3591 | - */ |
|
| 3587 | + * Gets the aircraft data from the last 20 seconds |
|
| 3588 | + * |
|
| 3589 | + * @return Array the spotter data |
|
| 3590 | + * |
|
| 3591 | + */ |
|
| 3592 | 3592 | public function getRealTimeData($q = '') |
| 3593 | 3593 | { |
| 3594 | 3594 | global $globalDBdriver; |
@@ -3632,11 +3632,11 @@ discard block |
||
| 3632 | 3632 | |
| 3633 | 3633 | |
| 3634 | 3634 | /** |
| 3635 | - * Gets all airlines that have flown over |
|
| 3636 | - * |
|
| 3637 | - * @return Array the airline list |
|
| 3638 | - * |
|
| 3639 | - */ |
|
| 3635 | + * Gets all airlines that have flown over |
|
| 3636 | + * |
|
| 3637 | + * @return Array the airline list |
|
| 3638 | + * |
|
| 3639 | + */ |
|
| 3640 | 3640 | public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 3641 | 3641 | { |
| 3642 | 3642 | global $globalDBdriver; |
@@ -3650,7 +3650,7 @@ discard block |
||
| 3650 | 3650 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3651 | 3651 | } |
| 3652 | 3652 | } |
| 3653 | - if ($sincedate != '') { |
|
| 3653 | + if ($sincedate != '') { |
|
| 3654 | 3654 | if ($globalDBdriver == 'mysql') { |
| 3655 | 3655 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3656 | 3656 | } else { |
@@ -3677,26 +3677,26 @@ discard block |
||
| 3677 | 3677 | } |
| 3678 | 3678 | |
| 3679 | 3679 | /** |
| 3680 | - * Gets all pilots that have flown over |
|
| 3681 | - * |
|
| 3682 | - * @return Array the pilots list |
|
| 3683 | - * |
|
| 3684 | - */ |
|
| 3680 | + * Gets all pilots that have flown over |
|
| 3681 | + * |
|
| 3682 | + * @return Array the pilots list |
|
| 3683 | + * |
|
| 3684 | + */ |
|
| 3685 | 3685 | public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 3686 | 3686 | { |
| 3687 | 3687 | global $globalDBdriver; |
| 3688 | 3688 | $filter_query = $this->getFilter($filters,true,true); |
| 3689 | 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 | - if ($olderthanmonths > 0) { |
|
| 3692 | - if ($globalDBdriver == 'mysql') { |
|
| 3691 | + if ($olderthanmonths > 0) { |
|
| 3692 | + if ($globalDBdriver == 'mysql') { |
|
| 3693 | 3693 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3694 | 3694 | } else { |
| 3695 | 3695 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3696 | 3696 | } |
| 3697 | 3697 | } |
| 3698 | - if ($sincedate != '') { |
|
| 3699 | - if ($globalDBdriver == 'mysql') { |
|
| 3698 | + if ($sincedate != '') { |
|
| 3699 | + if ($globalDBdriver == 'mysql') { |
|
| 3700 | 3700 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3701 | 3701 | } else { |
| 3702 | 3702 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3724,25 +3724,25 @@ discard block |
||
| 3724 | 3724 | } |
| 3725 | 3725 | |
| 3726 | 3726 | /** |
| 3727 | - * Gets all pilots that have flown over |
|
| 3728 | - * |
|
| 3729 | - * @return Array the pilots list |
|
| 3730 | - * |
|
| 3731 | - */ |
|
| 3727 | + * Gets all pilots that have flown over |
|
| 3728 | + * |
|
| 3729 | + * @return Array the pilots list |
|
| 3730 | + * |
|
| 3731 | + */ |
|
| 3732 | 3732 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 3733 | 3733 | { |
| 3734 | 3734 | global $globalDBdriver; |
| 3735 | 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 | - if ($olderthanmonths > 0) { |
|
| 3738 | - if ($globalDBdriver == 'mysql') { |
|
| 3737 | + if ($olderthanmonths > 0) { |
|
| 3738 | + if ($globalDBdriver == 'mysql') { |
|
| 3739 | 3739 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3740 | 3740 | } else { |
| 3741 | 3741 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3742 | 3742 | } |
| 3743 | 3743 | } |
| 3744 | - if ($sincedate != '') { |
|
| 3745 | - if ($globalDBdriver == 'mysql') { |
|
| 3744 | + if ($sincedate != '') { |
|
| 3745 | + if ($globalDBdriver == 'mysql') { |
|
| 3746 | 3746 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3747 | 3747 | } else { |
| 3748 | 3748 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3771,26 +3771,26 @@ discard block |
||
| 3771 | 3771 | } |
| 3772 | 3772 | |
| 3773 | 3773 | /** |
| 3774 | - * Gets all owner that have flown over |
|
| 3775 | - * |
|
| 3776 | - * @return Array the pilots list |
|
| 3777 | - * |
|
| 3778 | - */ |
|
| 3774 | + * Gets all owner that have flown over |
|
| 3775 | + * |
|
| 3776 | + * @return Array the pilots list |
|
| 3777 | + * |
|
| 3778 | + */ |
|
| 3779 | 3779 | public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 3780 | 3780 | { |
| 3781 | 3781 | global $globalDBdriver; |
| 3782 | 3782 | $filter_query = $this->getFilter($filters,true,true); |
| 3783 | 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 | - if ($olderthanmonths > 0) { |
|
| 3786 | - if ($globalDBdriver == 'mysql') { |
|
| 3785 | + if ($olderthanmonths > 0) { |
|
| 3786 | + if ($globalDBdriver == 'mysql') { |
|
| 3787 | 3787 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3788 | 3788 | } else { |
| 3789 | 3789 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3790 | 3790 | } |
| 3791 | 3791 | } |
| 3792 | - if ($sincedate != '') { |
|
| 3793 | - if ($globalDBdriver == 'mysql') { |
|
| 3792 | + if ($sincedate != '') { |
|
| 3793 | + if ($globalDBdriver == 'mysql') { |
|
| 3794 | 3794 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3795 | 3795 | } else { |
| 3796 | 3796 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3816,26 +3816,26 @@ discard block |
||
| 3816 | 3816 | } |
| 3817 | 3817 | |
| 3818 | 3818 | /** |
| 3819 | - * Gets all owner that have flown over |
|
| 3820 | - * |
|
| 3821 | - * @return Array the pilots list |
|
| 3822 | - * |
|
| 3823 | - */ |
|
| 3819 | + * Gets all owner that have flown over |
|
| 3820 | + * |
|
| 3821 | + * @return Array the pilots list |
|
| 3822 | + * |
|
| 3823 | + */ |
|
| 3824 | 3824 | public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 3825 | 3825 | { |
| 3826 | 3826 | global $globalDBdriver; |
| 3827 | 3827 | $filter_query = $this->getFilter($filters,true,true); |
| 3828 | 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 | - if ($olderthanmonths > 0) { |
|
| 3831 | - if ($globalDBdriver == 'mysql') { |
|
| 3830 | + if ($olderthanmonths > 0) { |
|
| 3831 | + if ($globalDBdriver == 'mysql') { |
|
| 3832 | 3832 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3833 | 3833 | } else { |
| 3834 | 3834 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3835 | 3835 | } |
| 3836 | 3836 | } |
| 3837 | - if ($sincedate != '') { |
|
| 3838 | - if ($globalDBdriver == 'mysql') { |
|
| 3837 | + if ($sincedate != '') { |
|
| 3838 | + if ($globalDBdriver == 'mysql') { |
|
| 3839 | 3839 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3840 | 3840 | } else { |
| 3841 | 3841 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3862,11 +3862,11 @@ discard block |
||
| 3862 | 3862 | } |
| 3863 | 3863 | |
| 3864 | 3864 | /** |
| 3865 | - * Gets all airlines that have flown over by aircraft |
|
| 3866 | - * |
|
| 3867 | - * @return Array the airline list |
|
| 3868 | - * |
|
| 3869 | - */ |
|
| 3865 | + * Gets all airlines that have flown over by aircraft |
|
| 3866 | + * |
|
| 3867 | + * @return Array the airline list |
|
| 3868 | + * |
|
| 3869 | + */ |
|
| 3870 | 3870 | public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
| 3871 | 3871 | { |
| 3872 | 3872 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -3898,11 +3898,11 @@ discard block |
||
| 3898 | 3898 | |
| 3899 | 3899 | |
| 3900 | 3900 | /** |
| 3901 | - * Gets all airline countries that have flown over by aircraft |
|
| 3902 | - * |
|
| 3903 | - * @return Array the airline country list |
|
| 3904 | - * |
|
| 3905 | - */ |
|
| 3901 | + * Gets all airline countries that have flown over by aircraft |
|
| 3902 | + * |
|
| 3903 | + * @return Array the airline country list |
|
| 3904 | + * |
|
| 3905 | + */ |
|
| 3906 | 3906 | public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
| 3907 | 3907 | { |
| 3908 | 3908 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -3934,11 +3934,11 @@ discard block |
||
| 3934 | 3934 | |
| 3935 | 3935 | |
| 3936 | 3936 | /** |
| 3937 | - * Gets all airlines that have flown over by airport |
|
| 3938 | - * |
|
| 3939 | - * @return Array the airline list |
|
| 3940 | - * |
|
| 3941 | - */ |
|
| 3937 | + * Gets all airlines that have flown over by airport |
|
| 3938 | + * |
|
| 3939 | + * @return Array the airline list |
|
| 3940 | + * |
|
| 3941 | + */ |
|
| 3942 | 3942 | public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
| 3943 | 3943 | { |
| 3944 | 3944 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -3969,11 +3969,11 @@ discard block |
||
| 3969 | 3969 | |
| 3970 | 3970 | |
| 3971 | 3971 | /** |
| 3972 | - * Gets all airline countries that have flown over by airport icao |
|
| 3973 | - * |
|
| 3974 | - * @return Array the airline country list |
|
| 3975 | - * |
|
| 3976 | - */ |
|
| 3972 | + * Gets all airline countries that have flown over by airport icao |
|
| 3973 | + * |
|
| 3974 | + * @return Array the airline country list |
|
| 3975 | + * |
|
| 3976 | + */ |
|
| 3977 | 3977 | public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
| 3978 | 3978 | { |
| 3979 | 3979 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4003,11 +4003,11 @@ discard block |
||
| 4003 | 4003 | |
| 4004 | 4004 | |
| 4005 | 4005 | /** |
| 4006 | - * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4007 | - * |
|
| 4008 | - * @return Array the airline list |
|
| 4009 | - * |
|
| 4010 | - */ |
|
| 4006 | + * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4007 | + * |
|
| 4008 | + * @return Array the airline list |
|
| 4009 | + * |
|
| 4010 | + */ |
|
| 4011 | 4011 | public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4012 | 4012 | { |
| 4013 | 4013 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4038,11 +4038,11 @@ discard block |
||
| 4038 | 4038 | |
| 4039 | 4039 | |
| 4040 | 4040 | /** |
| 4041 | - * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4042 | - * |
|
| 4043 | - * @return Array the airline country list |
|
| 4044 | - * |
|
| 4045 | - */ |
|
| 4041 | + * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4042 | + * |
|
| 4043 | + * @return Array the airline country list |
|
| 4044 | + * |
|
| 4045 | + */ |
|
| 4046 | 4046 | public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4047 | 4047 | { |
| 4048 | 4048 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4071,11 +4071,11 @@ discard block |
||
| 4071 | 4071 | |
| 4072 | 4072 | |
| 4073 | 4073 | /** |
| 4074 | - * Gets all airlines that have flown over by date |
|
| 4075 | - * |
|
| 4076 | - * @return Array the airline list |
|
| 4077 | - * |
|
| 4078 | - */ |
|
| 4074 | + * Gets all airlines that have flown over by date |
|
| 4075 | + * |
|
| 4076 | + * @return Array the airline list |
|
| 4077 | + * |
|
| 4078 | + */ |
|
| 4079 | 4079 | public function countAllAirlinesByDate($date,$filters = array()) |
| 4080 | 4080 | { |
| 4081 | 4081 | global $globalTimezone, $globalDBdriver; |
@@ -4119,11 +4119,11 @@ discard block |
||
| 4119 | 4119 | |
| 4120 | 4120 | |
| 4121 | 4121 | /** |
| 4122 | - * Gets all airline countries that have flown over by date |
|
| 4123 | - * |
|
| 4124 | - * @return Array the airline country list |
|
| 4125 | - * |
|
| 4126 | - */ |
|
| 4122 | + * Gets all airline countries that have flown over by date |
|
| 4123 | + * |
|
| 4124 | + * @return Array the airline country list |
|
| 4125 | + * |
|
| 4126 | + */ |
|
| 4127 | 4127 | public function countAllAirlineCountriesByDate($date,$filters = array()) |
| 4128 | 4128 | { |
| 4129 | 4129 | global $globalTimezone, $globalDBdriver; |
@@ -4166,11 +4166,11 @@ discard block |
||
| 4166 | 4166 | |
| 4167 | 4167 | |
| 4168 | 4168 | /** |
| 4169 | - * Gets all airlines that have flown over by ident/callsign |
|
| 4170 | - * |
|
| 4171 | - * @return Array the airline list |
|
| 4172 | - * |
|
| 4173 | - */ |
|
| 4169 | + * Gets all airlines that have flown over by ident/callsign |
|
| 4170 | + * |
|
| 4171 | + * @return Array the airline list |
|
| 4172 | + * |
|
| 4173 | + */ |
|
| 4174 | 4174 | public function countAllAirlinesByIdent($ident,$filters = array()) |
| 4175 | 4175 | { |
| 4176 | 4176 | $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
@@ -4200,11 +4200,11 @@ discard block |
||
| 4200 | 4200 | } |
| 4201 | 4201 | |
| 4202 | 4202 | /** |
| 4203 | - * Gets all airlines that have flown over by route |
|
| 4204 | - * |
|
| 4205 | - * @return Array the airline list |
|
| 4206 | - * |
|
| 4207 | - */ |
|
| 4203 | + * Gets all airlines that have flown over by route |
|
| 4204 | + * |
|
| 4205 | + * @return Array the airline list |
|
| 4206 | + * |
|
| 4207 | + */ |
|
| 4208 | 4208 | public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 4209 | 4209 | { |
| 4210 | 4210 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4236,11 +4236,11 @@ discard block |
||
| 4236 | 4236 | } |
| 4237 | 4237 | |
| 4238 | 4238 | /** |
| 4239 | - * Gets all airline countries that have flown over by route |
|
| 4240 | - * |
|
| 4241 | - * @return Array the airline country list |
|
| 4242 | - * |
|
| 4243 | - */ |
|
| 4239 | + * Gets all airline countries that have flown over by route |
|
| 4240 | + * |
|
| 4241 | + * @return Array the airline country list |
|
| 4242 | + * |
|
| 4243 | + */ |
|
| 4244 | 4244 | public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
| 4245 | 4245 | { |
| 4246 | 4246 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4272,11 +4272,11 @@ discard block |
||
| 4272 | 4272 | |
| 4273 | 4273 | |
| 4274 | 4274 | /** |
| 4275 | - * Gets all airlines that have flown over by country |
|
| 4276 | - * |
|
| 4277 | - * @return Array the airline list |
|
| 4278 | - * |
|
| 4279 | - */ |
|
| 4275 | + * Gets all airlines that have flown over by country |
|
| 4276 | + * |
|
| 4277 | + * @return Array the airline list |
|
| 4278 | + * |
|
| 4279 | + */ |
|
| 4280 | 4280 | public function countAllAirlinesByCountry($country,$filters = array()) |
| 4281 | 4281 | { |
| 4282 | 4282 | $country = filter_var($country,FILTER_SANITIZE_STRING); |
@@ -4306,11 +4306,11 @@ discard block |
||
| 4306 | 4306 | |
| 4307 | 4307 | |
| 4308 | 4308 | /** |
| 4309 | - * Gets all airline countries that have flown over by country |
|
| 4310 | - * |
|
| 4311 | - * @return Array the airline country list |
|
| 4312 | - * |
|
| 4313 | - */ |
|
| 4309 | + * Gets all airline countries that have flown over by country |
|
| 4310 | + * |
|
| 4311 | + * @return Array the airline country list |
|
| 4312 | + * |
|
| 4313 | + */ |
|
| 4314 | 4314 | public function countAllAirlineCountriesByCountry($country,$filters = array()) |
| 4315 | 4315 | { |
| 4316 | 4316 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4339,11 +4339,11 @@ discard block |
||
| 4339 | 4339 | |
| 4340 | 4340 | |
| 4341 | 4341 | /** |
| 4342 | - * Gets all airlines countries |
|
| 4343 | - * |
|
| 4344 | - * @return Array the airline country list |
|
| 4345 | - * |
|
| 4346 | - */ |
|
| 4342 | + * Gets all airlines countries |
|
| 4343 | + * |
|
| 4344 | + * @return Array the airline country list |
|
| 4345 | + * |
|
| 4346 | + */ |
|
| 4347 | 4347 | public function countAllAirlineCountries($limit = true, $filters = array()) |
| 4348 | 4348 | { |
| 4349 | 4349 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4369,11 +4369,11 @@ discard block |
||
| 4369 | 4369 | } |
| 4370 | 4370 | |
| 4371 | 4371 | /** |
| 4372 | - * Gets all number of flight over countries |
|
| 4373 | - * |
|
| 4374 | - * @return Array the airline country list |
|
| 4375 | - * |
|
| 4376 | - */ |
|
| 4372 | + * Gets all number of flight over countries |
|
| 4373 | + * |
|
| 4374 | + * @return Array the airline country list |
|
| 4375 | + * |
|
| 4376 | + */ |
|
| 4377 | 4377 | public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
| 4378 | 4378 | { |
| 4379 | 4379 | global $globalDBdriver; |
@@ -4388,15 +4388,15 @@ discard block |
||
| 4388 | 4388 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 4389 | 4389 | FROM countries c, spotter_live s |
| 4390 | 4390 | WHERE c.iso2 = s.over_country "; |
| 4391 | - if ($olderthanmonths > 0) { |
|
| 4391 | + if ($olderthanmonths > 0) { |
|
| 4392 | 4392 | if ($globalDBdriver == 'mysql') { |
| 4393 | 4393 | $query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 4394 | 4394 | } else { |
| 4395 | 4395 | $query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4396 | 4396 | } |
| 4397 | 4397 | } |
| 4398 | - if ($sincedate != '') { |
|
| 4399 | - if ($globalDBdriver == 'mysql') { |
|
| 4398 | + if ($sincedate != '') { |
|
| 4399 | + if ($globalDBdriver == 'mysql') { |
|
| 4400 | 4400 | $query .= "AND spotter_live.date > '".$sincedate."' "; |
| 4401 | 4401 | } else { |
| 4402 | 4402 | $query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4426,11 +4426,11 @@ discard block |
||
| 4426 | 4426 | |
| 4427 | 4427 | |
| 4428 | 4428 | /** |
| 4429 | - * Gets all aircraft types that have flown over |
|
| 4430 | - * |
|
| 4431 | - * @return Array the aircraft list |
|
| 4432 | - * |
|
| 4433 | - */ |
|
| 4429 | + * Gets all aircraft types that have flown over |
|
| 4430 | + * |
|
| 4431 | + * @return Array the aircraft list |
|
| 4432 | + * |
|
| 4433 | + */ |
|
| 4434 | 4434 | public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4435 | 4435 | { |
| 4436 | 4436 | global $globalDBdriver; |
@@ -4473,11 +4473,11 @@ discard block |
||
| 4473 | 4473 | } |
| 4474 | 4474 | |
| 4475 | 4475 | /** |
| 4476 | - * Gets all aircraft types that have flown over by airline |
|
| 4477 | - * |
|
| 4478 | - * @return Array the aircraft list |
|
| 4479 | - * |
|
| 4480 | - */ |
|
| 4476 | + * Gets all aircraft types that have flown over by airline |
|
| 4477 | + * |
|
| 4478 | + * @return Array the aircraft list |
|
| 4479 | + * |
|
| 4480 | + */ |
|
| 4481 | 4481 | public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4482 | 4482 | { |
| 4483 | 4483 | global $globalDBdriver; |
@@ -4520,11 +4520,11 @@ discard block |
||
| 4520 | 4520 | } |
| 4521 | 4521 | |
| 4522 | 4522 | /** |
| 4523 | - * Gets all aircraft types that have flown over by months |
|
| 4524 | - * |
|
| 4525 | - * @return Array the aircraft list |
|
| 4526 | - * |
|
| 4527 | - */ |
|
| 4523 | + * Gets all aircraft types that have flown over by months |
|
| 4524 | + * |
|
| 4525 | + * @return Array the aircraft list |
|
| 4526 | + * |
|
| 4527 | + */ |
|
| 4528 | 4528 | public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4529 | 4529 | { |
| 4530 | 4530 | global $globalDBdriver; |
@@ -4568,11 +4568,11 @@ discard block |
||
| 4568 | 4568 | |
| 4569 | 4569 | |
| 4570 | 4570 | /** |
| 4571 | - * Gets all aircraft registration that have flown over by aircaft icao |
|
| 4572 | - * |
|
| 4573 | - * @return Array the aircraft list |
|
| 4574 | - * |
|
| 4575 | - */ |
|
| 4571 | + * Gets all aircraft registration that have flown over by aircaft icao |
|
| 4572 | + * |
|
| 4573 | + * @return Array the aircraft list |
|
| 4574 | + * |
|
| 4575 | + */ |
|
| 4576 | 4576 | public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
| 4577 | 4577 | { |
| 4578 | 4578 | $Image = new Image($this->db); |
@@ -4611,11 +4611,11 @@ discard block |
||
| 4611 | 4611 | |
| 4612 | 4612 | |
| 4613 | 4613 | /** |
| 4614 | - * Gets all aircraft types that have flown over by airline icao |
|
| 4615 | - * |
|
| 4616 | - * @return Array the aircraft list |
|
| 4617 | - * |
|
| 4618 | - */ |
|
| 4614 | + * Gets all aircraft types that have flown over by airline icao |
|
| 4615 | + * |
|
| 4616 | + * @return Array the aircraft list |
|
| 4617 | + * |
|
| 4618 | + */ |
|
| 4619 | 4619 | public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
| 4620 | 4620 | { |
| 4621 | 4621 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4644,11 +4644,11 @@ discard block |
||
| 4644 | 4644 | |
| 4645 | 4645 | |
| 4646 | 4646 | /** |
| 4647 | - * Gets all aircraft registration that have flown over by airline icao |
|
| 4648 | - * |
|
| 4649 | - * @return Array the aircraft list |
|
| 4650 | - * |
|
| 4651 | - */ |
|
| 4647 | + * Gets all aircraft registration that have flown over by airline icao |
|
| 4648 | + * |
|
| 4649 | + * @return Array the aircraft list |
|
| 4650 | + * |
|
| 4651 | + */ |
|
| 4652 | 4652 | public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
| 4653 | 4653 | { |
| 4654 | 4654 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4686,11 +4686,11 @@ discard block |
||
| 4686 | 4686 | |
| 4687 | 4687 | |
| 4688 | 4688 | /** |
| 4689 | - * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 4690 | - * |
|
| 4691 | - * @return Array the aircraft list |
|
| 4692 | - * |
|
| 4693 | - */ |
|
| 4689 | + * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 4690 | + * |
|
| 4691 | + * @return Array the aircraft list |
|
| 4692 | + * |
|
| 4693 | + */ |
|
| 4694 | 4694 | public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
| 4695 | 4695 | { |
| 4696 | 4696 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4718,11 +4718,11 @@ discard block |
||
| 4718 | 4718 | |
| 4719 | 4719 | |
| 4720 | 4720 | /** |
| 4721 | - * Gets all aircraft types that have flown over by airline icao |
|
| 4722 | - * |
|
| 4723 | - * @return Array the aircraft list |
|
| 4724 | - * |
|
| 4725 | - */ |
|
| 4721 | + * Gets all aircraft types that have flown over by airline icao |
|
| 4722 | + * |
|
| 4723 | + * @return Array the aircraft list |
|
| 4724 | + * |
|
| 4725 | + */ |
|
| 4726 | 4726 | public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
| 4727 | 4727 | { |
| 4728 | 4728 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4751,11 +4751,11 @@ discard block |
||
| 4751 | 4751 | |
| 4752 | 4752 | |
| 4753 | 4753 | /** |
| 4754 | - * Gets all aircraft registration that have flown over by airport icao |
|
| 4755 | - * |
|
| 4756 | - * @return Array the aircraft list |
|
| 4757 | - * |
|
| 4758 | - */ |
|
| 4754 | + * Gets all aircraft registration that have flown over by airport icao |
|
| 4755 | + * |
|
| 4756 | + * @return Array the aircraft list |
|
| 4757 | + * |
|
| 4758 | + */ |
|
| 4759 | 4759 | public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
| 4760 | 4760 | { |
| 4761 | 4761 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4792,11 +4792,11 @@ discard block |
||
| 4792 | 4792 | |
| 4793 | 4793 | |
| 4794 | 4794 | /** |
| 4795 | - * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 4796 | - * |
|
| 4797 | - * @return Array the aircraft list |
|
| 4798 | - * |
|
| 4799 | - */ |
|
| 4795 | + * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 4796 | + * |
|
| 4797 | + * @return Array the aircraft list |
|
| 4798 | + * |
|
| 4799 | + */ |
|
| 4800 | 4800 | public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
| 4801 | 4801 | { |
| 4802 | 4802 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4822,11 +4822,11 @@ discard block |
||
| 4822 | 4822 | } |
| 4823 | 4823 | |
| 4824 | 4824 | /** |
| 4825 | - * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 4826 | - * |
|
| 4827 | - * @return Array the aircraft list |
|
| 4828 | - * |
|
| 4829 | - */ |
|
| 4825 | + * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 4826 | + * |
|
| 4827 | + * @return Array the aircraft list |
|
| 4828 | + * |
|
| 4829 | + */ |
|
| 4830 | 4830 | public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4831 | 4831 | { |
| 4832 | 4832 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4853,11 +4853,11 @@ discard block |
||
| 4853 | 4853 | |
| 4854 | 4854 | |
| 4855 | 4855 | /** |
| 4856 | - * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 4857 | - * |
|
| 4858 | - * @return Array the aircraft list |
|
| 4859 | - * |
|
| 4860 | - */ |
|
| 4856 | + * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 4857 | + * |
|
| 4858 | + * @return Array the aircraft list |
|
| 4859 | + * |
|
| 4860 | + */ |
|
| 4861 | 4861 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 4862 | 4862 | { |
| 4863 | 4863 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4893,11 +4893,11 @@ discard block |
||
| 4893 | 4893 | } |
| 4894 | 4894 | |
| 4895 | 4895 | /** |
| 4896 | - * Gets all aircraft types that have flown over by date |
|
| 4897 | - * |
|
| 4898 | - * @return Array the aircraft list |
|
| 4899 | - * |
|
| 4900 | - */ |
|
| 4896 | + * Gets all aircraft types that have flown over by date |
|
| 4897 | + * |
|
| 4898 | + * @return Array the aircraft list |
|
| 4899 | + * |
|
| 4900 | + */ |
|
| 4901 | 4901 | public function countAllAircraftTypesByDate($date,$filters = array()) |
| 4902 | 4902 | { |
| 4903 | 4903 | global $globalTimezone, $globalDBdriver; |
@@ -4939,11 +4939,11 @@ discard block |
||
| 4939 | 4939 | |
| 4940 | 4940 | |
| 4941 | 4941 | /** |
| 4942 | - * Gets all aircraft registration that have flown over by date |
|
| 4943 | - * |
|
| 4944 | - * @return Array the aircraft list |
|
| 4945 | - * |
|
| 4946 | - */ |
|
| 4942 | + * Gets all aircraft registration that have flown over by date |
|
| 4943 | + * |
|
| 4944 | + * @return Array the aircraft list |
|
| 4945 | + * |
|
| 4946 | + */ |
|
| 4947 | 4947 | public function countAllAircraftRegistrationByDate($date,$filters = array()) |
| 4948 | 4948 | { |
| 4949 | 4949 | global $globalTimezone, $globalDBdriver; |
@@ -4994,11 +4994,11 @@ discard block |
||
| 4994 | 4994 | |
| 4995 | 4995 | |
| 4996 | 4996 | /** |
| 4997 | - * Gets all aircraft manufacturer that have flown over by date |
|
| 4998 | - * |
|
| 4999 | - * @return Array the aircraft manufacturer list |
|
| 5000 | - * |
|
| 5001 | - */ |
|
| 4997 | + * Gets all aircraft manufacturer that have flown over by date |
|
| 4998 | + * |
|
| 4999 | + * @return Array the aircraft manufacturer list |
|
| 5000 | + * |
|
| 5001 | + */ |
|
| 5002 | 5002 | public function countAllAircraftManufacturerByDate($date,$filters = array()) |
| 5003 | 5003 | { |
| 5004 | 5004 | global $globalTimezone, $globalDBdriver; |
@@ -5040,11 +5040,11 @@ discard block |
||
| 5040 | 5040 | |
| 5041 | 5041 | |
| 5042 | 5042 | /** |
| 5043 | - * Gets all aircraft types that have flown over by ident/callsign |
|
| 5044 | - * |
|
| 5045 | - * @return Array the aircraft list |
|
| 5046 | - * |
|
| 5047 | - */ |
|
| 5043 | + * Gets all aircraft types that have flown over by ident/callsign |
|
| 5044 | + * |
|
| 5045 | + * @return Array the aircraft list |
|
| 5046 | + * |
|
| 5047 | + */ |
|
| 5048 | 5048 | public function countAllAircraftTypesByIdent($ident,$filters = array()) |
| 5049 | 5049 | { |
| 5050 | 5050 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5073,11 +5073,11 @@ discard block |
||
| 5073 | 5073 | |
| 5074 | 5074 | |
| 5075 | 5075 | /** |
| 5076 | - * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5077 | - * |
|
| 5078 | - * @return Array the aircraft list |
|
| 5079 | - * |
|
| 5080 | - */ |
|
| 5076 | + * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5077 | + * |
|
| 5078 | + * @return Array the aircraft list |
|
| 5079 | + * |
|
| 5080 | + */ |
|
| 5081 | 5081 | public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
| 5082 | 5082 | { |
| 5083 | 5083 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5117,11 +5117,11 @@ discard block |
||
| 5117 | 5117 | |
| 5118 | 5118 | |
| 5119 | 5119 | /** |
| 5120 | - * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 5121 | - * |
|
| 5122 | - * @return Array the aircraft manufacturer list |
|
| 5123 | - * |
|
| 5124 | - */ |
|
| 5120 | + * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 5121 | + * |
|
| 5122 | + * @return Array the aircraft manufacturer list |
|
| 5123 | + * |
|
| 5124 | + */ |
|
| 5125 | 5125 | public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
| 5126 | 5126 | { |
| 5127 | 5127 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5147,11 +5147,11 @@ discard block |
||
| 5147 | 5147 | |
| 5148 | 5148 | |
| 5149 | 5149 | /** |
| 5150 | - * Gets all aircraft types that have flown over by route |
|
| 5151 | - * |
|
| 5152 | - * @return Array the aircraft list |
|
| 5153 | - * |
|
| 5154 | - */ |
|
| 5150 | + * Gets all aircraft types that have flown over by route |
|
| 5151 | + * |
|
| 5152 | + * @return Array the aircraft list |
|
| 5153 | + * |
|
| 5154 | + */ |
|
| 5155 | 5155 | public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5156 | 5156 | { |
| 5157 | 5157 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5180,11 +5180,11 @@ discard block |
||
| 5180 | 5180 | } |
| 5181 | 5181 | |
| 5182 | 5182 | /** |
| 5183 | - * Gets all aircraft registration that have flown over by route |
|
| 5184 | - * |
|
| 5185 | - * @return Array the aircraft list |
|
| 5186 | - * |
|
| 5187 | - */ |
|
| 5183 | + * Gets all aircraft registration that have flown over by route |
|
| 5184 | + * |
|
| 5185 | + * @return Array the aircraft list |
|
| 5186 | + * |
|
| 5187 | + */ |
|
| 5188 | 5188 | public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5189 | 5189 | { |
| 5190 | 5190 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5226,11 +5226,11 @@ discard block |
||
| 5226 | 5226 | |
| 5227 | 5227 | |
| 5228 | 5228 | /** |
| 5229 | - * Gets all aircraft manufacturer that have flown over by route |
|
| 5230 | - * |
|
| 5231 | - * @return Array the aircraft manufacturer list |
|
| 5232 | - * |
|
| 5233 | - */ |
|
| 5229 | + * Gets all aircraft manufacturer that have flown over by route |
|
| 5230 | + * |
|
| 5231 | + * @return Array the aircraft manufacturer list |
|
| 5232 | + * |
|
| 5233 | + */ |
|
| 5234 | 5234 | public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5235 | 5235 | { |
| 5236 | 5236 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5264,11 +5264,11 @@ discard block |
||
| 5264 | 5264 | |
| 5265 | 5265 | |
| 5266 | 5266 | /** |
| 5267 | - * Gets all aircraft types that have flown over by country |
|
| 5268 | - * |
|
| 5269 | - * @return Array the aircraft list |
|
| 5270 | - * |
|
| 5271 | - */ |
|
| 5267 | + * Gets all aircraft types that have flown over by country |
|
| 5268 | + * |
|
| 5269 | + * @return Array the aircraft list |
|
| 5270 | + * |
|
| 5271 | + */ |
|
| 5272 | 5272 | public function countAllAircraftTypesByCountry($country,$filters = array()) |
| 5273 | 5273 | { |
| 5274 | 5274 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5299,11 +5299,11 @@ discard block |
||
| 5299 | 5299 | |
| 5300 | 5300 | |
| 5301 | 5301 | /** |
| 5302 | - * Gets all aircraft registration that have flown over by country |
|
| 5303 | - * |
|
| 5304 | - * @return Array the aircraft list |
|
| 5305 | - * |
|
| 5306 | - */ |
|
| 5302 | + * Gets all aircraft registration that have flown over by country |
|
| 5303 | + * |
|
| 5304 | + * @return Array the aircraft list |
|
| 5305 | + * |
|
| 5306 | + */ |
|
| 5307 | 5307 | public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
| 5308 | 5308 | { |
| 5309 | 5309 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5343,11 +5343,11 @@ discard block |
||
| 5343 | 5343 | |
| 5344 | 5344 | |
| 5345 | 5345 | /** |
| 5346 | - * Gets all aircraft manufacturer that have flown over by country |
|
| 5347 | - * |
|
| 5348 | - * @return Array the aircraft manufacturer list |
|
| 5349 | - * |
|
| 5350 | - */ |
|
| 5346 | + * Gets all aircraft manufacturer that have flown over by country |
|
| 5347 | + * |
|
| 5348 | + * @return Array the aircraft manufacturer list |
|
| 5349 | + * |
|
| 5350 | + */ |
|
| 5351 | 5351 | public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
| 5352 | 5352 | { |
| 5353 | 5353 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5378,17 +5378,17 @@ discard block |
||
| 5378 | 5378 | |
| 5379 | 5379 | |
| 5380 | 5380 | /** |
| 5381 | - * Gets all aircraft manufacturers that have flown over |
|
| 5382 | - * |
|
| 5383 | - * @return Array the aircraft list |
|
| 5384 | - * |
|
| 5385 | - */ |
|
| 5381 | + * Gets all aircraft manufacturers that have flown over |
|
| 5382 | + * |
|
| 5383 | + * @return Array the aircraft list |
|
| 5384 | + * |
|
| 5385 | + */ |
|
| 5386 | 5386 | public function countAllAircraftManufacturers($filters = array()) |
| 5387 | 5387 | { |
| 5388 | 5388 | $filter_query = $this->getFilter($filters,true,true); |
| 5389 | 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 | - $query .= " GROUP BY spotter_output.aircraft_manufacturer |
|
| 5391 | + $query .= " GROUP BY spotter_output.aircraft_manufacturer |
|
| 5392 | 5392 | ORDER BY aircraft_manufacturer_count DESC |
| 5393 | 5393 | LIMIT 10"; |
| 5394 | 5394 | |
@@ -5413,11 +5413,11 @@ discard block |
||
| 5413 | 5413 | |
| 5414 | 5414 | |
| 5415 | 5415 | /** |
| 5416 | - * Gets all aircraft registrations that have flown over |
|
| 5417 | - * |
|
| 5418 | - * @return Array the aircraft list |
|
| 5419 | - * |
|
| 5420 | - */ |
|
| 5416 | + * Gets all aircraft registrations that have flown over |
|
| 5417 | + * |
|
| 5418 | + * @return Array the aircraft list |
|
| 5419 | + * |
|
| 5420 | + */ |
|
| 5421 | 5421 | public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5422 | 5422 | { |
| 5423 | 5423 | global $globalDBdriver; |
@@ -5425,15 +5425,15 @@ discard block |
||
| 5425 | 5425 | $filter_query = $this->getFilter($filters,true,true); |
| 5426 | 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 | - if ($olderthanmonths > 0) { |
|
| 5429 | - if ($globalDBdriver == 'mysql') { |
|
| 5428 | + if ($olderthanmonths > 0) { |
|
| 5429 | + if ($globalDBdriver == 'mysql') { |
|
| 5430 | 5430 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 5431 | 5431 | } else { |
| 5432 | 5432 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5433 | 5433 | } |
| 5434 | 5434 | } |
| 5435 | - if ($sincedate != '') { |
|
| 5436 | - if ($globalDBdriver == 'mysql') { |
|
| 5435 | + if ($sincedate != '') { |
|
| 5436 | + if ($globalDBdriver == 'mysql') { |
|
| 5437 | 5437 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 5438 | 5438 | } else { |
| 5439 | 5439 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5442,7 +5442,7 @@ discard block |
||
| 5442 | 5442 | |
| 5443 | 5443 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5444 | 5444 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5445 | - $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 5445 | + $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 5446 | 5446 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5447 | 5447 | |
| 5448 | 5448 | $sth = $this->db->prepare($query); |
@@ -5473,11 +5473,11 @@ discard block |
||
| 5473 | 5473 | |
| 5474 | 5474 | |
| 5475 | 5475 | /** |
| 5476 | - * Gets all aircraft registrations that have flown over |
|
| 5477 | - * |
|
| 5478 | - * @return Array the aircraft list |
|
| 5479 | - * |
|
| 5480 | - */ |
|
| 5476 | + * Gets all aircraft registrations that have flown over |
|
| 5477 | + * |
|
| 5478 | + * @return Array the aircraft list |
|
| 5479 | + * |
|
| 5480 | + */ |
|
| 5481 | 5481 | public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5482 | 5482 | { |
| 5483 | 5483 | global $globalDBdriver; |
@@ -5485,15 +5485,15 @@ discard block |
||
| 5485 | 5485 | $Image = new Image($this->db); |
| 5486 | 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 | - if ($olderthanmonths > 0) { |
|
| 5489 | - if ($globalDBdriver == 'mysql') { |
|
| 5488 | + if ($olderthanmonths > 0) { |
|
| 5489 | + if ($globalDBdriver == 'mysql') { |
|
| 5490 | 5490 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5491 | 5491 | } else { |
| 5492 | 5492 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 5493 | 5493 | } |
| 5494 | 5494 | } |
| 5495 | - if ($sincedate != '') { |
|
| 5496 | - if ($globalDBdriver == 'mysql') { |
|
| 5495 | + if ($sincedate != '') { |
|
| 5496 | + if ($globalDBdriver == 'mysql') { |
|
| 5497 | 5497 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 5498 | 5498 | } else { |
| 5499 | 5499 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5502,7 +5502,7 @@ discard block |
||
| 5502 | 5502 | |
| 5503 | 5503 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5504 | 5504 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5505 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 5505 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 5506 | 5506 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5507 | 5507 | |
| 5508 | 5508 | $sth = $this->db->prepare($query); |
@@ -5534,35 +5534,35 @@ discard block |
||
| 5534 | 5534 | |
| 5535 | 5535 | |
| 5536 | 5536 | /** |
| 5537 | - * Gets all departure airports of the airplanes that have flown over |
|
| 5538 | - * |
|
| 5539 | - * @return Array the airport list |
|
| 5540 | - * |
|
| 5541 | - */ |
|
| 5537 | + * Gets all departure airports of the airplanes that have flown over |
|
| 5538 | + * |
|
| 5539 | + * @return Array the airport list |
|
| 5540 | + * |
|
| 5541 | + */ |
|
| 5542 | 5542 | public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 5543 | 5543 | { |
| 5544 | 5544 | global $globalDBdriver; |
| 5545 | 5545 | $filter_query = $this->getFilter($filters,true,true); |
| 5546 | 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 | - if ($olderthanmonths > 0) { |
|
| 5549 | - if ($globalDBdriver == 'mysql') { |
|
| 5548 | + if ($olderthanmonths > 0) { |
|
| 5549 | + if ($globalDBdriver == 'mysql') { |
|
| 5550 | 5550 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 5551 | 5551 | } else { |
| 5552 | 5552 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5553 | 5553 | } |
| 5554 | - } |
|
| 5555 | - if ($sincedate != '') { |
|
| 5556 | - if ($globalDBdriver == 'mysql') { |
|
| 5554 | + } |
|
| 5555 | + if ($sincedate != '') { |
|
| 5556 | + if ($globalDBdriver == 'mysql') { |
|
| 5557 | 5557 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 5558 | 5558 | } else { |
| 5559 | 5559 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 5560 | 5560 | } |
| 5561 | 5561 | } |
| 5562 | 5562 | |
| 5563 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5564 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5565 | - $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5563 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5564 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5565 | + $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5566 | 5566 | ORDER BY airport_departure_icao_count DESC"; |
| 5567 | 5567 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5568 | 5568 | |
@@ -5586,35 +5586,35 @@ discard block |
||
| 5586 | 5586 | } |
| 5587 | 5587 | |
| 5588 | 5588 | /** |
| 5589 | - * Gets all departure airports of the airplanes that have flown over |
|
| 5590 | - * |
|
| 5591 | - * @return Array the airport list |
|
| 5592 | - * |
|
| 5593 | - */ |
|
| 5589 | + * Gets all departure airports of the airplanes that have flown over |
|
| 5590 | + * |
|
| 5591 | + * @return Array the airport list |
|
| 5592 | + * |
|
| 5593 | + */ |
|
| 5594 | 5594 | public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 5595 | 5595 | { |
| 5596 | 5596 | global $globalDBdriver; |
| 5597 | 5597 | $filter_query = $this->getFilter($filters,true,true); |
| 5598 | 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 | - if ($olderthanmonths > 0) { |
|
| 5601 | - if ($globalDBdriver == 'mysql') { |
|
| 5600 | + if ($olderthanmonths > 0) { |
|
| 5601 | + if ($globalDBdriver == 'mysql') { |
|
| 5602 | 5602 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5603 | 5603 | } else { |
| 5604 | 5604 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 5605 | 5605 | } |
| 5606 | - } |
|
| 5607 | - if ($sincedate != '') { |
|
| 5608 | - if ($globalDBdriver == 'mysql') { |
|
| 5606 | + } |
|
| 5607 | + if ($sincedate != '') { |
|
| 5608 | + if ($globalDBdriver == 'mysql') { |
|
| 5609 | 5609 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 5610 | 5610 | } else { |
| 5611 | 5611 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 5612 | 5612 | } |
| 5613 | 5613 | } |
| 5614 | 5614 | |
| 5615 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5616 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5617 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5615 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5616 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5617 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5618 | 5618 | ORDER BY airport_departure_icao_count DESC"; |
| 5619 | 5619 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5620 | 5620 | |
@@ -5639,37 +5639,37 @@ discard block |
||
| 5639 | 5639 | } |
| 5640 | 5640 | |
| 5641 | 5641 | /** |
| 5642 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 5643 | - * |
|
| 5644 | - * @return Array the airport list |
|
| 5645 | - * |
|
| 5646 | - */ |
|
| 5642 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 5643 | + * |
|
| 5644 | + * @return Array the airport list |
|
| 5645 | + * |
|
| 5646 | + */ |
|
| 5647 | 5647 | public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 5648 | 5648 | { |
| 5649 | 5649 | global $globalDBdriver; |
| 5650 | 5650 | $filter_query = $this->getFilter($filters,true,true); |
| 5651 | 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 | - if ($olderthanmonths > 0) { |
|
| 5654 | - if ($globalDBdriver == 'mysql') { |
|
| 5653 | + if ($olderthanmonths > 0) { |
|
| 5654 | + if ($globalDBdriver == 'mysql') { |
|
| 5655 | 5655 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 5656 | 5656 | } else { |
| 5657 | 5657 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5658 | 5658 | } |
| 5659 | - } |
|
| 5660 | - if ($sincedate != '') { |
|
| 5661 | - if ($globalDBdriver == 'mysql') { |
|
| 5659 | + } |
|
| 5660 | + if ($sincedate != '') { |
|
| 5661 | + if ($globalDBdriver == 'mysql') { |
|
| 5662 | 5662 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 5663 | 5663 | } else { |
| 5664 | 5664 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 5665 | 5665 | } |
| 5666 | 5666 | } |
| 5667 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5668 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5669 | - $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 5667 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5668 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5669 | + $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 5670 | 5670 | ORDER BY airport_departure_icao_count DESC"; |
| 5671 | 5671 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5672 | - //echo $query; |
|
| 5672 | + //echo $query; |
|
| 5673 | 5673 | $sth = $this->db->prepare($query); |
| 5674 | 5674 | $sth->execute(); |
| 5675 | 5675 | |
@@ -5690,35 +5690,35 @@ discard block |
||
| 5690 | 5690 | } |
| 5691 | 5691 | |
| 5692 | 5692 | /** |
| 5693 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 5694 | - * |
|
| 5695 | - * @return Array the airport list |
|
| 5696 | - * |
|
| 5697 | - */ |
|
| 5693 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 5694 | + * |
|
| 5695 | + * @return Array the airport list |
|
| 5696 | + * |
|
| 5697 | + */ |
|
| 5698 | 5698 | public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 5699 | 5699 | { |
| 5700 | 5700 | global $globalDBdriver; |
| 5701 | 5701 | $filter_query = $this->getFilter($filters,true,true); |
| 5702 | 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 | - if ($olderthanmonths > 0) { |
|
| 5705 | - if ($globalDBdriver == 'mysql') { |
|
| 5704 | + if ($olderthanmonths > 0) { |
|
| 5705 | + if ($globalDBdriver == 'mysql') { |
|
| 5706 | 5706 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5707 | 5707 | } else { |
| 5708 | 5708 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 5709 | 5709 | } |
| 5710 | - } |
|
| 5711 | - if ($sincedate != '') { |
|
| 5712 | - if ($globalDBdriver == 'mysql') { |
|
| 5710 | + } |
|
| 5711 | + if ($sincedate != '') { |
|
| 5712 | + if ($globalDBdriver == 'mysql') { |
|
| 5713 | 5713 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 5714 | 5714 | } else { |
| 5715 | 5715 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
| 5716 | 5716 | } |
| 5717 | 5717 | } |
| 5718 | 5718 | |
| 5719 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5720 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5721 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 5719 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5720 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5721 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 5722 | 5722 | ORDER BY airport_departure_icao_count DESC"; |
| 5723 | 5723 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5724 | 5724 | |
@@ -5743,11 +5743,11 @@ discard block |
||
| 5743 | 5743 | } |
| 5744 | 5744 | |
| 5745 | 5745 | /** |
| 5746 | - * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 5747 | - * |
|
| 5748 | - * @return Array the airport list |
|
| 5749 | - * |
|
| 5750 | - */ |
|
| 5746 | + * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 5747 | + * |
|
| 5748 | + * @return Array the airport list |
|
| 5749 | + * |
|
| 5750 | + */ |
|
| 5751 | 5751 | public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
| 5752 | 5752 | { |
| 5753 | 5753 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5781,11 +5781,11 @@ discard block |
||
| 5781 | 5781 | |
| 5782 | 5782 | |
| 5783 | 5783 | /** |
| 5784 | - * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 5785 | - * |
|
| 5786 | - * @return Array the airport list |
|
| 5787 | - * |
|
| 5788 | - */ |
|
| 5784 | + * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 5785 | + * |
|
| 5786 | + * @return Array the airport list |
|
| 5787 | + * |
|
| 5788 | + */ |
|
| 5789 | 5789 | public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
| 5790 | 5790 | { |
| 5791 | 5791 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5816,11 +5816,11 @@ discard block |
||
| 5816 | 5816 | |
| 5817 | 5817 | |
| 5818 | 5818 | /** |
| 5819 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 5820 | - * |
|
| 5821 | - * @return Array the airport list |
|
| 5822 | - * |
|
| 5823 | - */ |
|
| 5819 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 5820 | + * |
|
| 5821 | + * @return Array the airport list |
|
| 5822 | + * |
|
| 5823 | + */ |
|
| 5824 | 5824 | public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
| 5825 | 5825 | { |
| 5826 | 5826 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5853,11 +5853,11 @@ discard block |
||
| 5853 | 5853 | |
| 5854 | 5854 | |
| 5855 | 5855 | /** |
| 5856 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 5857 | - * |
|
| 5858 | - * @return Array the airport list |
|
| 5859 | - * |
|
| 5860 | - */ |
|
| 5856 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 5857 | + * |
|
| 5858 | + * @return Array the airport list |
|
| 5859 | + * |
|
| 5860 | + */ |
|
| 5861 | 5861 | public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 5862 | 5862 | { |
| 5863 | 5863 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5887,11 +5887,11 @@ discard block |
||
| 5887 | 5887 | |
| 5888 | 5888 | |
| 5889 | 5889 | /** |
| 5890 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 5891 | - * |
|
| 5892 | - * @return Array the airport list |
|
| 5893 | - * |
|
| 5894 | - */ |
|
| 5890 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 5891 | + * |
|
| 5892 | + * @return Array the airport list |
|
| 5893 | + * |
|
| 5894 | + */ |
|
| 5895 | 5895 | public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
| 5896 | 5896 | { |
| 5897 | 5897 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5924,11 +5924,11 @@ discard block |
||
| 5924 | 5924 | |
| 5925 | 5925 | |
| 5926 | 5926 | /** |
| 5927 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 5928 | - * |
|
| 5929 | - * @return Array the airport list |
|
| 5930 | - * |
|
| 5931 | - */ |
|
| 5927 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 5928 | + * |
|
| 5929 | + * @return Array the airport list |
|
| 5930 | + * |
|
| 5931 | + */ |
|
| 5932 | 5932 | public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
| 5933 | 5933 | { |
| 5934 | 5934 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5958,11 +5958,11 @@ discard block |
||
| 5958 | 5958 | |
| 5959 | 5959 | |
| 5960 | 5960 | /** |
| 5961 | - * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 5962 | - * |
|
| 5963 | - * @return Array the airport list |
|
| 5964 | - * |
|
| 5965 | - */ |
|
| 5961 | + * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 5962 | + * |
|
| 5963 | + * @return Array the airport list |
|
| 5964 | + * |
|
| 5965 | + */ |
|
| 5966 | 5966 | public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
| 5967 | 5967 | { |
| 5968 | 5968 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5995,11 +5995,11 @@ discard block |
||
| 5995 | 5995 | |
| 5996 | 5996 | |
| 5997 | 5997 | /** |
| 5998 | - * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 5999 | - * |
|
| 6000 | - * @return Array the airport list |
|
| 6001 | - * |
|
| 6002 | - */ |
|
| 5998 | + * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 5999 | + * |
|
| 6000 | + * @return Array the airport list |
|
| 6001 | + * |
|
| 6002 | + */ |
|
| 6003 | 6003 | public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
| 6004 | 6004 | { |
| 6005 | 6005 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6030,11 +6030,11 @@ discard block |
||
| 6030 | 6030 | |
| 6031 | 6031 | |
| 6032 | 6032 | /** |
| 6033 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6034 | - * |
|
| 6035 | - * @return Array the airport list |
|
| 6036 | - * |
|
| 6037 | - */ |
|
| 6033 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6034 | + * |
|
| 6035 | + * @return Array the airport list |
|
| 6036 | + * |
|
| 6037 | + */ |
|
| 6038 | 6038 | public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 6039 | 6039 | { |
| 6040 | 6040 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6067,11 +6067,11 @@ discard block |
||
| 6067 | 6067 | |
| 6068 | 6068 | |
| 6069 | 6069 | /** |
| 6070 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6071 | - * |
|
| 6072 | - * @return Array the airport list |
|
| 6073 | - * |
|
| 6074 | - */ |
|
| 6070 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6071 | + * |
|
| 6072 | + * @return Array the airport list |
|
| 6073 | + * |
|
| 6074 | + */ |
|
| 6075 | 6075 | public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 6076 | 6076 | { |
| 6077 | 6077 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6101,11 +6101,11 @@ discard block |
||
| 6101 | 6101 | |
| 6102 | 6102 | |
| 6103 | 6103 | /** |
| 6104 | - * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 6105 | - * |
|
| 6106 | - * @return Array the airport list |
|
| 6107 | - * |
|
| 6108 | - */ |
|
| 6104 | + * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 6105 | + * |
|
| 6106 | + * @return Array the airport list |
|
| 6107 | + * |
|
| 6108 | + */ |
|
| 6109 | 6109 | public function countAllDepartureAirportsByDate($date,$filters = array()) |
| 6110 | 6110 | { |
| 6111 | 6111 | global $globalTimezone, $globalDBdriver; |
@@ -6151,11 +6151,11 @@ discard block |
||
| 6151 | 6151 | |
| 6152 | 6152 | |
| 6153 | 6153 | /** |
| 6154 | - * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 6155 | - * |
|
| 6156 | - * @return Array the airport list |
|
| 6157 | - * |
|
| 6158 | - */ |
|
| 6154 | + * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 6155 | + * |
|
| 6156 | + * @return Array the airport list |
|
| 6157 | + * |
|
| 6158 | + */ |
|
| 6159 | 6159 | public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
| 6160 | 6160 | { |
| 6161 | 6161 | global $globalTimezone, $globalDBdriver; |
@@ -6198,11 +6198,11 @@ discard block |
||
| 6198 | 6198 | |
| 6199 | 6199 | |
| 6200 | 6200 | /** |
| 6201 | - * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 6202 | - * |
|
| 6203 | - * @return Array the airport list |
|
| 6204 | - * |
|
| 6205 | - */ |
|
| 6201 | + * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 6202 | + * |
|
| 6203 | + * @return Array the airport list |
|
| 6204 | + * |
|
| 6205 | + */ |
|
| 6206 | 6206 | public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
| 6207 | 6207 | { |
| 6208 | 6208 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6236,11 +6236,11 @@ discard block |
||
| 6236 | 6236 | |
| 6237 | 6237 | |
| 6238 | 6238 | /** |
| 6239 | - * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 6240 | - * |
|
| 6241 | - * @return Array the airport list |
|
| 6242 | - * |
|
| 6243 | - */ |
|
| 6239 | + * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 6240 | + * |
|
| 6241 | + * @return Array the airport list |
|
| 6242 | + * |
|
| 6243 | + */ |
|
| 6244 | 6244 | public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
| 6245 | 6245 | { |
| 6246 | 6246 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6271,11 +6271,11 @@ discard block |
||
| 6271 | 6271 | |
| 6272 | 6272 | |
| 6273 | 6273 | /** |
| 6274 | - * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 6275 | - * |
|
| 6276 | - * @return Array the airport list |
|
| 6277 | - * |
|
| 6278 | - */ |
|
| 6274 | + * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 6275 | + * |
|
| 6276 | + * @return Array the airport list |
|
| 6277 | + * |
|
| 6278 | + */ |
|
| 6279 | 6279 | public function countAllDepartureAirportsByCountry($country,$filters = array()) |
| 6280 | 6280 | { |
| 6281 | 6281 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6309,11 +6309,11 @@ discard block |
||
| 6309 | 6309 | |
| 6310 | 6310 | |
| 6311 | 6311 | /** |
| 6312 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6313 | - * |
|
| 6314 | - * @return Array the airport list |
|
| 6315 | - * |
|
| 6316 | - */ |
|
| 6312 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6313 | + * |
|
| 6314 | + * @return Array the airport list |
|
| 6315 | + * |
|
| 6316 | + */ |
|
| 6317 | 6317 | public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
| 6318 | 6318 | { |
| 6319 | 6319 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6343,40 +6343,40 @@ discard block |
||
| 6343 | 6343 | |
| 6344 | 6344 | |
| 6345 | 6345 | /** |
| 6346 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 6347 | - * |
|
| 6348 | - * @return Array the airport list |
|
| 6349 | - * |
|
| 6350 | - */ |
|
| 6346 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 6347 | + * |
|
| 6348 | + * @return Array the airport list |
|
| 6349 | + * |
|
| 6350 | + */ |
|
| 6351 | 6351 | public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
| 6352 | 6352 | { |
| 6353 | 6353 | global $globalDBdriver; |
| 6354 | 6354 | $filter_query = $this->getFilter($filters,true,true); |
| 6355 | 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 | - if ($olderthanmonths > 0) { |
|
| 6358 | - if ($globalDBdriver == 'mysql') { |
|
| 6357 | + if ($olderthanmonths > 0) { |
|
| 6358 | + if ($globalDBdriver == 'mysql') { |
|
| 6359 | 6359 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6360 | 6360 | } else { |
| 6361 | 6361 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6362 | 6362 | } |
| 6363 | - if ($sincedate != '') { |
|
| 6364 | - if ($globalDBdriver == 'mysql') { |
|
| 6363 | + if ($sincedate != '') { |
|
| 6364 | + if ($globalDBdriver == 'mysql') { |
|
| 6365 | 6365 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6366 | 6366 | } else { |
| 6367 | 6367 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6368 | 6368 | } |
| 6369 | 6369 | } |
| 6370 | - if ($globalDBdriver == 'mysql') { |
|
| 6370 | + if ($globalDBdriver == 'mysql') { |
|
| 6371 | 6371 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6372 | 6372 | } else { |
| 6373 | 6373 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6374 | 6374 | } |
| 6375 | 6375 | } |
| 6376 | 6376 | |
| 6377 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6378 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6379 | - $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6377 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6378 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6379 | + $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6380 | 6380 | ORDER BY airport_arrival_icao_count DESC"; |
| 6381 | 6381 | if ($limit) $query .= " LIMIT 10"; |
| 6382 | 6382 | |
@@ -6405,40 +6405,40 @@ discard block |
||
| 6405 | 6405 | } |
| 6406 | 6406 | |
| 6407 | 6407 | /** |
| 6408 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 6409 | - * |
|
| 6410 | - * @return Array the airport list |
|
| 6411 | - * |
|
| 6412 | - */ |
|
| 6408 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 6409 | + * |
|
| 6410 | + * @return Array the airport list |
|
| 6411 | + * |
|
| 6412 | + */ |
|
| 6413 | 6413 | public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
| 6414 | 6414 | { |
| 6415 | 6415 | global $globalDBdriver; |
| 6416 | 6416 | $filter_query = $this->getFilter($filters,true,true); |
| 6417 | 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 | - if ($olderthanmonths > 0) { |
|
| 6420 | - if ($globalDBdriver == 'mysql') { |
|
| 6419 | + if ($olderthanmonths > 0) { |
|
| 6420 | + if ($globalDBdriver == 'mysql') { |
|
| 6421 | 6421 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6422 | 6422 | } else { |
| 6423 | 6423 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6424 | 6424 | } |
| 6425 | - if ($sincedate != '') { |
|
| 6426 | - if ($globalDBdriver == 'mysql') { |
|
| 6425 | + if ($sincedate != '') { |
|
| 6426 | + if ($globalDBdriver == 'mysql') { |
|
| 6427 | 6427 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6428 | 6428 | } else { |
| 6429 | 6429 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6430 | 6430 | } |
| 6431 | 6431 | } |
| 6432 | - if ($globalDBdriver == 'mysql') { |
|
| 6432 | + if ($globalDBdriver == 'mysql') { |
|
| 6433 | 6433 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6434 | 6434 | } else { |
| 6435 | 6435 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6436 | 6436 | } |
| 6437 | 6437 | } |
| 6438 | 6438 | |
| 6439 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6440 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6441 | - $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6439 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6440 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6441 | + $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6442 | 6442 | ORDER BY airport_arrival_icao_count DESC"; |
| 6443 | 6443 | if ($limit) $query .= " LIMIT 10"; |
| 6444 | 6444 | |
@@ -6469,39 +6469,39 @@ discard block |
||
| 6469 | 6469 | |
| 6470 | 6470 | |
| 6471 | 6471 | /** |
| 6472 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6473 | - * |
|
| 6474 | - * @return Array the airport list |
|
| 6475 | - * |
|
| 6476 | - */ |
|
| 6472 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6473 | + * |
|
| 6474 | + * @return Array the airport list |
|
| 6475 | + * |
|
| 6476 | + */ |
|
| 6477 | 6477 | public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
| 6478 | 6478 | { |
| 6479 | 6479 | global $globalDBdriver; |
| 6480 | 6480 | $filter_query = $this->getFilter($filters,true,true); |
| 6481 | 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 | - if ($olderthanmonths > 0) { |
|
| 6484 | - if ($globalDBdriver == 'mysql') { |
|
| 6483 | + if ($olderthanmonths > 0) { |
|
| 6484 | + if ($globalDBdriver == 'mysql') { |
|
| 6485 | 6485 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6486 | 6486 | } else { |
| 6487 | 6487 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6488 | 6488 | } |
| 6489 | - if ($sincedate != '') { |
|
| 6490 | - if ($globalDBdriver == 'mysql') { |
|
| 6489 | + if ($sincedate != '') { |
|
| 6490 | + if ($globalDBdriver == 'mysql') { |
|
| 6491 | 6491 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6492 | 6492 | } else { |
| 6493 | 6493 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6494 | 6494 | } |
| 6495 | 6495 | } |
| 6496 | - if ($globalDBdriver == 'mysql') { |
|
| 6496 | + if ($globalDBdriver == 'mysql') { |
|
| 6497 | 6497 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6498 | 6498 | } else { |
| 6499 | 6499 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6500 | 6500 | } |
| 6501 | 6501 | } |
| 6502 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6503 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6504 | - $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6502 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6503 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6504 | + $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6505 | 6505 | ORDER BY airport_arrival_icao_count DESC"; |
| 6506 | 6506 | if ($limit) $query .= " LIMIT 10"; |
| 6507 | 6507 | |
@@ -6530,40 +6530,40 @@ discard block |
||
| 6530 | 6530 | } |
| 6531 | 6531 | |
| 6532 | 6532 | /** |
| 6533 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6534 | - * |
|
| 6535 | - * @return Array the airport list |
|
| 6536 | - * |
|
| 6537 | - */ |
|
| 6533 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6534 | + * |
|
| 6535 | + * @return Array the airport list |
|
| 6536 | + * |
|
| 6537 | + */ |
|
| 6538 | 6538 | public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
| 6539 | 6539 | { |
| 6540 | 6540 | global $globalDBdriver; |
| 6541 | 6541 | $filter_query = $this->getFilter($filters,true,true); |
| 6542 | 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 | - if ($olderthanmonths > 0) { |
|
| 6545 | - if ($globalDBdriver == 'mysql') { |
|
| 6544 | + if ($olderthanmonths > 0) { |
|
| 6545 | + if ($globalDBdriver == 'mysql') { |
|
| 6546 | 6546 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6547 | 6547 | } else { |
| 6548 | 6548 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6549 | 6549 | } |
| 6550 | - if ($sincedate != '') { |
|
| 6551 | - if ($globalDBdriver == 'mysql') { |
|
| 6550 | + if ($sincedate != '') { |
|
| 6551 | + if ($globalDBdriver == 'mysql') { |
|
| 6552 | 6552 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6553 | 6553 | } else { |
| 6554 | 6554 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6555 | 6555 | } |
| 6556 | 6556 | } |
| 6557 | - if ($globalDBdriver == 'mysql') { |
|
| 6557 | + if ($globalDBdriver == 'mysql') { |
|
| 6558 | 6558 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6559 | 6559 | } else { |
| 6560 | 6560 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6561 | 6561 | } |
| 6562 | 6562 | } |
| 6563 | 6563 | |
| 6564 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6565 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6566 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6564 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6565 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6566 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6567 | 6567 | ORDER BY airport_arrival_icao_count DESC"; |
| 6568 | 6568 | if ($limit) $query .= " LIMIT 10"; |
| 6569 | 6569 | |
@@ -6593,11 +6593,11 @@ discard block |
||
| 6593 | 6593 | } |
| 6594 | 6594 | |
| 6595 | 6595 | /** |
| 6596 | - * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 6597 | - * |
|
| 6598 | - * @return Array the airport list |
|
| 6599 | - * |
|
| 6600 | - */ |
|
| 6596 | + * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 6597 | + * |
|
| 6598 | + * @return Array the airport list |
|
| 6599 | + * |
|
| 6600 | + */ |
|
| 6601 | 6601 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 6602 | 6602 | { |
| 6603 | 6603 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6629,11 +6629,11 @@ discard block |
||
| 6629 | 6629 | |
| 6630 | 6630 | |
| 6631 | 6631 | /** |
| 6632 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 6633 | - * |
|
| 6634 | - * @return Array the airport list |
|
| 6635 | - * |
|
| 6636 | - */ |
|
| 6632 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 6633 | + * |
|
| 6634 | + * @return Array the airport list |
|
| 6635 | + * |
|
| 6636 | + */ |
|
| 6637 | 6637 | public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
| 6638 | 6638 | { |
| 6639 | 6639 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6664,11 +6664,11 @@ discard block |
||
| 6664 | 6664 | |
| 6665 | 6665 | |
| 6666 | 6666 | /** |
| 6667 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 6668 | - * |
|
| 6669 | - * @return Array the airport list |
|
| 6670 | - * |
|
| 6671 | - */ |
|
| 6667 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 6668 | + * |
|
| 6669 | + * @return Array the airport list |
|
| 6670 | + * |
|
| 6671 | + */ |
|
| 6672 | 6672 | public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
| 6673 | 6673 | { |
| 6674 | 6674 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6702,11 +6702,11 @@ discard block |
||
| 6702 | 6702 | |
| 6703 | 6703 | |
| 6704 | 6704 | /** |
| 6705 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6706 | - * |
|
| 6707 | - * @return Array the airport list |
|
| 6708 | - * |
|
| 6709 | - */ |
|
| 6705 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6706 | + * |
|
| 6707 | + * @return Array the airport list |
|
| 6708 | + * |
|
| 6709 | + */ |
|
| 6710 | 6710 | public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 6711 | 6711 | { |
| 6712 | 6712 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6736,11 +6736,11 @@ discard block |
||
| 6736 | 6736 | |
| 6737 | 6737 | |
| 6738 | 6738 | /** |
| 6739 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 6740 | - * |
|
| 6741 | - * @return Array the airport list |
|
| 6742 | - * |
|
| 6743 | - */ |
|
| 6739 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 6740 | + * |
|
| 6741 | + * @return Array the airport list |
|
| 6742 | + * |
|
| 6743 | + */ |
|
| 6744 | 6744 | public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
| 6745 | 6745 | { |
| 6746 | 6746 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6774,11 +6774,11 @@ discard block |
||
| 6774 | 6774 | |
| 6775 | 6775 | |
| 6776 | 6776 | /** |
| 6777 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 6778 | - * |
|
| 6779 | - * @return Array the airport list |
|
| 6780 | - * |
|
| 6781 | - */ |
|
| 6777 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 6778 | + * |
|
| 6779 | + * @return Array the airport list |
|
| 6780 | + * |
|
| 6781 | + */ |
|
| 6782 | 6782 | public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
| 6783 | 6783 | { |
| 6784 | 6784 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6809,11 +6809,11 @@ discard block |
||
| 6809 | 6809 | |
| 6810 | 6810 | |
| 6811 | 6811 | /** |
| 6812 | - * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 6813 | - * |
|
| 6814 | - * @return Array the airport list |
|
| 6815 | - * |
|
| 6816 | - */ |
|
| 6812 | + * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 6813 | + * |
|
| 6814 | + * @return Array the airport list |
|
| 6815 | + * |
|
| 6816 | + */ |
|
| 6817 | 6817 | public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
| 6818 | 6818 | { |
| 6819 | 6819 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6846,11 +6846,11 @@ discard block |
||
| 6846 | 6846 | |
| 6847 | 6847 | |
| 6848 | 6848 | /** |
| 6849 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 6850 | - * |
|
| 6851 | - * @return Array the airport list |
|
| 6852 | - * |
|
| 6853 | - */ |
|
| 6849 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 6850 | + * |
|
| 6851 | + * @return Array the airport list |
|
| 6852 | + * |
|
| 6853 | + */ |
|
| 6854 | 6854 | public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
| 6855 | 6855 | { |
| 6856 | 6856 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6880,11 +6880,11 @@ discard block |
||
| 6880 | 6880 | |
| 6881 | 6881 | |
| 6882 | 6882 | /** |
| 6883 | - * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 6884 | - * |
|
| 6885 | - * @return Array the airport list |
|
| 6886 | - * |
|
| 6887 | - */ |
|
| 6883 | + * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 6884 | + * |
|
| 6885 | + * @return Array the airport list |
|
| 6886 | + * |
|
| 6887 | + */ |
|
| 6888 | 6888 | public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 6889 | 6889 | { |
| 6890 | 6890 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6918,11 +6918,11 @@ discard block |
||
| 6918 | 6918 | |
| 6919 | 6919 | |
| 6920 | 6920 | /** |
| 6921 | - * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 6922 | - * |
|
| 6923 | - * @return Array the airport list |
|
| 6924 | - * |
|
| 6925 | - */ |
|
| 6921 | + * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 6922 | + * |
|
| 6923 | + * @return Array the airport list |
|
| 6924 | + * |
|
| 6925 | + */ |
|
| 6926 | 6926 | public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 6927 | 6927 | { |
| 6928 | 6928 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6953,11 +6953,11 @@ discard block |
||
| 6953 | 6953 | |
| 6954 | 6954 | |
| 6955 | 6955 | /** |
| 6956 | - * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 6957 | - * |
|
| 6958 | - * @return Array the airport list |
|
| 6959 | - * |
|
| 6960 | - */ |
|
| 6956 | + * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 6957 | + * |
|
| 6958 | + * @return Array the airport list |
|
| 6959 | + * |
|
| 6960 | + */ |
|
| 6961 | 6961 | public function countAllArrivalAirportsByDate($date,$filters = array()) |
| 6962 | 6962 | { |
| 6963 | 6963 | global $globalTimezone, $globalDBdriver; |
@@ -7003,11 +7003,11 @@ discard block |
||
| 7003 | 7003 | |
| 7004 | 7004 | |
| 7005 | 7005 | /** |
| 7006 | - * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 7007 | - * |
|
| 7008 | - * @return Array the airport list |
|
| 7009 | - * |
|
| 7010 | - */ |
|
| 7006 | + * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 7007 | + * |
|
| 7008 | + * @return Array the airport list |
|
| 7009 | + * |
|
| 7010 | + */ |
|
| 7011 | 7011 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 7012 | 7012 | { |
| 7013 | 7013 | global $globalTimezone, $globalDBdriver; |
@@ -7050,11 +7050,11 @@ discard block |
||
| 7050 | 7050 | |
| 7051 | 7051 | |
| 7052 | 7052 | /** |
| 7053 | - * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 7054 | - * |
|
| 7055 | - * @return Array the airport list |
|
| 7056 | - * |
|
| 7057 | - */ |
|
| 7053 | + * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 7054 | + * |
|
| 7055 | + * @return Array the airport list |
|
| 7056 | + * |
|
| 7057 | + */ |
|
| 7058 | 7058 | public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
| 7059 | 7059 | { |
| 7060 | 7060 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7087,11 +7087,11 @@ discard block |
||
| 7087 | 7087 | |
| 7088 | 7088 | |
| 7089 | 7089 | /** |
| 7090 | - * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7091 | - * |
|
| 7092 | - * @return Array the airport list |
|
| 7093 | - * |
|
| 7094 | - */ |
|
| 7090 | + * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7091 | + * |
|
| 7092 | + * @return Array the airport list |
|
| 7093 | + * |
|
| 7094 | + */ |
|
| 7095 | 7095 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 7096 | 7096 | { |
| 7097 | 7097 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7122,11 +7122,11 @@ discard block |
||
| 7122 | 7122 | |
| 7123 | 7123 | |
| 7124 | 7124 | /** |
| 7125 | - * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 7126 | - * |
|
| 7127 | - * @return Array the airport list |
|
| 7128 | - * |
|
| 7129 | - */ |
|
| 7125 | + * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 7126 | + * |
|
| 7127 | + * @return Array the airport list |
|
| 7128 | + * |
|
| 7129 | + */ |
|
| 7130 | 7130 | public function countAllArrivalAirportsByCountry($country,$filters = array()) |
| 7131 | 7131 | { |
| 7132 | 7132 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7159,11 +7159,11 @@ discard block |
||
| 7159 | 7159 | |
| 7160 | 7160 | |
| 7161 | 7161 | /** |
| 7162 | - * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 7163 | - * |
|
| 7164 | - * @return Array the airport list |
|
| 7165 | - * |
|
| 7166 | - */ |
|
| 7162 | + * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 7163 | + * |
|
| 7164 | + * @return Array the airport list |
|
| 7165 | + * |
|
| 7166 | + */ |
|
| 7167 | 7167 | public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
| 7168 | 7168 | { |
| 7169 | 7169 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7194,11 +7194,11 @@ discard block |
||
| 7194 | 7194 | |
| 7195 | 7195 | |
| 7196 | 7196 | /** |
| 7197 | - * Counts all airport departure countries |
|
| 7198 | - * |
|
| 7199 | - * @return Array the airport departure list |
|
| 7200 | - * |
|
| 7201 | - */ |
|
| 7197 | + * Counts all airport departure countries |
|
| 7198 | + * |
|
| 7199 | + * @return Array the airport departure list |
|
| 7200 | + * |
|
| 7201 | + */ |
|
| 7202 | 7202 | public function countAllDepartureCountries($filters = array()) |
| 7203 | 7203 | { |
| 7204 | 7204 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7228,11 +7228,11 @@ discard block |
||
| 7228 | 7228 | |
| 7229 | 7229 | |
| 7230 | 7230 | /** |
| 7231 | - * Counts all airport arrival countries |
|
| 7232 | - * |
|
| 7233 | - * @return Array the airport arrival list |
|
| 7234 | - * |
|
| 7235 | - */ |
|
| 7231 | + * Counts all airport arrival countries |
|
| 7232 | + * |
|
| 7233 | + * @return Array the airport arrival list |
|
| 7234 | + * |
|
| 7235 | + */ |
|
| 7236 | 7236 | public function countAllArrivalCountries($limit = true,$filters = array()) |
| 7237 | 7237 | { |
| 7238 | 7238 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7265,11 +7265,11 @@ discard block |
||
| 7265 | 7265 | |
| 7266 | 7266 | |
| 7267 | 7267 | /** |
| 7268 | - * Gets all route combinations |
|
| 7269 | - * |
|
| 7270 | - * @return Array the route list |
|
| 7271 | - * |
|
| 7272 | - */ |
|
| 7268 | + * Gets all route combinations |
|
| 7269 | + * |
|
| 7270 | + * @return Array the route list |
|
| 7271 | + * |
|
| 7272 | + */ |
|
| 7273 | 7273 | public function countAllRoutes($filters = array()) |
| 7274 | 7274 | { |
| 7275 | 7275 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7308,11 +7308,11 @@ discard block |
||
| 7308 | 7308 | |
| 7309 | 7309 | |
| 7310 | 7310 | /** |
| 7311 | - * Gets all route combinations based on an aircraft |
|
| 7312 | - * |
|
| 7313 | - * @return Array the route list |
|
| 7314 | - * |
|
| 7315 | - */ |
|
| 7311 | + * Gets all route combinations based on an aircraft |
|
| 7312 | + * |
|
| 7313 | + * @return Array the route list |
|
| 7314 | + * |
|
| 7315 | + */ |
|
| 7316 | 7316 | public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
| 7317 | 7317 | { |
| 7318 | 7318 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7348,11 +7348,11 @@ discard block |
||
| 7348 | 7348 | |
| 7349 | 7349 | |
| 7350 | 7350 | /** |
| 7351 | - * Gets all route combinations based on an aircraft registration |
|
| 7352 | - * |
|
| 7353 | - * @return Array the route list |
|
| 7354 | - * |
|
| 7355 | - */ |
|
| 7351 | + * Gets all route combinations based on an aircraft registration |
|
| 7352 | + * |
|
| 7353 | + * @return Array the route list |
|
| 7354 | + * |
|
| 7355 | + */ |
|
| 7356 | 7356 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 7357 | 7357 | { |
| 7358 | 7358 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7390,11 +7390,11 @@ discard block |
||
| 7390 | 7390 | |
| 7391 | 7391 | |
| 7392 | 7392 | /** |
| 7393 | - * Gets all route combinations based on an airline |
|
| 7394 | - * |
|
| 7395 | - * @return Array the route list |
|
| 7396 | - * |
|
| 7397 | - */ |
|
| 7393 | + * Gets all route combinations based on an airline |
|
| 7394 | + * |
|
| 7395 | + * @return Array the route list |
|
| 7396 | + * |
|
| 7397 | + */ |
|
| 7398 | 7398 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 7399 | 7399 | { |
| 7400 | 7400 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7432,11 +7432,11 @@ discard block |
||
| 7432 | 7432 | |
| 7433 | 7433 | |
| 7434 | 7434 | /** |
| 7435 | - * Gets all route combinations based on an airport |
|
| 7436 | - * |
|
| 7437 | - * @return Array the route list |
|
| 7438 | - * |
|
| 7439 | - */ |
|
| 7435 | + * Gets all route combinations based on an airport |
|
| 7436 | + * |
|
| 7437 | + * @return Array the route list |
|
| 7438 | + * |
|
| 7439 | + */ |
|
| 7440 | 7440 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 7441 | 7441 | { |
| 7442 | 7442 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7473,11 +7473,11 @@ discard block |
||
| 7473 | 7473 | |
| 7474 | 7474 | |
| 7475 | 7475 | /** |
| 7476 | - * Gets all route combinations based on an country |
|
| 7477 | - * |
|
| 7478 | - * @return Array the route list |
|
| 7479 | - * |
|
| 7480 | - */ |
|
| 7476 | + * Gets all route combinations based on an country |
|
| 7477 | + * |
|
| 7478 | + * @return Array the route list |
|
| 7479 | + * |
|
| 7480 | + */ |
|
| 7481 | 7481 | public function countAllRoutesByCountry($country, $filters = array()) |
| 7482 | 7482 | { |
| 7483 | 7483 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7513,11 +7513,11 @@ discard block |
||
| 7513 | 7513 | |
| 7514 | 7514 | |
| 7515 | 7515 | /** |
| 7516 | - * Gets all route combinations based on an date |
|
| 7517 | - * |
|
| 7518 | - * @return Array the route list |
|
| 7519 | - * |
|
| 7520 | - */ |
|
| 7516 | + * Gets all route combinations based on an date |
|
| 7517 | + * |
|
| 7518 | + * @return Array the route list |
|
| 7519 | + * |
|
| 7520 | + */ |
|
| 7521 | 7521 | public function countAllRoutesByDate($date, $filters = array()) |
| 7522 | 7522 | { |
| 7523 | 7523 | global $globalTimezone, $globalDBdriver; |
@@ -7567,11 +7567,11 @@ discard block |
||
| 7567 | 7567 | |
| 7568 | 7568 | |
| 7569 | 7569 | /** |
| 7570 | - * Gets all route combinations based on an ident/callsign |
|
| 7571 | - * |
|
| 7572 | - * @return Array the route list |
|
| 7573 | - * |
|
| 7574 | - */ |
|
| 7570 | + * Gets all route combinations based on an ident/callsign |
|
| 7571 | + * |
|
| 7572 | + * @return Array the route list |
|
| 7573 | + * |
|
| 7574 | + */ |
|
| 7575 | 7575 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 7576 | 7576 | { |
| 7577 | 7577 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7608,11 +7608,11 @@ discard block |
||
| 7608 | 7608 | |
| 7609 | 7609 | |
| 7610 | 7610 | /** |
| 7611 | - * Gets all route combinations based on an manufacturer |
|
| 7612 | - * |
|
| 7613 | - * @return Array the route list |
|
| 7614 | - * |
|
| 7615 | - */ |
|
| 7611 | + * Gets all route combinations based on an manufacturer |
|
| 7612 | + * |
|
| 7613 | + * @return Array the route list |
|
| 7614 | + * |
|
| 7615 | + */ |
|
| 7616 | 7616 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 7617 | 7617 | { |
| 7618 | 7618 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7650,11 +7650,11 @@ discard block |
||
| 7650 | 7650 | |
| 7651 | 7651 | |
| 7652 | 7652 | /** |
| 7653 | - * Gets all route combinations with waypoints |
|
| 7654 | - * |
|
| 7655 | - * @return Array the route list |
|
| 7656 | - * |
|
| 7657 | - */ |
|
| 7653 | + * Gets all route combinations with waypoints |
|
| 7654 | + * |
|
| 7655 | + * @return Array the route list |
|
| 7656 | + * |
|
| 7657 | + */ |
|
| 7658 | 7658 | public function countAllRoutesWithWaypoints($filters = array()) |
| 7659 | 7659 | { |
| 7660 | 7660 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7691,11 +7691,11 @@ discard block |
||
| 7691 | 7691 | } |
| 7692 | 7692 | |
| 7693 | 7693 | /** |
| 7694 | - * Gets all callsigns that have flown over |
|
| 7695 | - * |
|
| 7696 | - * @return Array the callsign list |
|
| 7697 | - * |
|
| 7698 | - */ |
|
| 7694 | + * Gets all callsigns that have flown over |
|
| 7695 | + * |
|
| 7696 | + * @return Array the callsign list |
|
| 7697 | + * |
|
| 7698 | + */ |
|
| 7699 | 7699 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 7700 | 7700 | { |
| 7701 | 7701 | global $globalDBdriver; |
@@ -7733,11 +7733,11 @@ discard block |
||
| 7733 | 7733 | } |
| 7734 | 7734 | |
| 7735 | 7735 | /** |
| 7736 | - * Gets all callsigns that have flown over |
|
| 7737 | - * |
|
| 7738 | - * @return Array the callsign list |
|
| 7739 | - * |
|
| 7740 | - */ |
|
| 7736 | + * Gets all callsigns that have flown over |
|
| 7737 | + * |
|
| 7738 | + * @return Array the callsign list |
|
| 7739 | + * |
|
| 7740 | + */ |
|
| 7741 | 7741 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 7742 | 7742 | { |
| 7743 | 7743 | global $globalDBdriver; |
@@ -7778,11 +7778,11 @@ discard block |
||
| 7778 | 7778 | |
| 7779 | 7779 | |
| 7780 | 7780 | /** |
| 7781 | - * Counts all dates |
|
| 7782 | - * |
|
| 7783 | - * @return Array the date list |
|
| 7784 | - * |
|
| 7785 | - */ |
|
| 7781 | + * Counts all dates |
|
| 7782 | + * |
|
| 7783 | + * @return Array the date list |
|
| 7784 | + * |
|
| 7785 | + */ |
|
| 7786 | 7786 | public function countAllDates($filters = array()) |
| 7787 | 7787 | { |
| 7788 | 7788 | global $globalTimezone, $globalDBdriver; |
@@ -7827,11 +7827,11 @@ discard block |
||
| 7827 | 7827 | } |
| 7828 | 7828 | |
| 7829 | 7829 | /** |
| 7830 | - * Counts all dates |
|
| 7831 | - * |
|
| 7832 | - * @return Array the date list |
|
| 7833 | - * |
|
| 7834 | - */ |
|
| 7830 | + * Counts all dates |
|
| 7831 | + * |
|
| 7832 | + * @return Array the date list |
|
| 7833 | + * |
|
| 7834 | + */ |
|
| 7835 | 7835 | public function countAllDatesByAirlines($filters = array()) |
| 7836 | 7836 | { |
| 7837 | 7837 | global $globalTimezone, $globalDBdriver; |
@@ -7876,11 +7876,11 @@ discard block |
||
| 7876 | 7876 | } |
| 7877 | 7877 | |
| 7878 | 7878 | /** |
| 7879 | - * Counts all dates during the last 7 days |
|
| 7880 | - * |
|
| 7881 | - * @return Array the date list |
|
| 7882 | - * |
|
| 7883 | - */ |
|
| 7879 | + * Counts all dates during the last 7 days |
|
| 7880 | + * |
|
| 7881 | + * @return Array the date list |
|
| 7882 | + * |
|
| 7883 | + */ |
|
| 7884 | 7884 | public function countAllDatesLast7Days($filters = array()) |
| 7885 | 7885 | { |
| 7886 | 7886 | global $globalTimezone, $globalDBdriver; |
@@ -7902,7 +7902,7 @@ discard block |
||
| 7902 | 7902 | $query .= " GROUP BY date_name |
| 7903 | 7903 | ORDER BY date_name ASC"; |
| 7904 | 7904 | $query_data = array(':offset' => $offset); |
| 7905 | - } |
|
| 7905 | + } |
|
| 7906 | 7906 | |
| 7907 | 7907 | $sth = $this->db->prepare($query); |
| 7908 | 7908 | $sth->execute($query_data); |
@@ -7922,11 +7922,11 @@ discard block |
||
| 7922 | 7922 | } |
| 7923 | 7923 | |
| 7924 | 7924 | /** |
| 7925 | - * Counts all dates during the last month |
|
| 7926 | - * |
|
| 7927 | - * @return Array the date list |
|
| 7928 | - * |
|
| 7929 | - */ |
|
| 7925 | + * Counts all dates during the last month |
|
| 7926 | + * |
|
| 7927 | + * @return Array the date list |
|
| 7928 | + * |
|
| 7929 | + */ |
|
| 7930 | 7930 | public function countAllDatesLastMonth($filters = array()) |
| 7931 | 7931 | { |
| 7932 | 7932 | global $globalTimezone, $globalDBdriver; |
@@ -7948,7 +7948,7 @@ discard block |
||
| 7948 | 7948 | $query .= " GROUP BY date_name |
| 7949 | 7949 | ORDER BY date_name ASC"; |
| 7950 | 7950 | $query_data = array(':offset' => $offset); |
| 7951 | - } |
|
| 7951 | + } |
|
| 7952 | 7952 | |
| 7953 | 7953 | $sth = $this->db->prepare($query); |
| 7954 | 7954 | $sth->execute($query_data); |
@@ -7969,11 +7969,11 @@ discard block |
||
| 7969 | 7969 | |
| 7970 | 7970 | |
| 7971 | 7971 | /** |
| 7972 | - * Counts all dates during the last month |
|
| 7973 | - * |
|
| 7974 | - * @return Array the date list |
|
| 7975 | - * |
|
| 7976 | - */ |
|
| 7972 | + * Counts all dates during the last month |
|
| 7973 | + * |
|
| 7974 | + * @return Array the date list |
|
| 7975 | + * |
|
| 7976 | + */ |
|
| 7977 | 7977 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 7978 | 7978 | { |
| 7979 | 7979 | global $globalTimezone, $globalDBdriver; |
@@ -7996,7 +7996,7 @@ discard block |
||
| 7996 | 7996 | GROUP BY spotter_output.airline_icao, date_name |
| 7997 | 7997 | ORDER BY date_name ASC"; |
| 7998 | 7998 | $query_data = array(':offset' => $offset); |
| 7999 | - } |
|
| 7999 | + } |
|
| 8000 | 8000 | |
| 8001 | 8001 | $sth = $this->db->prepare($query); |
| 8002 | 8002 | $sth->execute($query_data); |
@@ -8018,11 +8018,11 @@ discard block |
||
| 8018 | 8018 | |
| 8019 | 8019 | |
| 8020 | 8020 | /** |
| 8021 | - * Counts all month |
|
| 8022 | - * |
|
| 8023 | - * @return Array the month list |
|
| 8024 | - * |
|
| 8025 | - */ |
|
| 8021 | + * Counts all month |
|
| 8022 | + * |
|
| 8023 | + * @return Array the month list |
|
| 8024 | + * |
|
| 8025 | + */ |
|
| 8026 | 8026 | public function countAllMonths($filters = array()) |
| 8027 | 8027 | { |
| 8028 | 8028 | global $globalTimezone, $globalDBdriver; |
@@ -8064,11 +8064,11 @@ discard block |
||
| 8064 | 8064 | } |
| 8065 | 8065 | |
| 8066 | 8066 | /** |
| 8067 | - * Counts all month |
|
| 8068 | - * |
|
| 8069 | - * @return Array the month list |
|
| 8070 | - * |
|
| 8071 | - */ |
|
| 8067 | + * Counts all month |
|
| 8068 | + * |
|
| 8069 | + * @return Array the month list |
|
| 8070 | + * |
|
| 8071 | + */ |
|
| 8072 | 8072 | public function countAllMonthsByAirlines($filters = array()) |
| 8073 | 8073 | { |
| 8074 | 8074 | global $globalTimezone, $globalDBdriver; |
@@ -8113,11 +8113,11 @@ discard block |
||
| 8113 | 8113 | } |
| 8114 | 8114 | |
| 8115 | 8115 | /** |
| 8116 | - * Counts all military month |
|
| 8117 | - * |
|
| 8118 | - * @return Array the month list |
|
| 8119 | - * |
|
| 8120 | - */ |
|
| 8116 | + * Counts all military month |
|
| 8117 | + * |
|
| 8118 | + * @return Array the month list |
|
| 8119 | + * |
|
| 8120 | + */ |
|
| 8121 | 8121 | public function countAllMilitaryMonths($filters = array()) |
| 8122 | 8122 | { |
| 8123 | 8123 | global $globalTimezone, $globalDBdriver; |
@@ -8158,11 +8158,11 @@ discard block |
||
| 8158 | 8158 | } |
| 8159 | 8159 | |
| 8160 | 8160 | /** |
| 8161 | - * Counts all month owners |
|
| 8162 | - * |
|
| 8163 | - * @return Array the month list |
|
| 8164 | - * |
|
| 8165 | - */ |
|
| 8161 | + * Counts all month owners |
|
| 8162 | + * |
|
| 8163 | + * @return Array the month list |
|
| 8164 | + * |
|
| 8165 | + */ |
|
| 8166 | 8166 | public function countAllMonthsOwners($filters = array()) |
| 8167 | 8167 | { |
| 8168 | 8168 | global $globalTimezone, $globalDBdriver; |
@@ -8204,11 +8204,11 @@ discard block |
||
| 8204 | 8204 | } |
| 8205 | 8205 | |
| 8206 | 8206 | /** |
| 8207 | - * Counts all month owners |
|
| 8208 | - * |
|
| 8209 | - * @return Array the month list |
|
| 8210 | - * |
|
| 8211 | - */ |
|
| 8207 | + * Counts all month owners |
|
| 8208 | + * |
|
| 8209 | + * @return Array the month list |
|
| 8210 | + * |
|
| 8211 | + */ |
|
| 8212 | 8212 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 8213 | 8213 | { |
| 8214 | 8214 | global $globalTimezone, $globalDBdriver; |
@@ -8251,11 +8251,11 @@ discard block |
||
| 8251 | 8251 | } |
| 8252 | 8252 | |
| 8253 | 8253 | /** |
| 8254 | - * Counts all month pilot |
|
| 8255 | - * |
|
| 8256 | - * @return Array the month list |
|
| 8257 | - * |
|
| 8258 | - */ |
|
| 8254 | + * Counts all month pilot |
|
| 8255 | + * |
|
| 8256 | + * @return Array the month list |
|
| 8257 | + * |
|
| 8258 | + */ |
|
| 8259 | 8259 | public function countAllMonthsPilots($filters = array()) |
| 8260 | 8260 | { |
| 8261 | 8261 | global $globalTimezone, $globalDBdriver; |
@@ -8297,11 +8297,11 @@ discard block |
||
| 8297 | 8297 | } |
| 8298 | 8298 | |
| 8299 | 8299 | /** |
| 8300 | - * Counts all month pilot |
|
| 8301 | - * |
|
| 8302 | - * @return Array the month list |
|
| 8303 | - * |
|
| 8304 | - */ |
|
| 8300 | + * Counts all month pilot |
|
| 8301 | + * |
|
| 8302 | + * @return Array the month list |
|
| 8303 | + * |
|
| 8304 | + */ |
|
| 8305 | 8305 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 8306 | 8306 | { |
| 8307 | 8307 | global $globalTimezone, $globalDBdriver; |
@@ -8344,11 +8344,11 @@ discard block |
||
| 8344 | 8344 | } |
| 8345 | 8345 | |
| 8346 | 8346 | /** |
| 8347 | - * Counts all month airline |
|
| 8348 | - * |
|
| 8349 | - * @return Array the month list |
|
| 8350 | - * |
|
| 8351 | - */ |
|
| 8347 | + * Counts all month airline |
|
| 8348 | + * |
|
| 8349 | + * @return Array the month list |
|
| 8350 | + * |
|
| 8351 | + */ |
|
| 8352 | 8352 | public function countAllMonthsAirlines($filters = array()) |
| 8353 | 8353 | { |
| 8354 | 8354 | global $globalTimezone, $globalDBdriver; |
@@ -8390,11 +8390,11 @@ discard block |
||
| 8390 | 8390 | } |
| 8391 | 8391 | |
| 8392 | 8392 | /** |
| 8393 | - * Counts all month aircraft |
|
| 8394 | - * |
|
| 8395 | - * @return Array the month list |
|
| 8396 | - * |
|
| 8397 | - */ |
|
| 8393 | + * Counts all month aircraft |
|
| 8394 | + * |
|
| 8395 | + * @return Array the month list |
|
| 8396 | + * |
|
| 8397 | + */ |
|
| 8398 | 8398 | public function countAllMonthsAircrafts($filters = array()) |
| 8399 | 8399 | { |
| 8400 | 8400 | global $globalTimezone, $globalDBdriver; |
@@ -8437,11 +8437,11 @@ discard block |
||
| 8437 | 8437 | |
| 8438 | 8438 | |
| 8439 | 8439 | /** |
| 8440 | - * Counts all month aircraft |
|
| 8441 | - * |
|
| 8442 | - * @return Array the month list |
|
| 8443 | - * |
|
| 8444 | - */ |
|
| 8440 | + * Counts all month aircraft |
|
| 8441 | + * |
|
| 8442 | + * @return Array the month list |
|
| 8443 | + * |
|
| 8444 | + */ |
|
| 8445 | 8445 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 8446 | 8446 | { |
| 8447 | 8447 | global $globalTimezone, $globalDBdriver; |
@@ -8484,11 +8484,11 @@ discard block |
||
| 8484 | 8484 | } |
| 8485 | 8485 | |
| 8486 | 8486 | /** |
| 8487 | - * Counts all month real arrival |
|
| 8488 | - * |
|
| 8489 | - * @return Array the month list |
|
| 8490 | - * |
|
| 8491 | - */ |
|
| 8487 | + * Counts all month real arrival |
|
| 8488 | + * |
|
| 8489 | + * @return Array the month list |
|
| 8490 | + * |
|
| 8491 | + */ |
|
| 8492 | 8492 | public function countAllMonthsRealArrivals($filters = array()) |
| 8493 | 8493 | { |
| 8494 | 8494 | global $globalTimezone, $globalDBdriver; |
@@ -8531,11 +8531,11 @@ discard block |
||
| 8531 | 8531 | |
| 8532 | 8532 | |
| 8533 | 8533 | /** |
| 8534 | - * Counts all month real arrival |
|
| 8535 | - * |
|
| 8536 | - * @return Array the month list |
|
| 8537 | - * |
|
| 8538 | - */ |
|
| 8534 | + * Counts all month real arrival |
|
| 8535 | + * |
|
| 8536 | + * @return Array the month list |
|
| 8537 | + * |
|
| 8538 | + */ |
|
| 8539 | 8539 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 8540 | 8540 | { |
| 8541 | 8541 | global $globalTimezone, $globalDBdriver; |
@@ -8579,11 +8579,11 @@ discard block |
||
| 8579 | 8579 | |
| 8580 | 8580 | |
| 8581 | 8581 | /** |
| 8582 | - * Counts all dates during the last year |
|
| 8583 | - * |
|
| 8584 | - * @return Array the date list |
|
| 8585 | - * |
|
| 8586 | - */ |
|
| 8582 | + * Counts all dates during the last year |
|
| 8583 | + * |
|
| 8584 | + * @return Array the date list |
|
| 8585 | + * |
|
| 8586 | + */ |
|
| 8587 | 8587 | public function countAllMonthsLastYear($filters) |
| 8588 | 8588 | { |
| 8589 | 8589 | global $globalTimezone, $globalDBdriver; |
@@ -8605,7 +8605,7 @@ discard block |
||
| 8605 | 8605 | $query .= " GROUP BY year_name, month_name |
| 8606 | 8606 | ORDER BY year_name, month_name ASC"; |
| 8607 | 8607 | $query_data = array(':offset' => $offset); |
| 8608 | - } |
|
| 8608 | + } |
|
| 8609 | 8609 | |
| 8610 | 8610 | $sth = $this->db->prepare($query); |
| 8611 | 8611 | $sth->execute($query_data); |
@@ -8628,11 +8628,11 @@ discard block |
||
| 8628 | 8628 | |
| 8629 | 8629 | |
| 8630 | 8630 | /** |
| 8631 | - * Counts all hours |
|
| 8632 | - * |
|
| 8633 | - * @return Array the hour list |
|
| 8634 | - * |
|
| 8635 | - */ |
|
| 8631 | + * Counts all hours |
|
| 8632 | + * |
|
| 8633 | + * @return Array the hour list |
|
| 8634 | + * |
|
| 8635 | + */ |
|
| 8636 | 8636 | public function countAllHours($orderby,$filters = array()) |
| 8637 | 8637 | { |
| 8638 | 8638 | global $globalTimezone, $globalDBdriver; |
@@ -8693,11 +8693,11 @@ discard block |
||
| 8693 | 8693 | } |
| 8694 | 8694 | |
| 8695 | 8695 | /** |
| 8696 | - * Counts all hours |
|
| 8697 | - * |
|
| 8698 | - * @return Array the hour list |
|
| 8699 | - * |
|
| 8700 | - */ |
|
| 8696 | + * Counts all hours |
|
| 8697 | + * |
|
| 8698 | + * @return Array the hour list |
|
| 8699 | + * |
|
| 8700 | + */ |
|
| 8701 | 8701 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 8702 | 8702 | { |
| 8703 | 8703 | global $globalTimezone, $globalDBdriver; |
@@ -8760,11 +8760,11 @@ discard block |
||
| 8760 | 8760 | |
| 8761 | 8761 | |
| 8762 | 8762 | /** |
| 8763 | - * Counts all hours by airline |
|
| 8764 | - * |
|
| 8765 | - * @return Array the hour list |
|
| 8766 | - * |
|
| 8767 | - */ |
|
| 8763 | + * Counts all hours by airline |
|
| 8764 | + * |
|
| 8765 | + * @return Array the hour list |
|
| 8766 | + * |
|
| 8767 | + */ |
|
| 8768 | 8768 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 8769 | 8769 | { |
| 8770 | 8770 | global $globalTimezone, $globalDBdriver; |
@@ -8810,11 +8810,11 @@ discard block |
||
| 8810 | 8810 | |
| 8811 | 8811 | |
| 8812 | 8812 | /** |
| 8813 | - * Counts all hours by aircraft |
|
| 8814 | - * |
|
| 8815 | - * @return Array the hour list |
|
| 8816 | - * |
|
| 8817 | - */ |
|
| 8813 | + * Counts all hours by aircraft |
|
| 8814 | + * |
|
| 8815 | + * @return Array the hour list |
|
| 8816 | + * |
|
| 8817 | + */ |
|
| 8818 | 8818 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 8819 | 8819 | { |
| 8820 | 8820 | global $globalTimezone, $globalDBdriver; |
@@ -8857,11 +8857,11 @@ discard block |
||
| 8857 | 8857 | |
| 8858 | 8858 | |
| 8859 | 8859 | /** |
| 8860 | - * Counts all hours by aircraft registration |
|
| 8861 | - * |
|
| 8862 | - * @return Array the hour list |
|
| 8863 | - * |
|
| 8864 | - */ |
|
| 8860 | + * Counts all hours by aircraft registration |
|
| 8861 | + * |
|
| 8862 | + * @return Array the hour list |
|
| 8863 | + * |
|
| 8864 | + */ |
|
| 8865 | 8865 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 8866 | 8866 | { |
| 8867 | 8867 | global $globalTimezone, $globalDBdriver; |
@@ -8904,11 +8904,11 @@ discard block |
||
| 8904 | 8904 | |
| 8905 | 8905 | |
| 8906 | 8906 | /** |
| 8907 | - * Counts all hours by airport |
|
| 8908 | - * |
|
| 8909 | - * @return Array the hour list |
|
| 8910 | - * |
|
| 8911 | - */ |
|
| 8907 | + * Counts all hours by airport |
|
| 8908 | + * |
|
| 8909 | + * @return Array the hour list |
|
| 8910 | + * |
|
| 8911 | + */ |
|
| 8912 | 8912 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 8913 | 8913 | { |
| 8914 | 8914 | global $globalTimezone, $globalDBdriver; |
@@ -8952,11 +8952,11 @@ discard block |
||
| 8952 | 8952 | |
| 8953 | 8953 | |
| 8954 | 8954 | /** |
| 8955 | - * Counts all hours by manufacturer |
|
| 8956 | - * |
|
| 8957 | - * @return Array the hour list |
|
| 8958 | - * |
|
| 8959 | - */ |
|
| 8955 | + * Counts all hours by manufacturer |
|
| 8956 | + * |
|
| 8957 | + * @return Array the hour list |
|
| 8958 | + * |
|
| 8959 | + */ |
|
| 8960 | 8960 | public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
| 8961 | 8961 | { |
| 8962 | 8962 | global $globalTimezone, $globalDBdriver; |
@@ -9000,11 +9000,11 @@ discard block |
||
| 9000 | 9000 | |
| 9001 | 9001 | |
| 9002 | 9002 | /** |
| 9003 | - * Counts all hours by date |
|
| 9004 | - * |
|
| 9005 | - * @return Array the hour list |
|
| 9006 | - * |
|
| 9007 | - */ |
|
| 9003 | + * Counts all hours by date |
|
| 9004 | + * |
|
| 9005 | + * @return Array the hour list |
|
| 9006 | + * |
|
| 9007 | + */ |
|
| 9008 | 9008 | public function countAllHoursByDate($date, $filters = array()) |
| 9009 | 9009 | { |
| 9010 | 9010 | global $globalTimezone, $globalDBdriver; |
@@ -9048,11 +9048,11 @@ discard block |
||
| 9048 | 9048 | |
| 9049 | 9049 | |
| 9050 | 9050 | /** |
| 9051 | - * Counts all hours by a ident/callsign |
|
| 9052 | - * |
|
| 9053 | - * @return Array the hour list |
|
| 9054 | - * |
|
| 9055 | - */ |
|
| 9051 | + * Counts all hours by a ident/callsign |
|
| 9052 | + * |
|
| 9053 | + * @return Array the hour list |
|
| 9054 | + * |
|
| 9055 | + */ |
|
| 9056 | 9056 | public function countAllHoursByIdent($ident, $filters = array()) |
| 9057 | 9057 | { |
| 9058 | 9058 | global $globalTimezone, $globalDBdriver; |
@@ -9097,11 +9097,11 @@ discard block |
||
| 9097 | 9097 | |
| 9098 | 9098 | |
| 9099 | 9099 | /** |
| 9100 | - * Counts all hours by route |
|
| 9101 | - * |
|
| 9102 | - * @return Array the hour list |
|
| 9103 | - * |
|
| 9104 | - */ |
|
| 9100 | + * Counts all hours by route |
|
| 9101 | + * |
|
| 9102 | + * @return Array the hour list |
|
| 9103 | + * |
|
| 9104 | + */ |
|
| 9105 | 9105 | public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
| 9106 | 9106 | { |
| 9107 | 9107 | global $globalTimezone, $globalDBdriver; |
@@ -9145,11 +9145,11 @@ discard block |
||
| 9145 | 9145 | |
| 9146 | 9146 | |
| 9147 | 9147 | /** |
| 9148 | - * Counts all hours by country |
|
| 9149 | - * |
|
| 9150 | - * @return Array the hour list |
|
| 9151 | - * |
|
| 9152 | - */ |
|
| 9148 | + * Counts all hours by country |
|
| 9149 | + * |
|
| 9150 | + * @return Array the hour list |
|
| 9151 | + * |
|
| 9152 | + */ |
|
| 9153 | 9153 | public function countAllHoursByCountry($country, $filters = array()) |
| 9154 | 9154 | { |
| 9155 | 9155 | global $globalTimezone, $globalDBdriver; |
@@ -9194,11 +9194,11 @@ discard block |
||
| 9194 | 9194 | |
| 9195 | 9195 | |
| 9196 | 9196 | /** |
| 9197 | - * Counts all aircraft that have flown over |
|
| 9198 | - * |
|
| 9199 | - * @return Integer the number of aircrafts |
|
| 9200 | - * |
|
| 9201 | - */ |
|
| 9197 | + * Counts all aircraft that have flown over |
|
| 9198 | + * |
|
| 9199 | + * @return Integer the number of aircrafts |
|
| 9200 | + * |
|
| 9201 | + */ |
|
| 9202 | 9202 | public function countOverallAircrafts($filters = array()) |
| 9203 | 9203 | { |
| 9204 | 9204 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9210,11 +9210,11 @@ discard block |
||
| 9210 | 9210 | } |
| 9211 | 9211 | |
| 9212 | 9212 | /** |
| 9213 | - * Counts all flight that really arrival |
|
| 9214 | - * |
|
| 9215 | - * @return Integer the number of aircrafts |
|
| 9216 | - * |
|
| 9217 | - */ |
|
| 9213 | + * Counts all flight that really arrival |
|
| 9214 | + * |
|
| 9215 | + * @return Integer the number of aircrafts |
|
| 9216 | + * |
|
| 9217 | + */ |
|
| 9218 | 9218 | public function countOverallArrival($filters = array()) |
| 9219 | 9219 | { |
| 9220 | 9220 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9227,11 +9227,11 @@ discard block |
||
| 9227 | 9227 | } |
| 9228 | 9228 | |
| 9229 | 9229 | /** |
| 9230 | - * Counts all pilots that have flown over |
|
| 9231 | - * |
|
| 9232 | - * @return Integer the number of pilots |
|
| 9233 | - * |
|
| 9234 | - */ |
|
| 9230 | + * Counts all pilots that have flown over |
|
| 9231 | + * |
|
| 9232 | + * @return Integer the number of pilots |
|
| 9233 | + * |
|
| 9234 | + */ |
|
| 9235 | 9235 | public function countOverallPilots($filters = array()) |
| 9236 | 9236 | { |
| 9237 | 9237 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9243,11 +9243,11 @@ discard block |
||
| 9243 | 9243 | } |
| 9244 | 9244 | |
| 9245 | 9245 | /** |
| 9246 | - * Counts all owners that have flown over |
|
| 9247 | - * |
|
| 9248 | - * @return Integer the number of owners |
|
| 9249 | - * |
|
| 9250 | - */ |
|
| 9246 | + * Counts all owners that have flown over |
|
| 9247 | + * |
|
| 9248 | + * @return Integer the number of owners |
|
| 9249 | + * |
|
| 9250 | + */ |
|
| 9251 | 9251 | public function countOverallOwners($filters = array()) |
| 9252 | 9252 | { |
| 9253 | 9253 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9260,11 +9260,11 @@ discard block |
||
| 9260 | 9260 | |
| 9261 | 9261 | |
| 9262 | 9262 | /** |
| 9263 | - * Counts all flights that have flown over |
|
| 9264 | - * |
|
| 9265 | - * @return Integer the number of flights |
|
| 9266 | - * |
|
| 9267 | - */ |
|
| 9263 | + * Counts all flights that have flown over |
|
| 9264 | + * |
|
| 9265 | + * @return Integer the number of flights |
|
| 9266 | + * |
|
| 9267 | + */ |
|
| 9268 | 9268 | public function countOverallFlights($filters = array()) |
| 9269 | 9269 | { |
| 9270 | 9270 | $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
@@ -9277,11 +9277,11 @@ discard block |
||
| 9277 | 9277 | } |
| 9278 | 9278 | |
| 9279 | 9279 | /** |
| 9280 | - * Counts all military flights that have flown over |
|
| 9281 | - * |
|
| 9282 | - * @return Integer the number of flights |
|
| 9283 | - * |
|
| 9284 | - */ |
|
| 9280 | + * Counts all military flights that have flown over |
|
| 9281 | + * |
|
| 9282 | + * @return Integer the number of flights |
|
| 9283 | + * |
|
| 9284 | + */ |
|
| 9285 | 9285 | public function countOverallMilitaryFlights($filters = array()) |
| 9286 | 9286 | { |
| 9287 | 9287 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9296,11 +9296,11 @@ discard block |
||
| 9296 | 9296 | |
| 9297 | 9297 | |
| 9298 | 9298 | /** |
| 9299 | - * Counts all airlines that have flown over |
|
| 9300 | - * |
|
| 9301 | - * @return Integer the number of airlines |
|
| 9302 | - * |
|
| 9303 | - */ |
|
| 9299 | + * Counts all airlines that have flown over |
|
| 9300 | + * |
|
| 9301 | + * @return Integer the number of airlines |
|
| 9302 | + * |
|
| 9303 | + */ |
|
| 9304 | 9304 | public function countOverallAirlines($filters = array()) |
| 9305 | 9305 | { |
| 9306 | 9306 | $query = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count |
@@ -9314,11 +9314,11 @@ discard block |
||
| 9314 | 9314 | |
| 9315 | 9315 | |
| 9316 | 9316 | /** |
| 9317 | - * Counts all hours of today |
|
| 9318 | - * |
|
| 9319 | - * @return Array the hour list |
|
| 9320 | - * |
|
| 9321 | - */ |
|
| 9317 | + * Counts all hours of today |
|
| 9318 | + * |
|
| 9319 | + * @return Array the hour list |
|
| 9320 | + * |
|
| 9321 | + */ |
|
| 9322 | 9322 | public function countAllHoursFromToday($filters = array()) |
| 9323 | 9323 | { |
| 9324 | 9324 | global $globalTimezone, $globalDBdriver; |
@@ -9358,11 +9358,11 @@ discard block |
||
| 9358 | 9358 | } |
| 9359 | 9359 | |
| 9360 | 9360 | /** |
| 9361 | - * Gets all the spotter information based on calculated upcoming flights |
|
| 9362 | - * |
|
| 9363 | - * @return Array the spotter information |
|
| 9364 | - * |
|
| 9365 | - */ |
|
| 9361 | + * Gets all the spotter information based on calculated upcoming flights |
|
| 9362 | + * |
|
| 9363 | + * @return Array the spotter information |
|
| 9364 | + * |
|
| 9365 | + */ |
|
| 9366 | 9366 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 9367 | 9367 | { |
| 9368 | 9368 | global $global_query, $globalDBdriver, $globalTimezone; |
@@ -9437,12 +9437,12 @@ discard block |
||
| 9437 | 9437 | } |
| 9438 | 9438 | |
| 9439 | 9439 | |
| 9440 | - /** |
|
| 9441 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 9442 | - * |
|
| 9443 | - * @return Integer the Barrie Spotter ID |
|
| 9440 | + /** |
|
| 9441 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 9442 | + * |
|
| 9443 | + * @return Integer the Barrie Spotter ID |
|
| 9444 | 9444 | q * |
| 9445 | - */ |
|
| 9445 | + */ |
|
| 9446 | 9446 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 9447 | 9447 | { |
| 9448 | 9448 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -9463,13 +9463,13 @@ discard block |
||
| 9463 | 9463 | |
| 9464 | 9464 | |
| 9465 | 9465 | /** |
| 9466 | - * Parses a date string |
|
| 9467 | - * |
|
| 9468 | - * @param String $dateString the date string |
|
| 9469 | - * @param String $timezone the timezone of a user |
|
| 9470 | - * @return Array the time information |
|
| 9471 | - * |
|
| 9472 | - */ |
|
| 9466 | + * Parses a date string |
|
| 9467 | + * |
|
| 9468 | + * @param String $dateString the date string |
|
| 9469 | + * @param String $timezone the timezone of a user |
|
| 9470 | + * @return Array the time information |
|
| 9471 | + * |
|
| 9472 | + */ |
|
| 9473 | 9473 | public function parseDateString($dateString, $timezone = '') |
| 9474 | 9474 | { |
| 9475 | 9475 | $time_array = array(); |
@@ -9505,12 +9505,12 @@ discard block |
||
| 9505 | 9505 | |
| 9506 | 9506 | |
| 9507 | 9507 | /** |
| 9508 | - * Parses the direction degrees to working |
|
| 9509 | - * |
|
| 9510 | - * @param Float $direction the direction in degrees |
|
| 9511 | - * @return Array the direction information |
|
| 9512 | - * |
|
| 9513 | - */ |
|
| 9508 | + * Parses the direction degrees to working |
|
| 9509 | + * |
|
| 9510 | + * @param Float $direction the direction in degrees |
|
| 9511 | + * @return Array the direction information |
|
| 9512 | + * |
|
| 9513 | + */ |
|
| 9514 | 9514 | public function parseDirection($direction = 0) |
| 9515 | 9515 | { |
| 9516 | 9516 | if ($direction == '') $direction = 0; |
@@ -9589,12 +9589,12 @@ discard block |
||
| 9589 | 9589 | |
| 9590 | 9590 | |
| 9591 | 9591 | /** |
| 9592 | - * Gets the aircraft registration |
|
| 9593 | - * |
|
| 9594 | - * @param String $flightaware_id the flight aware id |
|
| 9595 | - * @return String the aircraft registration |
|
| 9596 | - * |
|
| 9597 | - */ |
|
| 9592 | + * Gets the aircraft registration |
|
| 9593 | + * |
|
| 9594 | + * @param String $flightaware_id the flight aware id |
|
| 9595 | + * @return String the aircraft registration |
|
| 9596 | + * |
|
| 9597 | + */ |
|
| 9598 | 9598 | |
| 9599 | 9599 | public function getAircraftRegistration($flightaware_id) |
| 9600 | 9600 | { |
@@ -9623,12 +9623,12 @@ discard block |
||
| 9623 | 9623 | |
| 9624 | 9624 | |
| 9625 | 9625 | /** |
| 9626 | - * Gets the aircraft registration from ModeS |
|
| 9627 | - * |
|
| 9628 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 9629 | - * @return String the aircraft registration |
|
| 9630 | - * |
|
| 9631 | - */ |
|
| 9626 | + * Gets the aircraft registration from ModeS |
|
| 9627 | + * |
|
| 9628 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 9629 | + * @return String the aircraft registration |
|
| 9630 | + * |
|
| 9631 | + */ |
|
| 9632 | 9632 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
| 9633 | 9633 | { |
| 9634 | 9634 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -9641,19 +9641,19 @@ discard block |
||
| 9641 | 9641 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 9642 | 9642 | $sth->closeCursor(); |
| 9643 | 9643 | if (count($row) > 0) { |
| 9644 | - //return $row['Registration']; |
|
| 9645 | - return $row['registration']; |
|
| 9644 | + //return $row['Registration']; |
|
| 9645 | + return $row['registration']; |
|
| 9646 | 9646 | } else return ''; |
| 9647 | 9647 | |
| 9648 | 9648 | } |
| 9649 | 9649 | |
| 9650 | 9650 | /** |
| 9651 | - * Gets the aircraft type from ModeS |
|
| 9652 | - * |
|
| 9653 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 9654 | - * @return String the aircraft type |
|
| 9655 | - * |
|
| 9656 | - */ |
|
| 9651 | + * Gets the aircraft type from ModeS |
|
| 9652 | + * |
|
| 9653 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 9654 | + * @return String the aircraft type |
|
| 9655 | + * |
|
| 9656 | + */ |
|
| 9657 | 9657 | public function getAircraftTypeBymodeS($aircraft_modes) |
| 9658 | 9658 | { |
| 9659 | 9659 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -9666,19 +9666,19 @@ discard block |
||
| 9666 | 9666 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 9667 | 9667 | $sth->closeCursor(); |
| 9668 | 9668 | if (count($row) > 0) { |
| 9669 | - if ($row['type_flight'] == null) return ''; |
|
| 9670 | - else return $row['type_flight']; |
|
| 9669 | + if ($row['type_flight'] == null) return ''; |
|
| 9670 | + else return $row['type_flight']; |
|
| 9671 | 9671 | } else return ''; |
| 9672 | 9672 | |
| 9673 | 9673 | } |
| 9674 | 9674 | |
| 9675 | 9675 | /** |
| 9676 | - * Gets Countrie from latitude/longitude |
|
| 9677 | - * |
|
| 9678 | - * @param Float $latitude latitute of the flight |
|
| 9679 | - * @param Float $longitude longitute of the flight |
|
| 9680 | - * @return String the countrie |
|
| 9681 | - */ |
|
| 9676 | + * Gets Countrie from latitude/longitude |
|
| 9677 | + * |
|
| 9678 | + * @param Float $latitude latitute of the flight |
|
| 9679 | + * @param Float $longitude longitute of the flight |
|
| 9680 | + * @return String the countrie |
|
| 9681 | + */ |
|
| 9682 | 9682 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 9683 | 9683 | { |
| 9684 | 9684 | global $globalDBdriver, $globalDebug; |
@@ -9715,12 +9715,12 @@ discard block |
||
| 9715 | 9715 | } |
| 9716 | 9716 | |
| 9717 | 9717 | /** |
| 9718 | - * converts the registration code using the country prefix |
|
| 9719 | - * |
|
| 9720 | - * @param String $registration the aircraft registration |
|
| 9721 | - * @return String the aircraft registration |
|
| 9722 | - * |
|
| 9723 | - */ |
|
| 9718 | + * converts the registration code using the country prefix |
|
| 9719 | + * |
|
| 9720 | + * @param String $registration the aircraft registration |
|
| 9721 | + * @return String the aircraft registration |
|
| 9722 | + * |
|
| 9723 | + */ |
|
| 9724 | 9724 | public function convertAircraftRegistration($registration) |
| 9725 | 9725 | { |
| 9726 | 9726 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9772,12 +9772,12 @@ discard block |
||
| 9772 | 9772 | } |
| 9773 | 9773 | |
| 9774 | 9774 | /** |
| 9775 | - * Country from the registration code |
|
| 9776 | - * |
|
| 9777 | - * @param String $registration the aircraft registration |
|
| 9778 | - * @return String the country |
|
| 9779 | - * |
|
| 9780 | - */ |
|
| 9775 | + * Country from the registration code |
|
| 9776 | + * |
|
| 9777 | + * @param String $registration the aircraft registration |
|
| 9778 | + * @return String the country |
|
| 9779 | + * |
|
| 9780 | + */ |
|
| 9781 | 9781 | public function countryFromAircraftRegistration($registration) |
| 9782 | 9782 | { |
| 9783 | 9783 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9796,8 +9796,8 @@ discard block |
||
| 9796 | 9796 | $country = $row['country']; |
| 9797 | 9797 | } |
| 9798 | 9798 | } else { |
| 9799 | - $registration_1 = substr($registration, 0, 1); |
|
| 9800 | - $registration_2 = substr($registration, 0, 2); |
|
| 9799 | + $registration_1 = substr($registration, 0, 1); |
|
| 9800 | + $registration_2 = substr($registration, 0, 2); |
|
| 9801 | 9801 | |
| 9802 | 9802 | $country = ''; |
| 9803 | 9803 | //first get the prefix based on two characters |
@@ -9833,11 +9833,11 @@ discard block |
||
| 9833 | 9833 | } |
| 9834 | 9834 | |
| 9835 | 9835 | /** |
| 9836 | - * Set a new highlight value for a flight |
|
| 9837 | - * |
|
| 9838 | - * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 9839 | - * @param String $highlight New highlight value |
|
| 9840 | - */ |
|
| 9836 | + * Set a new highlight value for a flight |
|
| 9837 | + * |
|
| 9838 | + * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 9839 | + * @param String $highlight New highlight value |
|
| 9840 | + */ |
|
| 9841 | 9841 | public function setHighlightFlight($flightaware_id,$highlight) { |
| 9842 | 9842 | |
| 9843 | 9843 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
@@ -9846,12 +9846,12 @@ discard block |
||
| 9846 | 9846 | } |
| 9847 | 9847 | |
| 9848 | 9848 | /** |
| 9849 | - * Gets the short url from bit.ly |
|
| 9850 | - * |
|
| 9851 | - * @param String $url the full url |
|
| 9852 | - * @return String the bit.ly url |
|
| 9853 | - * |
|
| 9854 | - */ |
|
| 9849 | + * Gets the short url from bit.ly |
|
| 9850 | + * |
|
| 9851 | + * @param String $url the full url |
|
| 9852 | + * @return String the bit.ly url |
|
| 9853 | + * |
|
| 9854 | + */ |
|
| 9855 | 9855 | public function getBitlyURL($url) |
| 9856 | 9856 | { |
| 9857 | 9857 | global $globalBitlyAccessToken; |
@@ -10140,11 +10140,11 @@ discard block |
||
| 10140 | 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 | - } else { |
|
| 10143 | + } else { |
|
| 10144 | 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 | + } |
|
| 10148 | 10148 | $sth = $this->db->prepare($query); |
| 10149 | 10149 | $sth->execute(); |
| 10150 | 10150 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
| 5 | 5 | $global_query = "SELECT spotter_output.* FROM spotter_output"; |
| 6 | 6 | |
| 7 | -class Spotter{ |
|
| 7 | +class Spotter { |
|
| 8 | 8 | public $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 | } |
@@ -27,7 +27,9 @@ discard block |
||
| 27 | 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)) { |
|
| 31 | + $filter = array_merge($filter,$globalFilter); |
|
| 32 | + } |
|
| 31 | 33 | $filter_query_join = ''; |
| 32 | 34 | $filter_query_where = ''; |
| 33 | 35 | foreach($filters as $flt) { |
@@ -77,8 +79,11 @@ discard block |
||
| 77 | 79 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 78 | 80 | } |
| 79 | 81 | } |
| 80 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 81 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 82 | + if ($filter_query_where == '' && $where) { |
|
| 83 | + $filter_query_where = ' WHERE'; |
|
| 84 | + } elseif ($filter_query_where != '' && $and) { |
|
| 85 | + $filter_query_where .= ' AND'; |
|
| 86 | + } |
|
| 82 | 87 | $filter_query = $filter_query_join.$filter_query_where; |
| 83 | 88 | return $filter_query; |
| 84 | 89 | } |
@@ -98,10 +103,18 @@ discard block |
||
| 98 | 103 | $Image = new Image($this->db); |
| 99 | 104 | $Schedule = new Schedule($this->db); |
| 100 | 105 | $ACARS = new ACARS($this->db); |
| 101 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 102 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 103 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 104 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 106 | + if (!isset($globalIVAO)) { |
|
| 107 | + $globalIVAO = FALSE; |
|
| 108 | + } |
|
| 109 | + if (!isset($globalVATSIM)) { |
|
| 110 | + $globalVATSIM = FALSE; |
|
| 111 | + } |
|
| 112 | + if (!isset($globalphpVMS)) { |
|
| 113 | + $globalphpVMS = FALSE; |
|
| 114 | + } |
|
| 115 | + if (!isset($globalVAM)) { |
|
| 116 | + $globalVAM = FALSE; |
|
| 117 | + } |
|
| 105 | 118 | date_default_timezone_set('UTC'); |
| 106 | 119 | |
| 107 | 120 | if (!is_string($query)) |
@@ -148,21 +161,35 @@ discard block |
||
| 148 | 161 | } else { |
| 149 | 162 | $temp_array['spotter_id'] = ''; |
| 150 | 163 | } |
| 151 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 152 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 164 | + if (isset($row['flightaware_id'])) { |
|
| 165 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 166 | + } |
|
| 167 | + if (isset($row['modes'])) { |
|
| 168 | + $temp_array['modes'] = $row['modes']; |
|
| 169 | + } |
|
| 153 | 170 | $temp_array['ident'] = $row['ident']; |
| 154 | 171 | if (isset($row['registration']) && $row['registration'] != '') { |
| 155 | 172 | $temp_array['registration'] = $row['registration']; |
| 156 | 173 | } elseif (isset($temp_array['modes'])) { |
| 157 | 174 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 158 | - } else $temp_array['registration'] = ''; |
|
| 159 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 175 | + } else { |
|
| 176 | + $temp_array['registration'] = ''; |
|
| 177 | + } |
|
| 178 | + if (isset($row['aircraft_icao'])) { |
|
| 179 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 180 | + } |
|
| 160 | 181 | |
| 161 | 182 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 162 | 183 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 163 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 164 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 165 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 184 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 185 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 186 | + } |
|
| 187 | + if (isset($row['latitude'])) { |
|
| 188 | + $temp_array['latitude'] = $row['latitude']; |
|
| 189 | + } |
|
| 190 | + if (isset($row['longitude'])) { |
|
| 191 | + $temp_array['longitude'] = $row['longitude']; |
|
| 192 | + } |
|
| 166 | 193 | /* |
| 167 | 194 | if (Connection->tableExists('countries')) { |
| 168 | 195 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -172,8 +199,12 @@ discard block |
||
| 172 | 199 | } |
| 173 | 200 | } |
| 174 | 201 | */ |
| 175 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 176 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 202 | + if (isset($row['waypoints'])) { |
|
| 203 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 204 | + } |
|
| 205 | + if (isset($row['format_source'])) { |
|
| 206 | + $temp_array['format_source'] = $row['format_source']; |
|
| 207 | + } |
|
| 177 | 208 | if (isset($row['route_stop'])) { |
| 178 | 209 | $temp_array['route_stop'] = $row['route_stop']; |
| 179 | 210 | if ($row['route_stop'] != '') { |
@@ -192,13 +223,19 @@ discard block |
||
| 192 | 223 | } |
| 193 | 224 | } |
| 194 | 225 | } |
| 195 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 226 | + if (isset($row['altitude'])) { |
|
| 227 | + $temp_array['altitude'] = $row['altitude']; |
|
| 228 | + } |
|
| 196 | 229 | if (isset($row['heading'])) { |
| 197 | 230 | $temp_array['heading'] = $row['heading']; |
| 198 | 231 | $heading_direction = $this->parseDirection($row['heading']); |
| 199 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 232 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 233 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 234 | + } |
|
| 235 | + } |
|
| 236 | + if (isset($row['ground_speed'])) { |
|
| 237 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 200 | 238 | } |
| 201 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 202 | 239 | $temp_array['image'] = ""; |
| 203 | 240 | $temp_array['image_thumbnail'] = ""; |
| 204 | 241 | $temp_array['image_source'] = ""; |
@@ -206,7 +243,9 @@ discard block |
||
| 206 | 243 | |
| 207 | 244 | if (isset($row['highlight'])) { |
| 208 | 245 | $temp_array['highlight'] = $row['highlight']; |
| 209 | - } else $temp_array['highlight'] = ''; |
|
| 246 | + } else { |
|
| 247 | + $temp_array['highlight'] = ''; |
|
| 248 | + } |
|
| 210 | 249 | |
| 211 | 250 | if (isset($row['date'])) { |
| 212 | 251 | $dateArray = $this->parseDateString($row['date']); |
@@ -254,7 +293,9 @@ discard block |
||
| 254 | 293 | |
| 255 | 294 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 256 | 295 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 257 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 296 | + } else { |
|
| 297 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 298 | + } |
|
| 258 | 299 | } else { |
| 259 | 300 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 260 | 301 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -262,11 +303,17 @@ discard block |
||
| 262 | 303 | } |
| 263 | 304 | } |
| 264 | 305 | $fromsource = NULL; |
| 265 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 266 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 267 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 268 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 269 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 306 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 307 | + $fromsource = $globalAirlinesSource; |
|
| 308 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 309 | + $fromsource = 'vatsim'; |
|
| 310 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 311 | + $fromsource = 'ivao'; |
|
| 312 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 313 | + $fromsource = 'vatsim'; |
|
| 314 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 315 | + $fromsource = 'ivao'; |
|
| 316 | + } |
|
| 270 | 317 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 271 | 318 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 272 | 319 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -289,12 +336,18 @@ discard block |
||
| 289 | 336 | } |
| 290 | 337 | } else { |
| 291 | 338 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 292 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 293 | - else $temp_array['airline_iata'] = 'N/A'; |
|
| 339 | + if (isset($row['airline_iata'])) { |
|
| 340 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 341 | + } else { |
|
| 342 | + $temp_array['airline_iata'] = 'N/A'; |
|
| 343 | + } |
|
| 294 | 344 | $temp_array['airline_name'] = $row['airline_name']; |
| 295 | 345 | $temp_array['airline_country'] = $row['airline_country']; |
| 296 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 297 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 346 | + if (isset($row['airline_callsign'])) { |
|
| 347 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 348 | + } else { |
|
| 349 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 350 | + } |
|
| 298 | 351 | $temp_array['airline_type'] = $row['airline_type']; |
| 299 | 352 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
| 300 | 353 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -321,7 +374,9 @@ discard block |
||
| 321 | 374 | } |
| 322 | 375 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 323 | 376 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 324 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 377 | + if ($owner_info['owner'] != '') { |
|
| 378 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 379 | + } |
|
| 325 | 380 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 326 | 381 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 327 | 382 | } |
@@ -329,9 +384,14 @@ discard block |
||
| 329 | 384 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 330 | 385 | { |
| 331 | 386 | 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']); |
|
| 334 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 387 | + if (isset($temp_array['airline_icao'])) { |
|
| 388 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 389 | + } else { |
|
| 390 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 391 | + } |
|
| 392 | + } else { |
|
| 393 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 394 | + } |
|
| 335 | 395 | if (count($image_array) > 0) { |
| 336 | 396 | $temp_array['image'] = $image_array[0]['image']; |
| 337 | 397 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -382,7 +442,9 @@ discard block |
||
| 382 | 442 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 383 | 443 | if ($row['departure_airport_icao'] != '') { |
| 384 | 444 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 385 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 445 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 446 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 447 | + } |
|
| 386 | 448 | /* |
| 387 | 449 | } elseif ($row['departure_airport_name'] != '') { |
| 388 | 450 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -390,7 +452,9 @@ discard block |
||
| 390 | 452 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 391 | 453 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 392 | 454 | */ |
| 393 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 455 | + } else { |
|
| 456 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 457 | + } |
|
| 394 | 458 | if (isset($departure_airport_array[0]['name'])) { |
| 395 | 459 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 396 | 460 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -410,8 +474,12 @@ discard block |
||
| 410 | 474 | |
| 411 | 475 | if ($row['arrival_airport_icao'] != '') { |
| 412 | 476 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 413 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 414 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 477 | + if (count($arrival_airport_array) == 0) { |
|
| 478 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 479 | + } |
|
| 480 | + } else { |
|
| 481 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 482 | + } |
|
| 415 | 483 | if (isset($arrival_airport_array[0]['name'])) { |
| 416 | 484 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 417 | 485 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -427,27 +495,45 @@ discard block |
||
| 427 | 495 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 428 | 496 | } |
| 429 | 497 | */ |
| 430 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 431 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 432 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 433 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 434 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 498 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 499 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 500 | + } |
|
| 501 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 502 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 503 | + } |
|
| 504 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 505 | + $temp_array['source_name'] = $row['source_name']; |
|
| 506 | + } |
|
| 507 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 508 | + $temp_array['over_country'] = $row['over_country']; |
|
| 509 | + } |
|
| 510 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 511 | + $temp_array['distance'] = $row['distance']; |
|
| 512 | + } |
|
| 435 | 513 | if (isset($row['squawk'])) { |
| 436 | 514 | $temp_array['squawk'] = $row['squawk']; |
| 437 | 515 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 438 | 516 | $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); |
|
| 517 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 518 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 519 | + } |
|
| 440 | 520 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 441 | 521 | $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); |
|
| 522 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 523 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 524 | + } |
|
| 525 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 526 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 527 | + } |
|
| 444 | 528 | } |
| 445 | 529 | |
| 446 | 530 | $temp_array['query_number_rows'] = $num_rows; |
| 447 | 531 | |
| 448 | 532 | $spotter_array[] = $temp_array; |
| 449 | 533 | } |
| 450 | - if ($num_rows == 0) return array(); |
|
| 534 | + if ($num_rows == 0) { |
|
| 535 | + return array(); |
|
| 536 | + } |
|
| 451 | 537 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 452 | 538 | return $spotter_array; |
| 453 | 539 | } |
@@ -480,7 +566,9 @@ discard block |
||
| 480 | 566 | foreach ($q_array as $q_item){ |
| 481 | 567 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 482 | 568 | $additional_query .= " AND ("; |
| 483 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 569 | + if (is_int($q_item)) { |
|
| 570 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 571 | + } |
|
| 484 | 572 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 485 | 573 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 486 | 574 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -501,7 +589,9 @@ discard block |
||
| 501 | 589 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 502 | 590 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 503 | 591 | $translate = $Translation->ident2icao($q_item); |
| 504 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 592 | + if ($translate != $q_item) { |
|
| 593 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 594 | + } |
|
| 505 | 595 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 506 | 596 | $additional_query .= ")"; |
| 507 | 597 | } |
@@ -728,7 +818,9 @@ discard block |
||
| 728 | 818 | date_default_timezone_set($globalTimezone); |
| 729 | 819 | $datetime = new DateTime(); |
| 730 | 820 | $offset = $datetime->format('P'); |
| 731 | - } else $offset = '+00:00'; |
|
| 821 | + } else { |
|
| 822 | + $offset = '+00:00'; |
|
| 823 | + } |
|
| 732 | 824 | |
| 733 | 825 | if ($date_array[1] != "") |
| 734 | 826 | { |
@@ -760,8 +852,12 @@ discard block |
||
| 760 | 852 | { |
| 761 | 853 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 762 | 854 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 763 | - } else $limit_query = ""; |
|
| 764 | - } else $limit_query = ""; |
|
| 855 | + } else { |
|
| 856 | + $limit_query = ""; |
|
| 857 | + } |
|
| 858 | + } else { |
|
| 859 | + $limit_query = ""; |
|
| 860 | + } |
|
| 765 | 861 | |
| 766 | 862 | |
| 767 | 863 | if ($sort != "") |
@@ -829,8 +925,12 @@ discard block |
||
| 829 | 925 | { |
| 830 | 926 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 831 | 927 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 832 | - } else $limit_query = ""; |
|
| 833 | - } else $limit_query = ""; |
|
| 928 | + } else { |
|
| 929 | + $limit_query = ""; |
|
| 930 | + } |
|
| 931 | + } else { |
|
| 932 | + $limit_query = ""; |
|
| 933 | + } |
|
| 834 | 934 | |
| 835 | 935 | if ($sort != "") |
| 836 | 936 | { |
@@ -1154,7 +1254,9 @@ discard block |
||
| 1154 | 1254 | global $global_query; |
| 1155 | 1255 | |
| 1156 | 1256 | date_default_timezone_set('UTC'); |
| 1157 | - if ($id == '') return array(); |
|
| 1257 | + if ($id == '') { |
|
| 1258 | + return array(); |
|
| 1259 | + } |
|
| 1158 | 1260 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1159 | 1261 | $query_values = array(':id' => $id); |
| 1160 | 1262 | |
@@ -1781,7 +1883,9 @@ discard block |
||
| 1781 | 1883 | { |
| 1782 | 1884 | $highlight = $row['highlight']; |
| 1783 | 1885 | } |
| 1784 | - if (isset($highlight)) return $highlight; |
|
| 1886 | + if (isset($highlight)) { |
|
| 1887 | + return $highlight; |
|
| 1888 | + } |
|
| 1785 | 1889 | } |
| 1786 | 1890 | |
| 1787 | 1891 | |
@@ -1809,7 +1913,9 @@ discard block |
||
| 1809 | 1913 | $sth->closeCursor(); |
| 1810 | 1914 | if (count($row) > 0) { |
| 1811 | 1915 | return $row['usage']; |
| 1812 | - } else return ''; |
|
| 1916 | + } else { |
|
| 1917 | + return ''; |
|
| 1918 | + } |
|
| 1813 | 1919 | } |
| 1814 | 1920 | |
| 1815 | 1921 | /** |
@@ -1834,7 +1940,9 @@ discard block |
||
| 1834 | 1940 | $sth->closeCursor(); |
| 1835 | 1941 | if (count($row) > 0) { |
| 1836 | 1942 | return $row['icao']; |
| 1837 | - } else return ''; |
|
| 1943 | + } else { |
|
| 1944 | + return ''; |
|
| 1945 | + } |
|
| 1838 | 1946 | } |
| 1839 | 1947 | |
| 1840 | 1948 | /** |
@@ -1862,7 +1970,9 @@ discard block |
||
| 1862 | 1970 | $airport_longitude = $row['longitude']; |
| 1863 | 1971 | $Common = new Common(); |
| 1864 | 1972 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 1865 | - } else return ''; |
|
| 1973 | + } else { |
|
| 1974 | + return ''; |
|
| 1975 | + } |
|
| 1866 | 1976 | } |
| 1867 | 1977 | |
| 1868 | 1978 | /** |
@@ -1974,7 +2084,9 @@ discard block |
||
| 1974 | 2084 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1975 | 2085 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1976 | 2086 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1977 | - } else return array(); |
|
| 2087 | + } else { |
|
| 2088 | + return array(); |
|
| 2089 | + } |
|
| 1978 | 2090 | if ($globalDBdriver == 'mysql') { |
| 1979 | 2091 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 1980 | 2092 | } else { |
@@ -2009,7 +2121,9 @@ discard block |
||
| 2009 | 2121 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2010 | 2122 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2011 | 2123 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2012 | - } else return array(); |
|
| 2124 | + } else { |
|
| 2125 | + return array(); |
|
| 2126 | + } |
|
| 2013 | 2127 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2014 | 2128 | $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 | 2129 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2044,7 +2158,9 @@ discard block |
||
| 2044 | 2158 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2045 | 2159 | { |
| 2046 | 2160 | global $globalUseRealAirlines; |
| 2047 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2161 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2162 | + $fromsource = NULL; |
|
| 2163 | + } |
|
| 2048 | 2164 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2049 | 2165 | if ($airline_icao == 'NA') { |
| 2050 | 2166 | $airline_array = array(); |
@@ -2094,7 +2210,9 @@ discard block |
||
| 2094 | 2210 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2095 | 2211 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2096 | 2212 | $sth->closeCursor(); |
| 2097 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao); |
|
| 2213 | + if ($row['nb'] == 0) { |
|
| 2214 | + $result = $this->getAllAirlineInfo($airline_icao); |
|
| 2215 | + } |
|
| 2098 | 2216 | } |
| 2099 | 2217 | return $result; |
| 2100 | 2218 | } |
@@ -2158,15 +2276,20 @@ discard block |
||
| 2158 | 2276 | 'A320-211' => 'A320', |
| 2159 | 2277 | '747-8i' => 'B748', |
| 2160 | 2278 | 'A380' => 'A388'); |
| 2161 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2279 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2280 | + return $all_aircraft[$aircraft_type]; |
|
| 2281 | + } |
|
| 2162 | 2282 | |
| 2163 | 2283 | $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 | 2284 | $aircraft_type = strtoupper($aircraft_type); |
| 2165 | 2285 | $sth = $this->db->prepare($query); |
| 2166 | 2286 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2167 | 2287 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2168 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2169 | - else return ''; |
|
| 2288 | + if (isset($result[0]['icao'])) { |
|
| 2289 | + return $result[0]['icao']; |
|
| 2290 | + } else { |
|
| 2291 | + return ''; |
|
| 2292 | + } |
|
| 2170 | 2293 | } |
| 2171 | 2294 | |
| 2172 | 2295 | /** |
@@ -2189,7 +2312,9 @@ discard block |
||
| 2189 | 2312 | $sth->closeCursor(); |
| 2190 | 2313 | if (isset($row['icaotypecode'])) { |
| 2191 | 2314 | return $row['icaotypecode']; |
| 2192 | - } else return ''; |
|
| 2315 | + } else { |
|
| 2316 | + return ''; |
|
| 2317 | + } |
|
| 2193 | 2318 | } |
| 2194 | 2319 | |
| 2195 | 2320 | /** |
@@ -2211,7 +2336,9 @@ discard block |
||
| 2211 | 2336 | $sth->closeCursor(); |
| 2212 | 2337 | if (isset($row['operator_correct'])) { |
| 2213 | 2338 | return $row['operator_correct']; |
| 2214 | - } else return $operator; |
|
| 2339 | + } else { |
|
| 2340 | + return $operator; |
|
| 2341 | + } |
|
| 2215 | 2342 | } |
| 2216 | 2343 | |
| 2217 | 2344 | /** |
@@ -2224,7 +2351,9 @@ discard block |
||
| 2224 | 2351 | public function getRouteInfo($callsign) |
| 2225 | 2352 | { |
| 2226 | 2353 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2227 | - if ($callsign == '') return array(); |
|
| 2354 | + if ($callsign == '') { |
|
| 2355 | + return array(); |
|
| 2356 | + } |
|
| 2228 | 2357 | $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 | 2358 | |
| 2230 | 2359 | $sth = $this->db->prepare($query); |
@@ -2234,7 +2363,9 @@ discard block |
||
| 2234 | 2363 | $sth->closeCursor(); |
| 2235 | 2364 | if (count($row) > 0) { |
| 2236 | 2365 | return $row; |
| 2237 | - } else return array(); |
|
| 2366 | + } else { |
|
| 2367 | + return array(); |
|
| 2368 | + } |
|
| 2238 | 2369 | } |
| 2239 | 2370 | |
| 2240 | 2371 | /** |
@@ -2287,7 +2418,9 @@ discard block |
||
| 2287 | 2418 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2288 | 2419 | $sth->closeCursor(); |
| 2289 | 2420 | return $result; |
| 2290 | - } else return array(); |
|
| 2421 | + } else { |
|
| 2422 | + return array(); |
|
| 2423 | + } |
|
| 2291 | 2424 | } |
| 2292 | 2425 | |
| 2293 | 2426 | |
@@ -2444,8 +2577,11 @@ discard block |
||
| 2444 | 2577 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2445 | 2578 | |
| 2446 | 2579 | $sth = $this->db->prepare($query); |
| 2447 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2448 | - else $sth->execute(); |
|
| 2580 | + if (!empty($query_values)) { |
|
| 2581 | + $sth->execute($query_values); |
|
| 2582 | + } else { |
|
| 2583 | + $sth->execute(); |
|
| 2584 | + } |
|
| 2449 | 2585 | |
| 2450 | 2586 | $source_array = array(); |
| 2451 | 2587 | $temp_array = array(); |
@@ -2478,9 +2614,13 @@ discard block |
||
| 2478 | 2614 | WHERE spotter_output.airline_icao <> '' |
| 2479 | 2615 | ORDER BY spotter_output.airline_name ASC"; |
| 2480 | 2616 | */ |
| 2481 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2482 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2483 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2617 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2618 | + $forsource = $globalAirlinesSource; |
|
| 2619 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2620 | + $forsource = 'vatsim'; |
|
| 2621 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2622 | + $forsource = 'ivao'; |
|
| 2623 | + } |
|
| 2484 | 2624 | if ($forsource === NULL) { |
| 2485 | 2625 | $query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC"; |
| 2486 | 2626 | $query_data = array(); |
@@ -2772,7 +2912,9 @@ discard block |
||
| 2772 | 2912 | date_default_timezone_set($globalTimezone); |
| 2773 | 2913 | $datetime = new DateTime(); |
| 2774 | 2914 | $offset = $datetime->format('P'); |
| 2775 | - } else $offset = '+00:00'; |
|
| 2915 | + } else { |
|
| 2916 | + $offset = '+00:00'; |
|
| 2917 | + } |
|
| 2776 | 2918 | if ($airport_icao == '') { |
| 2777 | 2919 | if ($globalDBdriver == 'mysql') { |
| 2778 | 2920 | $query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -2804,7 +2946,9 @@ discard block |
||
| 2804 | 2946 | date_default_timezone_set($globalTimezone); |
| 2805 | 2947 | $datetime = new DateTime(); |
| 2806 | 2948 | $offset = $datetime->format('P'); |
| 2807 | - } else $offset = '+00:00'; |
|
| 2949 | + } else { |
|
| 2950 | + $offset = '+00:00'; |
|
| 2951 | + } |
|
| 2808 | 2952 | if ($airport_icao == '') { |
| 2809 | 2953 | if ($globalDBdriver == 'mysql') { |
| 2810 | 2954 | $query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -2837,7 +2981,9 @@ discard block |
||
| 2837 | 2981 | date_default_timezone_set($globalTimezone); |
| 2838 | 2982 | $datetime = new DateTime(); |
| 2839 | 2983 | $offset = $datetime->format('P'); |
| 2840 | - } else $offset = '+00:00'; |
|
| 2984 | + } else { |
|
| 2985 | + $offset = '+00:00'; |
|
| 2986 | + } |
|
| 2841 | 2987 | if ($airport_icao == '') { |
| 2842 | 2988 | if ($globalDBdriver == 'mysql') { |
| 2843 | 2989 | $query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -2876,7 +3022,9 @@ discard block |
||
| 2876 | 3022 | date_default_timezone_set($globalTimezone); |
| 2877 | 3023 | $datetime = new DateTime(); |
| 2878 | 3024 | $offset = $datetime->format('P'); |
| 2879 | - } else $offset = '+00:00'; |
|
| 3025 | + } else { |
|
| 3026 | + $offset = '+00:00'; |
|
| 3027 | + } |
|
| 2880 | 3028 | if ($airport_icao == '') { |
| 2881 | 3029 | if ($globalDBdriver == 'mysql') { |
| 2882 | 3030 | $query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -2921,7 +3069,9 @@ discard block |
||
| 2921 | 3069 | date_default_timezone_set($globalTimezone); |
| 2922 | 3070 | $datetime = new DateTime(); |
| 2923 | 3071 | $offset = $datetime->format('P'); |
| 2924 | - } else $offset = '+00:00'; |
|
| 3072 | + } else { |
|
| 3073 | + $offset = '+00:00'; |
|
| 3074 | + } |
|
| 2925 | 3075 | if ($airport_icao == '') { |
| 2926 | 3076 | if ($globalDBdriver == 'mysql') { |
| 2927 | 3077 | $query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -2956,7 +3106,9 @@ discard block |
||
| 2956 | 3106 | date_default_timezone_set($globalTimezone); |
| 2957 | 3107 | $datetime = new DateTime(); |
| 2958 | 3108 | $offset = $datetime->format('P'); |
| 2959 | - } else $offset = '+00:00'; |
|
| 3109 | + } else { |
|
| 3110 | + $offset = '+00:00'; |
|
| 3111 | + } |
|
| 2960 | 3112 | if ($airport_icao == '') { |
| 2961 | 3113 | if ($globalDBdriver == 'mysql') { |
| 2962 | 3114 | $query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -2998,7 +3150,9 @@ discard block |
||
| 2998 | 3150 | date_default_timezone_set($globalTimezone); |
| 2999 | 3151 | $datetime = new DateTime(); |
| 3000 | 3152 | $offset = $datetime->format('P'); |
| 3001 | - } else $offset = '+00:00'; |
|
| 3153 | + } else { |
|
| 3154 | + $offset = '+00:00'; |
|
| 3155 | + } |
|
| 3002 | 3156 | if ($airport_icao == '') { |
| 3003 | 3157 | if ($globalDBdriver == 'mysql') { |
| 3004 | 3158 | $query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3032,7 +3186,9 @@ discard block |
||
| 3032 | 3186 | date_default_timezone_set($globalTimezone); |
| 3033 | 3187 | $datetime = new DateTime(); |
| 3034 | 3188 | $offset = $datetime->format('P'); |
| 3035 | - } else $offset = '+00:00'; |
|
| 3189 | + } else { |
|
| 3190 | + $offset = '+00:00'; |
|
| 3191 | + } |
|
| 3036 | 3192 | if ($airport_icao == '') { |
| 3037 | 3193 | if ($globalDBdriver == 'mysql') { |
| 3038 | 3194 | $query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3080,7 +3236,9 @@ discard block |
||
| 3080 | 3236 | date_default_timezone_set($globalTimezone); |
| 3081 | 3237 | $datetime = new DateTime(); |
| 3082 | 3238 | $offset = $datetime->format('P'); |
| 3083 | - } else $offset = '+00:00'; |
|
| 3239 | + } else { |
|
| 3240 | + $offset = '+00:00'; |
|
| 3241 | + } |
|
| 3084 | 3242 | |
| 3085 | 3243 | if ($globalDBdriver == 'mysql') { |
| 3086 | 3244 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3200,7 +3358,9 @@ discard block |
||
| 3200 | 3358 | */ |
| 3201 | 3359 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3202 | 3360 | { |
| 3203 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3361 | + if ($groundspeed == '') { |
|
| 3362 | + $groundspeed = NULL; |
|
| 3363 | + } |
|
| 3204 | 3364 | $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 | 3365 | $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 | 3366 | |
@@ -3250,10 +3410,18 @@ discard block |
||
| 3250 | 3410 | $Image = new Image($this->db); |
| 3251 | 3411 | $Common = new Common(); |
| 3252 | 3412 | |
| 3253 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3254 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3255 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3256 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3413 | + if (!isset($globalIVAO)) { |
|
| 3414 | + $globalIVAO = FALSE; |
|
| 3415 | + } |
|
| 3416 | + if (!isset($globalVATSIM)) { |
|
| 3417 | + $globalVATSIM = FALSE; |
|
| 3418 | + } |
|
| 3419 | + if (!isset($globalphpVMS)) { |
|
| 3420 | + $globalphpVMS = FALSE; |
|
| 3421 | + } |
|
| 3422 | + if (!isset($globalVAM)) { |
|
| 3423 | + $globalVAM = FALSE; |
|
| 3424 | + } |
|
| 3257 | 3425 | date_default_timezone_set('UTC'); |
| 3258 | 3426 | |
| 3259 | 3427 | //getting the registration |
@@ -3266,23 +3434,33 @@ discard block |
||
| 3266 | 3434 | if ($ModeS != '') { |
| 3267 | 3435 | $timeelapsed = microtime(true); |
| 3268 | 3436 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3269 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3437 | + if ($globalDebugTimeElapsed) { |
|
| 3438 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3439 | + } |
|
| 3270 | 3440 | } else { |
| 3271 | 3441 | $myhex = explode('-',$flightaware_id); |
| 3272 | 3442 | if (count($myhex) > 0) { |
| 3273 | 3443 | $timeelapsed = microtime(true); |
| 3274 | 3444 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3275 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3445 | + if ($globalDebugTimeElapsed) { |
|
| 3446 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3447 | + } |
|
| 3276 | 3448 | } |
| 3277 | 3449 | } |
| 3278 | 3450 | } |
| 3279 | 3451 | } |
| 3280 | 3452 | $fromsource = NULL; |
| 3281 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3282 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3283 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3284 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3285 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3453 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3454 | + $fromsource = $globalAirlinesSource; |
|
| 3455 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3456 | + $fromsource = 'vatsim'; |
|
| 3457 | + } elseif ($format_source == 'whazzup') { |
|
| 3458 | + $fromsource = 'ivao'; |
|
| 3459 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3460 | + $fromsource = 'vatsim'; |
|
| 3461 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3462 | + $fromsource = 'ivao'; |
|
| 3463 | + } |
|
| 3286 | 3464 | //getting the airline information |
| 3287 | 3465 | if ($ident != "") |
| 3288 | 3466 | { |
@@ -3306,15 +3484,21 @@ discard block |
||
| 3306 | 3484 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3307 | 3485 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3308 | 3486 | } |
| 3309 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3487 | + if ($globalDebugTimeElapsed) { |
|
| 3488 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3489 | + } |
|
| 3310 | 3490 | |
| 3311 | 3491 | } else { |
| 3312 | 3492 | $timeelapsed = microtime(true); |
| 3313 | 3493 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3314 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3494 | + if ($globalDebugTimeElapsed) { |
|
| 3495 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3496 | + } |
|
| 3315 | 3497 | } |
| 3316 | 3498 | } |
| 3317 | - } else $airline_array = array(); |
|
| 3499 | + } else { |
|
| 3500 | + $airline_array = array(); |
|
| 3501 | + } |
|
| 3318 | 3502 | |
| 3319 | 3503 | //getting the aircraft information |
| 3320 | 3504 | $aircraft_array = array(); |
@@ -3328,27 +3512,37 @@ discard block |
||
| 3328 | 3512 | { |
| 3329 | 3513 | $timeelapsed = microtime(true); |
| 3330 | 3514 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3331 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3515 | + if ($globalDebugTimeElapsed) { |
|
| 3516 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3517 | + } |
|
| 3332 | 3518 | } else { |
| 3333 | 3519 | $timeelapsed = microtime(true); |
| 3334 | 3520 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3335 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3521 | + if ($globalDebugTimeElapsed) { |
|
| 3522 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3523 | + } |
|
| 3336 | 3524 | } |
| 3337 | 3525 | } |
| 3338 | 3526 | } else { |
| 3339 | 3527 | if ($ModeS != '') { |
| 3340 | 3528 | $timeelapsed = microtime(true); |
| 3341 | 3529 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3342 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3530 | + if ($globalDebugTimeElapsed) { |
|
| 3531 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3532 | + } |
|
| 3343 | 3533 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3344 | 3534 | { |
| 3345 | 3535 | $timeelapsed = microtime(true); |
| 3346 | 3536 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3347 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3537 | + if ($globalDebugTimeElapsed) { |
|
| 3538 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3539 | + } |
|
| 3348 | 3540 | } else { |
| 3349 | 3541 | $timeelapsed = microtime(true); |
| 3350 | 3542 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3351 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3543 | + if ($globalDebugTimeElapsed) { |
|
| 3544 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3545 | + } |
|
| 3352 | 3546 | } |
| 3353 | 3547 | } |
| 3354 | 3548 | } |
@@ -3363,7 +3557,9 @@ discard block |
||
| 3363 | 3557 | } else { |
| 3364 | 3558 | $timeelapsed = microtime(true); |
| 3365 | 3559 | $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"; |
|
| 3560 | + if ($globalDebugTimeElapsed) { |
|
| 3561 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3562 | + } |
|
| 3367 | 3563 | } |
| 3368 | 3564 | } |
| 3369 | 3565 | |
@@ -3377,7 +3573,9 @@ discard block |
||
| 3377 | 3573 | } else { |
| 3378 | 3574 | $timeelapsed = microtime(true); |
| 3379 | 3575 | $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"; |
|
| 3576 | + if ($globalDebugTimeElapsed) { |
|
| 3577 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3578 | + } |
|
| 3381 | 3579 | } |
| 3382 | 3580 | } |
| 3383 | 3581 | |
@@ -3412,7 +3610,9 @@ discard block |
||
| 3412 | 3610 | { |
| 3413 | 3611 | return false; |
| 3414 | 3612 | } |
| 3415 | - } else $altitude = 0; |
|
| 3613 | + } else { |
|
| 3614 | + $altitude = 0; |
|
| 3615 | + } |
|
| 3416 | 3616 | |
| 3417 | 3617 | if ($heading != "") |
| 3418 | 3618 | { |
@@ -3441,7 +3641,9 @@ discard block |
||
| 3441 | 3641 | { |
| 3442 | 3642 | $timeelapsed = microtime(true); |
| 3443 | 3643 | $image_array = $Image->getSpotterImage($registration); |
| 3444 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3644 | + if ($globalDebugTimeElapsed) { |
|
| 3645 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3646 | + } |
|
| 3445 | 3647 | if (!isset($image_array[0]['registration'])) |
| 3446 | 3648 | { |
| 3447 | 3649 | //echo "Add image !!!! \n"; |
@@ -3449,14 +3651,21 @@ discard block |
||
| 3449 | 3651 | } |
| 3450 | 3652 | $timeelapsed = microtime(true); |
| 3451 | 3653 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3452 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3453 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3654 | + if ($globalDebugTimeElapsed) { |
|
| 3655 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3656 | + } |
|
| 3657 | + if ($owner_info['owner'] != '') { |
|
| 3658 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3659 | + } |
|
| 3454 | 3660 | } |
| 3455 | 3661 | |
| 3456 | 3662 | if ($globalIVAO && $aircraft_icao != '') |
| 3457 | 3663 | { |
| 3458 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3459 | - else $airline_icao = ''; |
|
| 3664 | + if (isset($airline_array[0]['icao'])) { |
|
| 3665 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3666 | + } else { |
|
| 3667 | + $airline_icao = ''; |
|
| 3668 | + } |
|
| 3460 | 3669 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3461 | 3670 | if (!isset($image_array[0]['registration'])) |
| 3462 | 3671 | { |
@@ -3501,16 +3710,28 @@ discard block |
||
| 3501 | 3710 | { |
| 3502 | 3711 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3503 | 3712 | } |
| 3504 | - if ($registration == '') $registration = 'NA'; |
|
| 3713 | + if ($registration == '') { |
|
| 3714 | + $registration = 'NA'; |
|
| 3715 | + } |
|
| 3505 | 3716 | if ($latitude == '' && $longitude == '') { |
| 3506 | 3717 | $latitude = 0; |
| 3507 | 3718 | $longitude = 0; |
| 3508 | 3719 | } |
| 3509 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3510 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3511 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3512 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3513 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3720 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 3721 | + $squawk = NULL; |
|
| 3722 | + } |
|
| 3723 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 3724 | + $verticalrate = NULL; |
|
| 3725 | + } |
|
| 3726 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 3727 | + $heading = 0; |
|
| 3728 | + } |
|
| 3729 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 3730 | + $groundspeed = 0; |
|
| 3731 | + } |
|
| 3732 | + if (!isset($aircraft_owner)) { |
|
| 3733 | + $aircraft_owner = NULL; |
|
| 3734 | + } |
|
| 3514 | 3735 | $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 | 3736 | 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 | 3737 | |
@@ -3521,9 +3742,13 @@ discard block |
||
| 3521 | 3742 | if ($airline_type == '') { |
| 3522 | 3743 | $timeelapsed = microtime(true); |
| 3523 | 3744 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3524 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3745 | + if ($globalDebugTimeElapsed) { |
|
| 3746 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3747 | + } |
|
| 3748 | + } |
|
| 3749 | + if ($airline_type == null) { |
|
| 3750 | + $airline_type = ''; |
|
| 3525 | 3751 | } |
| 3526 | - if ($airline_type == null) $airline_type = ''; |
|
| 3527 | 3752 | $aircraft_type = $aircraft_array[0]['type']; |
| 3528 | 3753 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3529 | 3754 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3658,7 +3883,9 @@ discard block |
||
| 3658 | 3883 | } |
| 3659 | 3884 | } |
| 3660 | 3885 | $query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 3661 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 3886 | + if ($limit) { |
|
| 3887 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 3888 | + } |
|
| 3662 | 3889 | |
| 3663 | 3890 | $sth = $this->db->prepare($query); |
| 3664 | 3891 | $sth->execute(); |
@@ -3703,7 +3930,9 @@ discard block |
||
| 3703 | 3930 | } |
| 3704 | 3931 | } |
| 3705 | 3932 | $query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 3706 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 3933 | + if ($limit) { |
|
| 3934 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 3935 | + } |
|
| 3707 | 3936 | |
| 3708 | 3937 | |
| 3709 | 3938 | $sth = $this->db->prepare($query); |
@@ -3749,7 +3978,9 @@ discard block |
||
| 3749 | 3978 | } |
| 3750 | 3979 | } |
| 3751 | 3980 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 3752 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 3981 | + if ($limit) { |
|
| 3982 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 3983 | + } |
|
| 3753 | 3984 | |
| 3754 | 3985 | |
| 3755 | 3986 | $sth = $this->db->prepare($query); |
@@ -3797,7 +4028,9 @@ discard block |
||
| 3797 | 4028 | } |
| 3798 | 4029 | } |
| 3799 | 4030 | $query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 3800 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4031 | + if ($limit) { |
|
| 4032 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4033 | + } |
|
| 3801 | 4034 | |
| 3802 | 4035 | |
| 3803 | 4036 | $sth = $this->db->prepare($query); |
@@ -3842,7 +4075,9 @@ discard block |
||
| 3842 | 4075 | } |
| 3843 | 4076 | } |
| 3844 | 4077 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 3845 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4078 | + if ($limit) { |
|
| 4079 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4080 | + } |
|
| 3846 | 4081 | |
| 3847 | 4082 | |
| 3848 | 4083 | $sth = $this->db->prepare($query); |
@@ -4085,7 +4320,9 @@ discard block |
||
| 4085 | 4320 | date_default_timezone_set($globalTimezone); |
| 4086 | 4321 | $datetime = new DateTime($date); |
| 4087 | 4322 | $offset = $datetime->format('P'); |
| 4088 | - } else $offset = '+00:00'; |
|
| 4323 | + } else { |
|
| 4324 | + $offset = '+00:00'; |
|
| 4325 | + } |
|
| 4089 | 4326 | |
| 4090 | 4327 | if ($globalDBdriver == 'mysql') { |
| 4091 | 4328 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4133,7 +4370,9 @@ discard block |
||
| 4133 | 4370 | date_default_timezone_set($globalTimezone); |
| 4134 | 4371 | $datetime = new DateTime($date); |
| 4135 | 4372 | $offset = $datetime->format('P'); |
| 4136 | - } else $offset = '+00:00'; |
|
| 4373 | + } else { |
|
| 4374 | + $offset = '+00:00'; |
|
| 4375 | + } |
|
| 4137 | 4376 | |
| 4138 | 4377 | if ($globalDBdriver == 'mysql') { |
| 4139 | 4378 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4351,7 +4590,9 @@ discard block |
||
| 4351 | 4590 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
| 4352 | 4591 | GROUP BY spotter_output.airline_country |
| 4353 | 4592 | ORDER BY airline_country_count DESC"; |
| 4354 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4593 | + if ($limit) { |
|
| 4594 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4595 | + } |
|
| 4355 | 4596 | |
| 4356 | 4597 | $sth = $this->db->prepare($query); |
| 4357 | 4598 | $sth->execute(); |
@@ -4379,7 +4620,9 @@ discard block |
||
| 4379 | 4620 | global $globalDBdriver; |
| 4380 | 4621 | //$filter_query = $this->getFilter($filters,true,true); |
| 4381 | 4622 | $Connection= new Connection($this->db); |
| 4382 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 4623 | + if (!$Connection->tableExists('countries')) { |
|
| 4624 | + return array(); |
|
| 4625 | + } |
|
| 4383 | 4626 | /* |
| 4384 | 4627 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 4385 | 4628 | FROM countries c, spotter_output s |
@@ -4404,7 +4647,9 @@ discard block |
||
| 4404 | 4647 | } |
| 4405 | 4648 | |
| 4406 | 4649 | $query .= "GROUP BY c.name ORDER BY nb DESC"; |
| 4407 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4650 | + if ($limit) { |
|
| 4651 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4652 | + } |
|
| 4408 | 4653 | |
| 4409 | 4654 | |
| 4410 | 4655 | $sth = $this->db->prepare($query); |
@@ -4454,7 +4699,9 @@ discard block |
||
| 4454 | 4699 | } |
| 4455 | 4700 | |
| 4456 | 4701 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4457 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4702 | + if ($limit) { |
|
| 4703 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4704 | + } |
|
| 4458 | 4705 | |
| 4459 | 4706 | $sth = $this->db->prepare($query); |
| 4460 | 4707 | $sth->execute(); |
@@ -4500,7 +4747,9 @@ discard block |
||
| 4500 | 4747 | } |
| 4501 | 4748 | |
| 4502 | 4749 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4503 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4750 | + if ($limit) { |
|
| 4751 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4752 | + } |
|
| 4504 | 4753 | |
| 4505 | 4754 | $sth = $this->db->prepare($query); |
| 4506 | 4755 | $sth->execute(); |
@@ -4547,7 +4796,9 @@ discard block |
||
| 4547 | 4796 | } |
| 4548 | 4797 | |
| 4549 | 4798 | $query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4550 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4799 | + if ($limit) { |
|
| 4800 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4801 | + } |
|
| 4551 | 4802 | |
| 4552 | 4803 | $sth = $this->db->prepare($query); |
| 4553 | 4804 | $sth->execute(); |
@@ -4600,7 +4851,9 @@ discard block |
||
| 4600 | 4851 | if($row['registration'] != "") |
| 4601 | 4852 | { |
| 4602 | 4853 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4603 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 4854 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 4855 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 4856 | + } |
|
| 4604 | 4857 | } |
| 4605 | 4858 | $temp_array['registration_count'] = $row['registration_count']; |
| 4606 | 4859 | |
@@ -4675,7 +4928,9 @@ discard block |
||
| 4675 | 4928 | if($row['registration'] != "") |
| 4676 | 4929 | { |
| 4677 | 4930 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4678 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 4931 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 4932 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 4933 | + } |
|
| 4679 | 4934 | } |
| 4680 | 4935 | $temp_array['registration_count'] = $row['registration_count']; |
| 4681 | 4936 | |
@@ -4782,7 +5037,9 @@ discard block |
||
| 4782 | 5037 | if($row['registration'] != "") |
| 4783 | 5038 | { |
| 4784 | 5039 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4785 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5040 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5041 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5042 | + } |
|
| 4786 | 5043 | } |
| 4787 | 5044 | $temp_array['registration_count'] = $row['registration_count']; |
| 4788 | 5045 | $aircraft_array[] = $temp_array; |
@@ -4907,7 +5164,9 @@ discard block |
||
| 4907 | 5164 | date_default_timezone_set($globalTimezone); |
| 4908 | 5165 | $datetime = new DateTime($date); |
| 4909 | 5166 | $offset = $datetime->format('P'); |
| 4910 | - } else $offset = '+00:00'; |
|
| 5167 | + } else { |
|
| 5168 | + $offset = '+00:00'; |
|
| 5169 | + } |
|
| 4911 | 5170 | |
| 4912 | 5171 | if ($globalDBdriver == 'mysql') { |
| 4913 | 5172 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -4954,7 +5213,9 @@ discard block |
||
| 4954 | 5213 | date_default_timezone_set($globalTimezone); |
| 4955 | 5214 | $datetime = new DateTime($date); |
| 4956 | 5215 | $offset = $datetime->format('P'); |
| 4957 | - } else $offset = '+00:00'; |
|
| 5216 | + } else { |
|
| 5217 | + $offset = '+00:00'; |
|
| 5218 | + } |
|
| 4958 | 5219 | |
| 4959 | 5220 | if ($globalDBdriver == 'mysql') { |
| 4960 | 5221 | $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 |
@@ -4983,7 +5244,9 @@ discard block |
||
| 4983 | 5244 | if($row['registration'] != "") |
| 4984 | 5245 | { |
| 4985 | 5246 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4986 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5247 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5248 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5249 | + } |
|
| 4987 | 5250 | } |
| 4988 | 5251 | $temp_array['registration_count'] = $row['registration_count']; |
| 4989 | 5252 | |
@@ -5008,7 +5271,9 @@ discard block |
||
| 5008 | 5271 | date_default_timezone_set($globalTimezone); |
| 5009 | 5272 | $datetime = new DateTime($date); |
| 5010 | 5273 | $offset = $datetime->format('P'); |
| 5011 | - } else $offset = '+00:00'; |
|
| 5274 | + } else { |
|
| 5275 | + $offset = '+00:00'; |
|
| 5276 | + } |
|
| 5012 | 5277 | |
| 5013 | 5278 | if ($globalDBdriver == 'mysql') { |
| 5014 | 5279 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5106,8 +5371,11 @@ discard block |
||
| 5106 | 5371 | if($row['registration'] != "") |
| 5107 | 5372 | { |
| 5108 | 5373 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5109 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5110 | - else $temp_array['image_thumbnail'] = ''; |
|
| 5374 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5375 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5376 | + } else { |
|
| 5377 | + $temp_array['image_thumbnail'] = ''; |
|
| 5378 | + } |
|
| 5111 | 5379 | } |
| 5112 | 5380 | $temp_array['registration_count'] = $row['registration_count']; |
| 5113 | 5381 | $aircraft_array[] = $temp_array; |
@@ -5214,7 +5482,9 @@ discard block |
||
| 5214 | 5482 | if($row['registration'] != "") |
| 5215 | 5483 | { |
| 5216 | 5484 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5217 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5485 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5486 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5487 | + } |
|
| 5218 | 5488 | } |
| 5219 | 5489 | $temp_array['registration_count'] = $row['registration_count']; |
| 5220 | 5490 | |
@@ -5331,7 +5601,9 @@ discard block |
||
| 5331 | 5601 | if($row['registration'] != "") |
| 5332 | 5602 | { |
| 5333 | 5603 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5334 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5604 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5605 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5606 | + } |
|
| 5335 | 5607 | } |
| 5336 | 5608 | $temp_array['registration_count'] = $row['registration_count']; |
| 5337 | 5609 | |
@@ -5443,7 +5715,9 @@ discard block |
||
| 5443 | 5715 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5444 | 5716 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5445 | 5717 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 5446 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5718 | + if ($limit) { |
|
| 5719 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5720 | + } |
|
| 5447 | 5721 | |
| 5448 | 5722 | $sth = $this->db->prepare($query); |
| 5449 | 5723 | $sth->execute(); |
@@ -5462,7 +5736,9 @@ discard block |
||
| 5462 | 5736 | if($row['registration'] != "") |
| 5463 | 5737 | { |
| 5464 | 5738 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5465 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5739 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5740 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5741 | + } |
|
| 5466 | 5742 | } |
| 5467 | 5743 | |
| 5468 | 5744 | $aircraft_array[] = $temp_array; |
@@ -5503,7 +5779,9 @@ discard block |
||
| 5503 | 5779 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5504 | 5780 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5505 | 5781 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 5506 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5782 | + if ($limit) { |
|
| 5783 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5784 | + } |
|
| 5507 | 5785 | |
| 5508 | 5786 | $sth = $this->db->prepare($query); |
| 5509 | 5787 | $sth->execute(); |
@@ -5523,7 +5801,9 @@ discard block |
||
| 5523 | 5801 | if($row['registration'] != "") |
| 5524 | 5802 | { |
| 5525 | 5803 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5526 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5804 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5805 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5806 | + } |
|
| 5527 | 5807 | } |
| 5528 | 5808 | |
| 5529 | 5809 | $aircraft_array[] = $temp_array; |
@@ -5564,7 +5844,9 @@ discard block |
||
| 5564 | 5844 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5565 | 5845 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5566 | 5846 | ORDER BY airport_departure_icao_count DESC"; |
| 5567 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5847 | + if ($limit) { |
|
| 5848 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5849 | + } |
|
| 5568 | 5850 | |
| 5569 | 5851 | $sth = $this->db->prepare($query); |
| 5570 | 5852 | $sth->execute(); |
@@ -5616,7 +5898,9 @@ discard block |
||
| 5616 | 5898 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5617 | 5899 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5618 | 5900 | ORDER BY airport_departure_icao_count DESC"; |
| 5619 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5901 | + if ($limit) { |
|
| 5902 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5903 | + } |
|
| 5620 | 5904 | |
| 5621 | 5905 | $sth = $this->db->prepare($query); |
| 5622 | 5906 | $sth->execute(); |
@@ -5668,7 +5952,9 @@ discard block |
||
| 5668 | 5952 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5669 | 5953 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 5670 | 5954 | ORDER BY airport_departure_icao_count DESC"; |
| 5671 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5955 | + if ($limit) { |
|
| 5956 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5957 | + } |
|
| 5672 | 5958 | //echo $query; |
| 5673 | 5959 | $sth = $this->db->prepare($query); |
| 5674 | 5960 | $sth->execute(); |
@@ -5720,7 +6006,9 @@ discard block |
||
| 5720 | 6006 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5721 | 6007 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 5722 | 6008 | ORDER BY airport_departure_icao_count DESC"; |
| 5723 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6009 | + if ($limit) { |
|
| 6010 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6011 | + } |
|
| 5724 | 6012 | |
| 5725 | 6013 | $sth = $this->db->prepare($query); |
| 5726 | 6014 | $sth->execute(); |
@@ -6115,7 +6403,9 @@ discard block |
||
| 6115 | 6403 | date_default_timezone_set($globalTimezone); |
| 6116 | 6404 | $datetime = new DateTime($date); |
| 6117 | 6405 | $offset = $datetime->format('P'); |
| 6118 | - } else $offset = '+00:00'; |
|
| 6406 | + } else { |
|
| 6407 | + $offset = '+00:00'; |
|
| 6408 | + } |
|
| 6119 | 6409 | |
| 6120 | 6410 | if ($globalDBdriver == 'mysql') { |
| 6121 | 6411 | $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 |
@@ -6165,7 +6455,9 @@ discard block |
||
| 6165 | 6455 | date_default_timezone_set($globalTimezone); |
| 6166 | 6456 | $datetime = new DateTime($date); |
| 6167 | 6457 | $offset = $datetime->format('P'); |
| 6168 | - } else $offset = '+00:00'; |
|
| 6458 | + } else { |
|
| 6459 | + $offset = '+00:00'; |
|
| 6460 | + } |
|
| 6169 | 6461 | |
| 6170 | 6462 | if ($globalDBdriver == 'mysql') { |
| 6171 | 6463 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -6378,7 +6670,9 @@ discard block |
||
| 6378 | 6670 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6379 | 6671 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6380 | 6672 | ORDER BY airport_arrival_icao_count DESC"; |
| 6381 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6673 | + if ($limit) { |
|
| 6674 | + $query .= " LIMIT 10"; |
|
| 6675 | + } |
|
| 6382 | 6676 | |
| 6383 | 6677 | |
| 6384 | 6678 | $sth = $this->db->prepare($query); |
@@ -6398,7 +6692,9 @@ discard block |
||
| 6398 | 6692 | if ($icaoaskey) { |
| 6399 | 6693 | $icao = $row['arrival_airport_icao']; |
| 6400 | 6694 | $airport_array[$icao] = $temp_array; |
| 6401 | - } else $airport_array[] = $temp_array; |
|
| 6695 | + } else { |
|
| 6696 | + $airport_array[] = $temp_array; |
|
| 6697 | + } |
|
| 6402 | 6698 | } |
| 6403 | 6699 | |
| 6404 | 6700 | return $airport_array; |
@@ -6440,7 +6736,9 @@ discard block |
||
| 6440 | 6736 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6441 | 6737 | $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6442 | 6738 | ORDER BY airport_arrival_icao_count DESC"; |
| 6443 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6739 | + if ($limit) { |
|
| 6740 | + $query .= " LIMIT 10"; |
|
| 6741 | + } |
|
| 6444 | 6742 | |
| 6445 | 6743 | |
| 6446 | 6744 | $sth = $this->db->prepare($query); |
@@ -6461,7 +6759,9 @@ discard block |
||
| 6461 | 6759 | if ($icaoaskey) { |
| 6462 | 6760 | $icao = $row['arrival_airport_icao']; |
| 6463 | 6761 | $airport_array[$icao] = $temp_array; |
| 6464 | - } else $airport_array[] = $temp_array; |
|
| 6762 | + } else { |
|
| 6763 | + $airport_array[] = $temp_array; |
|
| 6764 | + } |
|
| 6465 | 6765 | } |
| 6466 | 6766 | |
| 6467 | 6767 | return $airport_array; |
@@ -6503,7 +6803,9 @@ discard block |
||
| 6503 | 6803 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6504 | 6804 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 6505 | 6805 | ORDER BY airport_arrival_icao_count DESC"; |
| 6506 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6806 | + if ($limit) { |
|
| 6807 | + $query .= " LIMIT 10"; |
|
| 6808 | + } |
|
| 6507 | 6809 | |
| 6508 | 6810 | |
| 6509 | 6811 | $sth = $this->db->prepare($query); |
@@ -6523,7 +6825,9 @@ discard block |
||
| 6523 | 6825 | if ($icaoaskey) { |
| 6524 | 6826 | $icao = $row['arrival_airport_icao']; |
| 6525 | 6827 | $airport_array[$icao] = $temp_array; |
| 6526 | - } else $airport_array[] = $temp_array; |
|
| 6828 | + } else { |
|
| 6829 | + $airport_array[] = $temp_array; |
|
| 6830 | + } |
|
| 6527 | 6831 | } |
| 6528 | 6832 | |
| 6529 | 6833 | return $airport_array; |
@@ -6565,7 +6869,9 @@ discard block |
||
| 6565 | 6869 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6566 | 6870 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 6567 | 6871 | ORDER BY airport_arrival_icao_count DESC"; |
| 6568 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6872 | + if ($limit) { |
|
| 6873 | + $query .= " LIMIT 10"; |
|
| 6874 | + } |
|
| 6569 | 6875 | |
| 6570 | 6876 | |
| 6571 | 6877 | $sth = $this->db->prepare($query); |
@@ -6586,7 +6892,9 @@ discard block |
||
| 6586 | 6892 | if ($icaoaskey) { |
| 6587 | 6893 | $icao = $row['arrival_airport_icao']; |
| 6588 | 6894 | $airport_array[$icao] = $temp_array; |
| 6589 | - } else $airport_array[] = $temp_array; |
|
| 6895 | + } else { |
|
| 6896 | + $airport_array[] = $temp_array; |
|
| 6897 | + } |
|
| 6590 | 6898 | } |
| 6591 | 6899 | |
| 6592 | 6900 | return $airport_array; |
@@ -6967,7 +7275,9 @@ discard block |
||
| 6967 | 7275 | date_default_timezone_set($globalTimezone); |
| 6968 | 7276 | $datetime = new DateTime($date); |
| 6969 | 7277 | $offset = $datetime->format('P'); |
| 6970 | - } else $offset = '+00:00'; |
|
| 7278 | + } else { |
|
| 7279 | + $offset = '+00:00'; |
|
| 7280 | + } |
|
| 6971 | 7281 | |
| 6972 | 7282 | if ($globalDBdriver == 'mysql') { |
| 6973 | 7283 | $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 |
@@ -7017,7 +7327,9 @@ discard block |
||
| 7017 | 7327 | date_default_timezone_set($globalTimezone); |
| 7018 | 7328 | $datetime = new DateTime($date); |
| 7019 | 7329 | $offset = $datetime->format('P'); |
| 7020 | - } else $offset = '+00:00'; |
|
| 7330 | + } else { |
|
| 7331 | + $offset = '+00:00'; |
|
| 7332 | + } |
|
| 7021 | 7333 | |
| 7022 | 7334 | if ($globalDBdriver == 'mysql') { |
| 7023 | 7335 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -7240,7 +7552,9 @@ discard block |
||
| 7240 | 7552 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
| 7241 | 7553 | $query .= " GROUP BY spotter_output.arrival_airport_country |
| 7242 | 7554 | ORDER BY airport_arrival_country_count DESC"; |
| 7243 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7555 | + if ($limit) { |
|
| 7556 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7557 | + } |
|
| 7244 | 7558 | |
| 7245 | 7559 | |
| 7246 | 7560 | $sth = $this->db->prepare($query); |
@@ -7527,7 +7841,9 @@ discard block |
||
| 7527 | 7841 | date_default_timezone_set($globalTimezone); |
| 7528 | 7842 | $datetime = new DateTime($date); |
| 7529 | 7843 | $offset = $datetime->format('P'); |
| 7530 | - } else $offset = '+00:00'; |
|
| 7844 | + } else { |
|
| 7845 | + $offset = '+00:00'; |
|
| 7846 | + } |
|
| 7531 | 7847 | |
| 7532 | 7848 | if ($globalDBdriver == 'mysql') { |
| 7533 | 7849 | $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 |
@@ -7703,15 +8019,23 @@ discard block |
||
| 7703 | 8019 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 7704 | 8020 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
| 7705 | 8021 | if ($olderthanmonths > 0) { |
| 7706 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 7707 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 8022 | + if ($globalDBdriver == 'mysql') { |
|
| 8023 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 8024 | + } else { |
|
| 8025 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 8026 | + } |
|
| 7708 | 8027 | } |
| 7709 | 8028 | if ($sincedate != '') { |
| 7710 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 7711 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 8029 | + if ($globalDBdriver == 'mysql') { |
|
| 8030 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 8031 | + } else { |
|
| 8032 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 8033 | + } |
|
| 7712 | 8034 | } |
| 7713 | 8035 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 7714 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8036 | + if ($limit) { |
|
| 8037 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8038 | + } |
|
| 7715 | 8039 | |
| 7716 | 8040 | $sth = $this->db->prepare($query); |
| 7717 | 8041 | $sth->execute(); |
@@ -7745,15 +8069,23 @@ discard block |
||
| 7745 | 8069 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 7746 | 8070 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 7747 | 8071 | if ($olderthanmonths > 0) { |
| 7748 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7749 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 8072 | + if ($globalDBdriver == 'mysql') { |
|
| 8073 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 8074 | + } else { |
|
| 8075 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 8076 | + } |
|
| 7750 | 8077 | } |
| 7751 | 8078 | if ($sincedate != '') { |
| 7752 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 7753 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 8079 | + if ($globalDBdriver == 'mysql') { |
|
| 8080 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 8081 | + } else { |
|
| 8082 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 8083 | + } |
|
| 7754 | 8084 | } |
| 7755 | 8085 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 7756 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8086 | + if ($limit) { |
|
| 8087 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8088 | + } |
|
| 7757 | 8089 | |
| 7758 | 8090 | $sth = $this->db->prepare($query); |
| 7759 | 8091 | $sth->execute(); |
@@ -7790,7 +8122,9 @@ discard block |
||
| 7790 | 8122 | date_default_timezone_set($globalTimezone); |
| 7791 | 8123 | $datetime = new DateTime(); |
| 7792 | 8124 | $offset = $datetime->format('P'); |
| 7793 | - } else $offset = '+00:00'; |
|
| 8125 | + } else { |
|
| 8126 | + $offset = '+00:00'; |
|
| 8127 | + } |
|
| 7794 | 8128 | |
| 7795 | 8129 | if ($globalDBdriver == 'mysql') { |
| 7796 | 8130 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7839,7 +8173,9 @@ discard block |
||
| 7839 | 8173 | date_default_timezone_set($globalTimezone); |
| 7840 | 8174 | $datetime = new DateTime(); |
| 7841 | 8175 | $offset = $datetime->format('P'); |
| 7842 | - } else $offset = '+00:00'; |
|
| 8176 | + } else { |
|
| 8177 | + $offset = '+00:00'; |
|
| 8178 | + } |
|
| 7843 | 8179 | $filter_query = $this->getFilter($filters,true,true); |
| 7844 | 8180 | if ($globalDBdriver == 'mysql') { |
| 7845 | 8181 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7888,7 +8224,9 @@ discard block |
||
| 7888 | 8224 | date_default_timezone_set($globalTimezone); |
| 7889 | 8225 | $datetime = new DateTime(); |
| 7890 | 8226 | $offset = $datetime->format('P'); |
| 7891 | - } else $offset = '+00:00'; |
|
| 8227 | + } else { |
|
| 8228 | + $offset = '+00:00'; |
|
| 8229 | + } |
|
| 7892 | 8230 | $filter_query = $this->getFilter($filters,true,true); |
| 7893 | 8231 | if ($globalDBdriver == 'mysql') { |
| 7894 | 8232 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7934,7 +8272,9 @@ discard block |
||
| 7934 | 8272 | date_default_timezone_set($globalTimezone); |
| 7935 | 8273 | $datetime = new DateTime(); |
| 7936 | 8274 | $offset = $datetime->format('P'); |
| 7937 | - } else $offset = '+00:00'; |
|
| 8275 | + } else { |
|
| 8276 | + $offset = '+00:00'; |
|
| 8277 | + } |
|
| 7938 | 8278 | $filter_query = $this->getFilter($filters,true,true); |
| 7939 | 8279 | if ($globalDBdriver == 'mysql') { |
| 7940 | 8280 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7982,7 +8322,9 @@ discard block |
||
| 7982 | 8322 | date_default_timezone_set($globalTimezone); |
| 7983 | 8323 | $datetime = new DateTime(); |
| 7984 | 8324 | $offset = $datetime->format('P'); |
| 7985 | - } else $offset = '+00:00'; |
|
| 8325 | + } else { |
|
| 8326 | + $offset = '+00:00'; |
|
| 8327 | + } |
|
| 7986 | 8328 | |
| 7987 | 8329 | if ($globalDBdriver == 'mysql') { |
| 7988 | 8330 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8030,7 +8372,9 @@ discard block |
||
| 8030 | 8372 | date_default_timezone_set($globalTimezone); |
| 8031 | 8373 | $datetime = new DateTime(); |
| 8032 | 8374 | $offset = $datetime->format('P'); |
| 8033 | - } else $offset = '+00:00'; |
|
| 8375 | + } else { |
|
| 8376 | + $offset = '+00:00'; |
|
| 8377 | + } |
|
| 8034 | 8378 | |
| 8035 | 8379 | if ($globalDBdriver == 'mysql') { |
| 8036 | 8380 | $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 |
@@ -8077,7 +8421,9 @@ discard block |
||
| 8077 | 8421 | date_default_timezone_set($globalTimezone); |
| 8078 | 8422 | $datetime = new DateTime(); |
| 8079 | 8423 | $offset = $datetime->format('P'); |
| 8080 | - } else $offset = '+00:00'; |
|
| 8424 | + } else { |
|
| 8425 | + $offset = '+00:00'; |
|
| 8426 | + } |
|
| 8081 | 8427 | |
| 8082 | 8428 | if ($globalDBdriver == 'mysql') { |
| 8083 | 8429 | $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 |
@@ -8125,7 +8471,9 @@ discard block |
||
| 8125 | 8471 | date_default_timezone_set($globalTimezone); |
| 8126 | 8472 | $datetime = new DateTime(); |
| 8127 | 8473 | $offset = $datetime->format('P'); |
| 8128 | - } else $offset = '+00:00'; |
|
| 8474 | + } else { |
|
| 8475 | + $offset = '+00:00'; |
|
| 8476 | + } |
|
| 8129 | 8477 | $filter_query = $this->getFilter($filters,true,true); |
| 8130 | 8478 | if ($globalDBdriver == 'mysql') { |
| 8131 | 8479 | $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 |
@@ -8170,7 +8518,9 @@ discard block |
||
| 8170 | 8518 | date_default_timezone_set($globalTimezone); |
| 8171 | 8519 | $datetime = new DateTime(); |
| 8172 | 8520 | $offset = $datetime->format('P'); |
| 8173 | - } else $offset = '+00:00'; |
|
| 8521 | + } else { |
|
| 8522 | + $offset = '+00:00'; |
|
| 8523 | + } |
|
| 8174 | 8524 | $filter_query = $this->getFilter($filters,true,true); |
| 8175 | 8525 | |
| 8176 | 8526 | if ($globalDBdriver == 'mysql') { |
@@ -8217,7 +8567,9 @@ discard block |
||
| 8217 | 8567 | date_default_timezone_set($globalTimezone); |
| 8218 | 8568 | $datetime = new DateTime(); |
| 8219 | 8569 | $offset = $datetime->format('P'); |
| 8220 | - } else $offset = '+00:00'; |
|
| 8570 | + } else { |
|
| 8571 | + $offset = '+00:00'; |
|
| 8572 | + } |
|
| 8221 | 8573 | |
| 8222 | 8574 | if ($globalDBdriver == 'mysql') { |
| 8223 | 8575 | $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 |
@@ -8263,7 +8615,9 @@ discard block |
||
| 8263 | 8615 | date_default_timezone_set($globalTimezone); |
| 8264 | 8616 | $datetime = new DateTime(); |
| 8265 | 8617 | $offset = $datetime->format('P'); |
| 8266 | - } else $offset = '+00:00'; |
|
| 8618 | + } else { |
|
| 8619 | + $offset = '+00:00'; |
|
| 8620 | + } |
|
| 8267 | 8621 | $filter_query = $this->getFilter($filters,true,true); |
| 8268 | 8622 | |
| 8269 | 8623 | if ($globalDBdriver == 'mysql') { |
@@ -8310,7 +8664,9 @@ discard block |
||
| 8310 | 8664 | date_default_timezone_set($globalTimezone); |
| 8311 | 8665 | $datetime = new DateTime(); |
| 8312 | 8666 | $offset = $datetime->format('P'); |
| 8313 | - } else $offset = '+00:00'; |
|
| 8667 | + } else { |
|
| 8668 | + $offset = '+00:00'; |
|
| 8669 | + } |
|
| 8314 | 8670 | |
| 8315 | 8671 | if ($globalDBdriver == 'mysql') { |
| 8316 | 8672 | $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 |
@@ -8357,7 +8713,9 @@ discard block |
||
| 8357 | 8713 | date_default_timezone_set($globalTimezone); |
| 8358 | 8714 | $datetime = new DateTime(); |
| 8359 | 8715 | $offset = $datetime->format('P'); |
| 8360 | - } else $offset = '+00:00'; |
|
| 8716 | + } else { |
|
| 8717 | + $offset = '+00:00'; |
|
| 8718 | + } |
|
| 8361 | 8719 | |
| 8362 | 8720 | if ($globalDBdriver == 'mysql') { |
| 8363 | 8721 | $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 |
@@ -8402,7 +8760,9 @@ discard block |
||
| 8402 | 8760 | date_default_timezone_set($globalTimezone); |
| 8403 | 8761 | $datetime = new DateTime(); |
| 8404 | 8762 | $offset = $datetime->format('P'); |
| 8405 | - } else $offset = '+00:00'; |
|
| 8763 | + } else { |
|
| 8764 | + $offset = '+00:00'; |
|
| 8765 | + } |
|
| 8406 | 8766 | $filter_query = $this->getFilter($filters,true,true); |
| 8407 | 8767 | |
| 8408 | 8768 | if ($globalDBdriver == 'mysql') { |
@@ -8450,7 +8810,9 @@ discard block |
||
| 8450 | 8810 | date_default_timezone_set($globalTimezone); |
| 8451 | 8811 | $datetime = new DateTime(); |
| 8452 | 8812 | $offset = $datetime->format('P'); |
| 8453 | - } else $offset = '+00:00'; |
|
| 8813 | + } else { |
|
| 8814 | + $offset = '+00:00'; |
|
| 8815 | + } |
|
| 8454 | 8816 | |
| 8455 | 8817 | if ($globalDBdriver == 'mysql') { |
| 8456 | 8818 | $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 |
@@ -8496,7 +8858,9 @@ discard block |
||
| 8496 | 8858 | date_default_timezone_set($globalTimezone); |
| 8497 | 8859 | $datetime = new DateTime(); |
| 8498 | 8860 | $offset = $datetime->format('P'); |
| 8499 | - } else $offset = '+00:00'; |
|
| 8861 | + } else { |
|
| 8862 | + $offset = '+00:00'; |
|
| 8863 | + } |
|
| 8500 | 8864 | $filter_query = $this->getFilter($filters,true,true); |
| 8501 | 8865 | |
| 8502 | 8866 | if ($globalDBdriver == 'mysql') { |
@@ -8544,7 +8908,9 @@ discard block |
||
| 8544 | 8908 | date_default_timezone_set($globalTimezone); |
| 8545 | 8909 | $datetime = new DateTime(); |
| 8546 | 8910 | $offset = $datetime->format('P'); |
| 8547 | - } else $offset = '+00:00'; |
|
| 8911 | + } else { |
|
| 8912 | + $offset = '+00:00'; |
|
| 8913 | + } |
|
| 8548 | 8914 | |
| 8549 | 8915 | if ($globalDBdriver == 'mysql') { |
| 8550 | 8916 | $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 |
@@ -8591,7 +8957,9 @@ discard block |
||
| 8591 | 8957 | date_default_timezone_set($globalTimezone); |
| 8592 | 8958 | $datetime = new DateTime(); |
| 8593 | 8959 | $offset = $datetime->format('P'); |
| 8594 | - } else $offset = '+00:00'; |
|
| 8960 | + } else { |
|
| 8961 | + $offset = '+00:00'; |
|
| 8962 | + } |
|
| 8595 | 8963 | $filter_query = $this->getFilter($filters,true,true); |
| 8596 | 8964 | if ($globalDBdriver == 'mysql') { |
| 8597 | 8965 | $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 |
@@ -8640,7 +9008,9 @@ discard block |
||
| 8640 | 9008 | date_default_timezone_set($globalTimezone); |
| 8641 | 9009 | $datetime = new DateTime(); |
| 8642 | 9010 | $offset = $datetime->format('P'); |
| 8643 | - } else $offset = '+00:00'; |
|
| 9011 | + } else { |
|
| 9012 | + $offset = '+00:00'; |
|
| 9013 | + } |
|
| 8644 | 9014 | |
| 8645 | 9015 | $orderby_sql = ''; |
| 8646 | 9016 | if ($orderby == "hour") |
@@ -8706,7 +9076,9 @@ discard block |
||
| 8706 | 9076 | date_default_timezone_set($globalTimezone); |
| 8707 | 9077 | $datetime = new DateTime(); |
| 8708 | 9078 | $offset = $datetime->format('P'); |
| 8709 | - } else $offset = '+00:00'; |
|
| 9079 | + } else { |
|
| 9080 | + $offset = '+00:00'; |
|
| 9081 | + } |
|
| 8710 | 9082 | |
| 8711 | 9083 | $orderby_sql = ''; |
| 8712 | 9084 | if ($orderby == "hour") |
@@ -8773,7 +9145,9 @@ discard block |
||
| 8773 | 9145 | date_default_timezone_set($globalTimezone); |
| 8774 | 9146 | $datetime = new DateTime(); |
| 8775 | 9147 | $offset = $datetime->format('P'); |
| 8776 | - } else $offset = '+00:00'; |
|
| 9148 | + } else { |
|
| 9149 | + $offset = '+00:00'; |
|
| 9150 | + } |
|
| 8777 | 9151 | |
| 8778 | 9152 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 8779 | 9153 | |
@@ -8824,7 +9198,9 @@ discard block |
||
| 8824 | 9198 | date_default_timezone_set($globalTimezone); |
| 8825 | 9199 | $datetime = new DateTime(); |
| 8826 | 9200 | $offset = $datetime->format('P'); |
| 8827 | - } else $offset = '+00:00'; |
|
| 9201 | + } else { |
|
| 9202 | + $offset = '+00:00'; |
|
| 9203 | + } |
|
| 8828 | 9204 | |
| 8829 | 9205 | if ($globalDBdriver == 'mysql') { |
| 8830 | 9206 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8871,7 +9247,9 @@ discard block |
||
| 8871 | 9247 | date_default_timezone_set($globalTimezone); |
| 8872 | 9248 | $datetime = new DateTime(); |
| 8873 | 9249 | $offset = $datetime->format('P'); |
| 8874 | - } else $offset = '+00:00'; |
|
| 9250 | + } else { |
|
| 9251 | + $offset = '+00:00'; |
|
| 9252 | + } |
|
| 8875 | 9253 | |
| 8876 | 9254 | if ($globalDBdriver == 'mysql') { |
| 8877 | 9255 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8918,7 +9296,9 @@ discard block |
||
| 8918 | 9296 | date_default_timezone_set($globalTimezone); |
| 8919 | 9297 | $datetime = new DateTime(); |
| 8920 | 9298 | $offset = $datetime->format('P'); |
| 8921 | - } else $offset = '+00:00'; |
|
| 9299 | + } else { |
|
| 9300 | + $offset = '+00:00'; |
|
| 9301 | + } |
|
| 8922 | 9302 | |
| 8923 | 9303 | if ($globalDBdriver == 'mysql') { |
| 8924 | 9304 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8966,7 +9346,9 @@ discard block |
||
| 8966 | 9346 | date_default_timezone_set($globalTimezone); |
| 8967 | 9347 | $datetime = new DateTime(); |
| 8968 | 9348 | $offset = $datetime->format('P'); |
| 8969 | - } else $offset = '+00:00'; |
|
| 9349 | + } else { |
|
| 9350 | + $offset = '+00:00'; |
|
| 9351 | + } |
|
| 8970 | 9352 | |
| 8971 | 9353 | if ($globalDBdriver == 'mysql') { |
| 8972 | 9354 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9014,7 +9396,9 @@ discard block |
||
| 9014 | 9396 | date_default_timezone_set($globalTimezone); |
| 9015 | 9397 | $datetime = new DateTime($date); |
| 9016 | 9398 | $offset = $datetime->format('P'); |
| 9017 | - } else $offset = '+00:00'; |
|
| 9399 | + } else { |
|
| 9400 | + $offset = '+00:00'; |
|
| 9401 | + } |
|
| 9018 | 9402 | |
| 9019 | 9403 | if ($globalDBdriver == 'mysql') { |
| 9020 | 9404 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9062,7 +9446,9 @@ discard block |
||
| 9062 | 9446 | date_default_timezone_set($globalTimezone); |
| 9063 | 9447 | $datetime = new DateTime(); |
| 9064 | 9448 | $offset = $datetime->format('P'); |
| 9065 | - } else $offset = '+00:00'; |
|
| 9449 | + } else { |
|
| 9450 | + $offset = '+00:00'; |
|
| 9451 | + } |
|
| 9066 | 9452 | |
| 9067 | 9453 | if ($globalDBdriver == 'mysql') { |
| 9068 | 9454 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9112,7 +9498,9 @@ discard block |
||
| 9112 | 9498 | date_default_timezone_set($globalTimezone); |
| 9113 | 9499 | $datetime = new DateTime(); |
| 9114 | 9500 | $offset = $datetime->format('P'); |
| 9115 | - } else $offset = '+00:00'; |
|
| 9501 | + } else { |
|
| 9502 | + $offset = '+00:00'; |
|
| 9503 | + } |
|
| 9116 | 9504 | |
| 9117 | 9505 | if ($globalDBdriver == 'mysql') { |
| 9118 | 9506 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9159,7 +9547,9 @@ discard block |
||
| 9159 | 9547 | date_default_timezone_set($globalTimezone); |
| 9160 | 9548 | $datetime = new DateTime(); |
| 9161 | 9549 | $offset = $datetime->format('P'); |
| 9162 | - } else $offset = '+00:00'; |
|
| 9550 | + } else { |
|
| 9551 | + $offset = '+00:00'; |
|
| 9552 | + } |
|
| 9163 | 9553 | |
| 9164 | 9554 | if ($globalDBdriver == 'mysql') { |
| 9165 | 9555 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9327,7 +9717,9 @@ discard block |
||
| 9327 | 9717 | date_default_timezone_set($globalTimezone); |
| 9328 | 9718 | $datetime = new DateTime(); |
| 9329 | 9719 | $offset = $datetime->format('P'); |
| 9330 | - } else $offset = '+00:00'; |
|
| 9720 | + } else { |
|
| 9721 | + $offset = '+00:00'; |
|
| 9722 | + } |
|
| 9331 | 9723 | |
| 9332 | 9724 | if ($globalDBdriver == 'mysql') { |
| 9333 | 9725 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9513,7 +9905,9 @@ discard block |
||
| 9513 | 9905 | */ |
| 9514 | 9906 | public function parseDirection($direction = 0) |
| 9515 | 9907 | { |
| 9516 | - if ($direction == '') $direction = 0; |
|
| 9908 | + if ($direction == '') { |
|
| 9909 | + $direction = 0; |
|
| 9910 | + } |
|
| 9517 | 9911 | $direction_array = array(); |
| 9518 | 9912 | $temp_array = array(); |
| 9519 | 9913 | |
@@ -9614,7 +10008,9 @@ discard block |
||
| 9614 | 10008 | if (isset($result->AirlineFlightInfoResult)) |
| 9615 | 10009 | { |
| 9616 | 10010 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 9617 | - } else return ''; |
|
| 10011 | + } else { |
|
| 10012 | + return ''; |
|
| 10013 | + } |
|
| 9618 | 10014 | |
| 9619 | 10015 | $registration = $this->convertAircraftRegistration($registration); |
| 9620 | 10016 | |
@@ -9643,7 +10039,9 @@ discard block |
||
| 9643 | 10039 | if (count($row) > 0) { |
| 9644 | 10040 | //return $row['Registration']; |
| 9645 | 10041 | return $row['registration']; |
| 9646 | - } else return ''; |
|
| 10042 | + } else { |
|
| 10043 | + return ''; |
|
| 10044 | + } |
|
| 9647 | 10045 | |
| 9648 | 10046 | } |
| 9649 | 10047 | |
@@ -9666,9 +10064,14 @@ discard block |
||
| 9666 | 10064 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 9667 | 10065 | $sth->closeCursor(); |
| 9668 | 10066 | if (count($row) > 0) { |
| 9669 | - if ($row['type_flight'] == null) return ''; |
|
| 9670 | - else return $row['type_flight']; |
|
| 9671 | - } else return ''; |
|
| 10067 | + if ($row['type_flight'] == null) { |
|
| 10068 | + return ''; |
|
| 10069 | + } else { |
|
| 10070 | + return $row['type_flight']; |
|
| 10071 | + } |
|
| 10072 | + } else { |
|
| 10073 | + return ''; |
|
| 10074 | + } |
|
| 9672 | 10075 | |
| 9673 | 10076 | } |
| 9674 | 10077 | |
@@ -9686,7 +10089,9 @@ discard block |
||
| 9686 | 10089 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 9687 | 10090 | |
| 9688 | 10091 | $Connection = new Connection($this->db); |
| 9689 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 10092 | + if (!$Connection->tableExists('countries')) { |
|
| 10093 | + return ''; |
|
| 10094 | + } |
|
| 9690 | 10095 | |
| 9691 | 10096 | try { |
| 9692 | 10097 | /* |
@@ -9706,9 +10111,13 @@ discard block |
||
| 9706 | 10111 | $sth->closeCursor(); |
| 9707 | 10112 | if (count($row) > 0) { |
| 9708 | 10113 | return $row; |
| 9709 | - } else return ''; |
|
| 10114 | + } else { |
|
| 10115 | + return ''; |
|
| 10116 | + } |
|
| 9710 | 10117 | } catch (PDOException $e) { |
| 9711 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 10118 | + if (isset($globalDebug) && $globalDebug) { |
|
| 10119 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 10120 | + } |
|
| 9712 | 10121 | return ''; |
| 9713 | 10122 | } |
| 9714 | 10123 | |
@@ -9856,7 +10265,9 @@ discard block |
||
| 9856 | 10265 | { |
| 9857 | 10266 | global $globalBitlyAccessToken; |
| 9858 | 10267 | |
| 9859 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 10268 | + if ($globalBitlyAccessToken == '') { |
|
| 10269 | + return $url; |
|
| 10270 | + } |
|
| 9860 | 10271 | |
| 9861 | 10272 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 9862 | 10273 | |
@@ -10005,7 +10416,9 @@ discard block |
||
| 10005 | 10416 | |
| 10006 | 10417 | |
| 10007 | 10418 | // routes |
| 10008 | - if ($globalDebug) print "Routes...\n"; |
|
| 10419 | + if ($globalDebug) { |
|
| 10420 | + print "Routes...\n"; |
|
| 10421 | + } |
|
| 10009 | 10422 | if ($globalDBdriver == 'mysql') { |
| 10010 | 10423 | $query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
| 10011 | 10424 | } else { |
@@ -10024,7 +10437,9 @@ discard block |
||
| 10024 | 10437 | } |
| 10025 | 10438 | } |
| 10026 | 10439 | |
| 10027 | - if ($globalDebug) print "Airlines...\n"; |
|
| 10440 | + if ($globalDebug) { |
|
| 10441 | + print "Airlines...\n"; |
|
| 10442 | + } |
|
| 10028 | 10443 | //airlines |
| 10029 | 10444 | if ($globalDBdriver == 'mysql') { |
| 10030 | 10445 | $query = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
@@ -10038,10 +10453,15 @@ discard block |
||
| 10038 | 10453 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 10039 | 10454 | { |
| 10040 | 10455 | $fromsource = NULL; |
| 10041 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 10042 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 10043 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 10044 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 10456 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 10457 | + $fromsource = 'vatsim'; |
|
| 10458 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 10459 | + $fromsource = 'ivao'; |
|
| 10460 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 10461 | + $fromsource = 'vatsim'; |
|
| 10462 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 10463 | + $fromsource = 'ivao'; |
|
| 10464 | + } |
|
| 10045 | 10465 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 10046 | 10466 | if (isset($airline_array[0]['name'])) { |
| 10047 | 10467 | $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"; |
@@ -10051,13 +10471,17 @@ discard block |
||
| 10051 | 10471 | } |
| 10052 | 10472 | } |
| 10053 | 10473 | |
| 10054 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 10474 | + if ($globalDebug) { |
|
| 10475 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 10476 | + } |
|
| 10055 | 10477 | //duplicate modes |
| 10056 | 10478 | $query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL"; |
| 10057 | 10479 | $sth = $this->db->prepare($query); |
| 10058 | 10480 | $sth->execute(); |
| 10059 | 10481 | |
| 10060 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 10482 | + if ($globalDebug) { |
|
| 10483 | + print "Aircraft...\n"; |
|
| 10484 | + } |
|
| 10061 | 10485 | //aircraft |
| 10062 | 10486 | if ($globalDBdriver == 'mysql') { |
| 10063 | 10487 | $query = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -10100,26 +10524,38 @@ discard block |
||
| 10100 | 10524 | if (isset($closestAirports[0])) { |
| 10101 | 10525 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 10102 | 10526 | $airport_icao = $closestAirports[0]['icao']; |
| 10103 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10527 | + if ($globalDebug) { |
|
| 10528 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10529 | + } |
|
| 10104 | 10530 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 10105 | 10531 | foreach ($closestAirports as $airport) { |
| 10106 | 10532 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 10107 | 10533 | $airport_icao = $airport['icao']; |
| 10108 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10534 | + if ($globalDebug) { |
|
| 10535 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10536 | + } |
|
| 10109 | 10537 | break; |
| 10110 | 10538 | } |
| 10111 | 10539 | } |
| 10112 | 10540 | } 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 | 10541 | $airport_icao = $closestAirports[0]['icao']; |
| 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"; |
|
| 10542 | + if ($globalDebug) { |
|
| 10543 | + 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"; |
|
| 10544 | + } |
|
| 10115 | 10545 | } else { |
| 10116 | - if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 10546 | + if ($globalDebug) { |
|
| 10547 | + echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 10548 | + } |
|
| 10117 | 10549 | } |
| 10118 | 10550 | } else { |
| 10119 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 10551 | + if ($globalDebug) { |
|
| 10552 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 10553 | + } |
|
| 10120 | 10554 | } |
| 10121 | 10555 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 10122 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 10556 | + if ($globalDebug) { |
|
| 10557 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 10558 | + } |
|
| 10123 | 10559 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 10124 | 10560 | $sthu = $this->db->prepare($update_query); |
| 10125 | 10561 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |