@@ -105,8 +105,11 @@ |
||
| 105 | 105 | } elseif (isset($_GET['satellite'])) { |
| 106 | 106 | readfile(dirname(__FILE__).'/images/satellites/'.$filename); |
| 107 | 107 | } else { |
| 108 | - if ($color == 'FF0000') readfile(dirname(__FILE__).'/images/aircrafts/selected/'.$filename); |
|
| 109 | - else readfile(dirname(__FILE__).'/images/aircrafts/'.$filename); |
|
| 108 | + if ($color == 'FF0000') { |
|
| 109 | + readfile(dirname(__FILE__).'/images/aircrafts/selected/'.$filename); |
|
| 110 | + } else { |
|
| 111 | + readfile(dirname(__FILE__).'/images/aircrafts/'.$filename); |
|
| 112 | + } |
|
| 110 | 113 | } |
| 111 | 114 | } |
| 112 | 115 | ?> |
| 113 | 116 | \ No newline at end of file |
@@ -42,7 +42,9 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function checkAll() { |
| 44 | 44 | global $globalDebug; |
| 45 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
| 45 | + if ($globalDebug) { |
|
| 46 | + echo "Update last seen tracked data...\n"; |
|
| 47 | + } |
|
| 46 | 48 | foreach ($this->all_tracked as $key => $flight) { |
| 47 | 49 | if (isset($this->all_tracked[$key]['id'])) { |
| 48 | 50 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
@@ -55,12 +57,16 @@ discard block |
||
| 55 | 57 | public function del() { |
| 56 | 58 | global $globalDebug; |
| 57 | 59 | // Delete old infos |
| 58 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
| 60 | + if ($globalDebug) { |
|
| 61 | + echo 'Delete old values and update latest data...'."\n"; |
|
| 62 | + } |
|
| 59 | 63 | foreach ($this->all_tracked as $key => $flight) { |
| 60 | 64 | if (isset($flight['lastupdate'])) { |
| 61 | 65 | if ($flight['lastupdate'] < (time()-3000)) { |
| 62 | 66 | if (isset($this->all_tracked[$key]['id'])) { |
| 63 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 67 | + if ($globalDebug) { |
|
| 68 | + echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 69 | + } |
|
| 64 | 70 | /* |
| 65 | 71 | $TrackerLive = new TrackerLive(); |
| 66 | 72 | $TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); |
@@ -70,7 +76,9 @@ discard block |
||
| 70 | 76 | $Tracker = new Tracker($this->db); |
| 71 | 77 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
| 72 | 78 | $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
| 73 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 79 | + if ($globalDebug && $result != 'success') { |
|
| 80 | + echo '!!! ERROR : '.$result."\n"; |
|
| 81 | + } |
|
| 74 | 82 | } |
| 75 | 83 | // Put in archive |
| 76 | 84 | // $Tracker->db = null; |
@@ -83,7 +91,9 @@ discard block |
||
| 83 | 91 | |
| 84 | 92 | public function add($line) { |
| 85 | 93 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; |
| 86 | - if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChangeTracker = '0.015'; |
|
| 94 | + if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') { |
|
| 95 | + $globalCoordMinChangeTracker = '0.015'; |
|
| 96 | + } |
|
| 87 | 97 | date_default_timezone_set('UTC'); |
| 88 | 98 | $dataFound = false; |
| 89 | 99 | $send = false; |
@@ -97,19 +107,29 @@ discard block |
||
| 97 | 107 | // Increment message number |
| 98 | 108 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 99 | 109 | $current_date = date('Y-m-d'); |
| 100 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 101 | - else $source = ''; |
|
| 102 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 110 | + if (isset($line['source_name'])) { |
|
| 111 | + $source = $line['source_name']; |
|
| 112 | + } else { |
|
| 113 | + $source = ''; |
|
| 114 | + } |
|
| 115 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
| 116 | + $source = $line['format_source']; |
|
| 117 | + } |
|
| 103 | 118 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
| 104 | 119 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
| 105 | 120 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
| 106 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 121 | + } else { |
|
| 122 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 123 | + } |
|
| 107 | 124 | } |
| 108 | 125 | |
| 109 | 126 | |
| 110 | 127 | $Common = new Common(); |
| 111 | - if (!isset($line['id'])) $id = trim($line['ident']); |
|
| 112 | - else $id = trim($line['id']); |
|
| 128 | + if (!isset($line['id'])) { |
|
| 129 | + $id = trim($line['ident']); |
|
| 130 | + } else { |
|
| 131 | + $id = trim($line['id']); |
|
| 132 | + } |
|
| 113 | 133 | |
| 114 | 134 | if (!isset($this->all_tracked[$id])) { |
| 115 | 135 | $this->all_tracked[$id] = array(); |
@@ -117,31 +137,46 @@ discard block |
||
| 117 | 137 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
| 118 | 138 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
| 119 | 139 | if (!isset($line['id'])) { |
| 120 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 140 | + if (!isset($globalDaemon)) { |
|
| 141 | + $globalDaemon = TRUE; |
|
| 142 | + } |
|
| 121 | 143 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 122 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 123 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 144 | + } else { |
|
| 145 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 146 | + } |
|
| 147 | + if ($globalAllTracked !== FALSE) { |
|
| 148 | + $dataFound = true; |
|
| 149 | + } |
|
| 124 | 150 | } |
| 125 | 151 | |
| 126 | 152 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
| 127 | 153 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
| 128 | 154 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
| 129 | 155 | } else { |
| 130 | - if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
| 131 | - elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
| 156 | + if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
| 157 | + echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
| 158 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
| 159 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
| 160 | + } |
|
| 132 | 161 | return ''; |
| 133 | 162 | } |
| 134 | 163 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
| 135 | - if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
| 164 | + if ($globalDebug) { |
|
| 165 | + echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
| 166 | + } |
|
| 136 | 167 | return ''; |
| 137 | 168 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
| 138 | - if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
| 169 | + if ($globalDebug) { |
|
| 170 | + echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
| 171 | + } |
|
| 139 | 172 | return ''; |
| 140 | 173 | } elseif (!isset($line['datetime'])) { |
| 141 | 174 | date_default_timezone_set('UTC'); |
| 142 | 175 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
| 143 | 176 | } else { |
| 144 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
| 177 | + if ($globalDebug) { |
|
| 178 | + echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
| 179 | + } |
|
| 145 | 180 | return ''; |
| 146 | 181 | } |
| 147 | 182 | |
@@ -153,11 +188,17 @@ discard block |
||
| 153 | 188 | $Tracker = new Tracker($this->db); |
| 154 | 189 | $fromsource = NULL; |
| 155 | 190 | $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
| 156 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 191 | + if ($globalDebug && $result != 'success') { |
|
| 192 | + echo '!!! ERROR : '.$result."\n"; |
|
| 193 | + } |
|
| 157 | 194 | $Tracker->db = null; |
| 158 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 195 | + if ($globalDebugTimeElapsed) { |
|
| 196 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 197 | + } |
|
| 198 | + } |
|
| 199 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
| 200 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 159 | 201 | } |
| 160 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 161 | 202 | } |
| 162 | 203 | |
| 163 | 204 | if (isset($line['speed']) && $line['speed'] != '') { |
@@ -168,14 +209,21 @@ discard block |
||
| 168 | 209 | if ($distance > 100 && $distance < 10000) { |
| 169 | 210 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 170 | 211 | $speed = $speed*3.6; |
| 171 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
| 172 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
|
| 212 | + if ($speed < 1000) { |
|
| 213 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
| 214 | + } |
|
| 215 | + if ($globalDebug) { |
|
| 216 | + echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
|
| 217 | + } |
|
| 173 | 218 | } |
| 174 | 219 | } |
| 175 | 220 | |
| 176 | 221 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 178 | - else unset($timediff); |
|
| 222 | + if (isset($this->all_tracked[$id]['time_last_coord'])) { |
|
| 223 | + $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 224 | + } else { |
|
| 225 | + unset($timediff); |
|
| 226 | + } |
|
| 179 | 227 | if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
| 180 | 228 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
| 181 | 229 | if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
@@ -183,20 +231,30 @@ discard block |
||
| 183 | 231 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 184 | 232 | $this->all_tracked[$id]['putinarchive'] = true; |
| 185 | 233 | |
| 186 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 234 | + if ($globalDebug) { |
|
| 235 | + echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 236 | + } |
|
| 187 | 237 | $timeelapsed = microtime(true); |
| 188 | 238 | $Tracker = new Tracker($this->db); |
| 189 | 239 | $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
| 190 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 240 | + if (!empty($all_country)) { |
|
| 241 | + $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 242 | + } |
|
| 191 | 243 | $Tracker->db = null; |
| 192 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 244 | + if ($globalDebugTimeElapsed) { |
|
| 245 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 246 | + } |
|
| 193 | 247 | $this->tmd = 0; |
| 194 | - if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
| 248 | + if ($globalDebug) { |
|
| 249 | + echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
| 250 | + } |
|
| 195 | 251 | } |
| 196 | 252 | } |
| 197 | 253 | |
| 198 | 254 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 199 | - if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
| 255 | + if (!isset($this->all_tracked[$id]['archive_latitude'])) { |
|
| 256 | + $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
| 257 | + } |
|
| 200 | 258 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
| 201 | 259 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
| 202 | 260 | $dataFound = true; |
@@ -205,8 +263,12 @@ discard block |
||
| 205 | 263 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
| 206 | 264 | } |
| 207 | 265 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 208 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 209 | - if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
| 266 | + if ($line['longitude'] > 180) { |
|
| 267 | + $line['longitude'] = $line['longitude'] - 360; |
|
| 268 | + } |
|
| 269 | + if (!isset($this->all_tracked[$id]['archive_longitude'])) { |
|
| 270 | + $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
| 271 | + } |
|
| 210 | 272 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
| 211 | 273 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
| 212 | 274 | $dataFound = true; |
@@ -226,7 +288,9 @@ discard block |
||
| 226 | 288 | } |
| 227 | 289 | } |
| 228 | 290 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 229 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 291 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) { |
|
| 292 | + $dataFound = true; |
|
| 293 | + } |
|
| 230 | 294 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
| 231 | 295 | } |
| 232 | 296 | if (isset($line['format_source']) && $line['format_source'] != '') { |
@@ -246,7 +310,9 @@ discard block |
||
| 246 | 310 | |
| 247 | 311 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 248 | 312 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 249 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 313 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) { |
|
| 314 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
| 315 | + } |
|
| 250 | 316 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
| 251 | 317 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
| 252 | 318 | //$dataFound = true; |
@@ -258,15 +324,21 @@ discard block |
||
| 258 | 324 | } |
| 259 | 325 | |
| 260 | 326 | if (isset($line['heading']) && $line['heading'] != '') { |
| 261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 327 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) { |
|
| 328 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
| 329 | + } |
|
| 262 | 330 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
| 263 | 331 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
| 264 | 332 | //$dataFound = true; |
| 265 | 333 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
| 266 | 334 | $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
| 267 | 335 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
| 268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 269 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 336 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) { |
|
| 337 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
| 338 | + } |
|
| 339 | + if ($globalDebug) { |
|
| 340 | + echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 341 | + } |
|
| 270 | 342 | } |
| 271 | 343 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 272 | 344 | |
@@ -275,20 +347,31 @@ discard block |
||
| 275 | 347 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
| 276 | 348 | if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 277 | 349 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
| 278 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 350 | + if ($globalDebug) { |
|
| 351 | + echo "Check if aircraft is already in DB..."; |
|
| 352 | + } |
|
| 279 | 353 | $timeelapsed = microtime(true); |
| 280 | 354 | $TrackerLive = new TrackerLive($this->db); |
| 281 | 355 | if (isset($line['id'])) { |
| 282 | 356 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
| 283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 357 | + if ($globalDebugTimeElapsed) { |
|
| 358 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 359 | + } |
|
| 284 | 360 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
| 285 | 361 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
| 286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 287 | - } else $recent_ident = ''; |
|
| 362 | + if ($globalDebugTimeElapsed) { |
|
| 363 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 364 | + } |
|
| 365 | + } else { |
|
| 366 | + $recent_ident = ''; |
|
| 367 | + } |
|
| 288 | 368 | $TrackerLive->db=null; |
| 289 | 369 | |
| 290 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 291 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 370 | + if ($globalDebug && $recent_ident == '') { |
|
| 371 | + echo " Not in DB.\n"; |
|
| 372 | + } elseif ($globalDebug && $recent_ident != '') { |
|
| 373 | + echo " Already in DB.\n"; |
|
| 374 | + } |
|
| 292 | 375 | } else { |
| 293 | 376 | $recent_ident = ''; |
| 294 | 377 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
@@ -296,27 +379,41 @@ discard block |
||
| 296 | 379 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 297 | 380 | if($recent_ident == "") |
| 298 | 381 | { |
| 299 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
| 382 | + if ($globalDebug) { |
|
| 383 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
| 384 | + } |
|
| 300 | 385 | //adds the spotter data for the archive |
| 301 | 386 | $highlight = ''; |
| 302 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
| 387 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
| 388 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
| 389 | + } |
|
| 303 | 390 | $timeelapsed = microtime(true); |
| 304 | 391 | $Tracker = new Tracker($this->db); |
| 305 | 392 | $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
| 306 | 393 | $Tracker->db = null; |
| 307 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 394 | + if ($globalDebug && isset($result)) { |
|
| 395 | + echo $result."\n"; |
|
| 396 | + } |
|
| 397 | + if ($globalDebugTimeElapsed) { |
|
| 398 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 399 | + } |
|
| 309 | 400 | |
| 310 | 401 | |
| 311 | 402 | // Add source stat in DB |
| 312 | 403 | $Stats = new Stats($this->db); |
| 313 | 404 | if (!empty($this->stats)) { |
| 314 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 405 | + if ($globalDebug) { |
|
| 406 | + echo 'Add source stats : '; |
|
| 407 | + } |
|
| 315 | 408 | foreach($this->stats as $date => $data) { |
| 316 | 409 | foreach($data as $source => $sourced) { |
| 317 | 410 | //print_r($sourced); |
| 318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
| 319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
| 411 | + if (isset($sourced['polar'])) { |
|
| 412 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
| 413 | + } |
|
| 414 | + if (isset($sourced['hist'])) { |
|
| 415 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
| 416 | + } |
|
| 320 | 417 | if (isset($sourced['msg'])) { |
| 321 | 418 | if (time() - $sourced['msg']['date'] > 10) { |
| 322 | 419 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -329,7 +426,9 @@ discard block |
||
| 329 | 426 | unset($this->stats[$date]); |
| 330 | 427 | } |
| 331 | 428 | } |
| 332 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 429 | + if ($globalDebug) { |
|
| 430 | + echo 'Done'."\n"; |
|
| 431 | + } |
|
| 333 | 432 | |
| 334 | 433 | } |
| 335 | 434 | $Stats->db = null; |
@@ -339,12 +438,16 @@ discard block |
||
| 339 | 438 | $this->all_tracked[$id]['addedTracker'] = 1; |
| 340 | 439 | //print_r($this->all_tracked[$id]); |
| 341 | 440 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 342 | - if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
| 441 | + if ($globalDebug) { |
|
| 442 | + echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
| 443 | + } |
|
| 343 | 444 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
| 344 | 445 | $TrackerLive = new TrackerLive($this->db); |
| 345 | 446 | $TrackerLive->deleteLiveTrackerData(); |
| 346 | 447 | $TrackerLive->db=null; |
| 347 | - if ($globalDebug) echo " Done\n"; |
|
| 448 | + if ($globalDebug) { |
|
| 449 | + echo " Done\n"; |
|
| 450 | + } |
|
| 348 | 451 | $this->last_delete = time(); |
| 349 | 452 | } |
| 350 | 453 | } else { |
@@ -367,19 +470,25 @@ discard block |
||
| 367 | 470 | |
| 368 | 471 | if (!$ignoreImport) { |
| 369 | 472 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 370 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
| 473 | + if ($globalDebug) { |
|
| 474 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
| 475 | + } |
|
| 371 | 476 | $timeelapsed = microtime(true); |
| 372 | 477 | $TrackerLive = new TrackerLive($this->db); |
| 373 | 478 | $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
| 374 | 479 | $TrackerLive->db = null; |
| 375 | 480 | $this->all_tracked[$id]['putinarchive'] = false; |
| 376 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 481 | + if ($globalDebugTimeElapsed) { |
|
| 482 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 483 | + } |
|
| 377 | 484 | |
| 378 | 485 | // Put statistics in $this->stats variable |
| 379 | 486 | |
| 380 | 487 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
| 381 | 488 | $source = $this->all_tracked[$id]['source_name']; |
| 382 | - if ($source == '') $source = $this->all_tracked[$id]['format_source']; |
|
| 489 | + if ($source == '') { |
|
| 490 | + $source = $this->all_tracked[$id]['format_source']; |
|
| 491 | + } |
|
| 383 | 492 | if (!isset($this->source_location[$source])) { |
| 384 | 493 | $Location = new Source($this->db); |
| 385 | 494 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -400,7 +509,9 @@ discard block |
||
| 400 | 509 | $stats_heading = round($stats_heading/22.5); |
| 401 | 510 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
| 402 | 511 | $current_date = date('Y-m-d'); |
| 403 | - if ($stats_heading == 16) $stats_heading = 0; |
|
| 512 | + if ($stats_heading == 16) { |
|
| 513 | + $stats_heading = 0; |
|
| 514 | + } |
|
| 404 | 515 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 405 | 516 | for ($i=0;$i<=15;$i++) { |
| 406 | 517 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -418,7 +529,9 @@ discard block |
||
| 418 | 529 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 419 | 530 | end($this->stats[$current_date][$source]['hist']); |
| 420 | 531 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
| 421 | - } else $mini = 0; |
|
| 532 | + } else { |
|
| 533 | + $mini = 0; |
|
| 534 | + } |
|
| 422 | 535 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 423 | 536 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 424 | 537 | } |
@@ -429,19 +542,29 @@ discard block |
||
| 429 | 542 | } |
| 430 | 543 | |
| 431 | 544 | $this->all_tracked[$id]['lastupdate'] = time(); |
| 432 | - if ($this->all_tracked[$id]['putinarchive']) $send = true; |
|
| 433 | - if ($globalDebug) echo $result."\n"; |
|
| 434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 545 | + if ($this->all_tracked[$id]['putinarchive']) { |
|
| 546 | + $send = true; |
|
| 547 | + } |
|
| 548 | + if ($globalDebug) { |
|
| 549 | + echo $result."\n"; |
|
| 550 | + } |
|
| 551 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
| 552 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 553 | + } |
|
| 435 | 554 | //$this->del(); |
| 436 | 555 | |
| 437 | 556 | |
| 438 | 557 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 439 | - if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
| 558 | + if ($globalDebug) { |
|
| 559 | + echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
| 560 | + } |
|
| 440 | 561 | $TrackerLive = new TrackerLive($this->db); |
| 441 | 562 | $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
| 442 | 563 | $TrackerLive->db = null; |
| 443 | 564 | //TrackerLive->deleteLiveTrackerData(); |
| 444 | - if ($globalDebug) echo " Done\n"; |
|
| 565 | + if ($globalDebug) { |
|
| 566 | + echo " Done\n"; |
|
| 567 | + } |
|
| 445 | 568 | $this->last_delete_hourly = time(); |
| 446 | 569 | } |
| 447 | 570 | |
@@ -449,7 +572,9 @@ discard block |
||
| 449 | 572 | //$ignoreImport = false; |
| 450 | 573 | } |
| 451 | 574 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 452 | - if ($send) return $this->all_tracked[$id]; |
|
| 575 | + if ($send) { |
|
| 576 | + return $this->all_tracked[$id]; |
|
| 577 | + } |
|
| 453 | 578 | } |
| 454 | 579 | } |
| 455 | 580 | } |
@@ -8,7 +8,9 @@ discard block |
||
| 8 | 8 | public function __construct($dbc = null) { |
| 9 | 9 | $Connection = new Connection($dbc); |
| 10 | 10 | $this->db = $Connection->db(); |
| 11 | - if ($this->db === null) die('Error: No DB connection. (TrackerLive)'); |
|
| 11 | + if ($this->db === null) { |
|
| 12 | + die('Error: No DB connection. (TrackerLive)'); |
|
| 13 | + } |
|
| 12 | 14 | } |
| 13 | 15 | |
| 14 | 16 | |
@@ -30,7 +32,9 @@ discard block |
||
| 30 | 32 | if (isset($filter[0]['source'])) { |
| 31 | 33 | $filters = array_merge($filters,$filter); |
| 32 | 34 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 35 | + if (is_array($globalFilter)) { |
|
| 36 | + $filter = array_merge($filter,$globalFilter); |
|
| 37 | + } |
|
| 34 | 38 | $filter_query_join = ''; |
| 35 | 39 | $filter_query_where = ''; |
| 36 | 40 | foreach($filters as $flt) { |
@@ -77,8 +81,11 @@ discard block |
||
| 77 | 81 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 78 | 82 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 79 | 83 | } |
| 80 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 81 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 84 | + if ($filter_query_where == '' && $where) { |
|
| 85 | + $filter_query_where = ' WHERE'; |
|
| 86 | + } elseif ($filter_query_where != '' && $and) { |
|
| 87 | + $filter_query_where .= ' AND'; |
|
| 88 | + } |
|
| 82 | 89 | if ($filter_query_where != '') { |
| 83 | 90 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 84 | 91 | } |
@@ -120,7 +127,9 @@ discard block |
||
| 120 | 127 | } |
| 121 | 128 | } |
| 122 | 129 | |
| 123 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 130 | + if (!isset($globalLiveInterval)) { |
|
| 131 | + $globalLiveInterval = '200'; |
|
| 132 | + } |
|
| 124 | 133 | if ($globalDBdriver == 'mysql') { |
| 125 | 134 | //$query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate"; |
| 126 | 135 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -145,7 +154,9 @@ discard block |
||
| 145 | 154 | |
| 146 | 155 | $filter_query = $this->getFilter($filter,true,true); |
| 147 | 156 | |
| 148 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 157 | + if (!isset($globalLiveInterval)) { |
|
| 158 | + $globalLiveInterval = '200'; |
|
| 159 | + } |
|
| 149 | 160 | if ($globalDBdriver == 'mysql') { |
| 150 | 161 | $query = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
| 151 | 162 | FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0"; |
@@ -190,50 +201,74 @@ discard block |
||
| 190 | 201 | } |
| 191 | 202 | $filter_query = $this->getFilter($filter,true,true); |
| 192 | 203 | |
| 193 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 194 | - if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300'; |
|
| 204 | + if (!isset($globalLiveInterval)) { |
|
| 205 | + $globalLiveInterval = '200'; |
|
| 206 | + } |
|
| 207 | + if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') { |
|
| 208 | + $globalMap3DTrackersLimit = '300'; |
|
| 209 | + } |
|
| 195 | 210 | if ($globalDBdriver == 'mysql') { |
| 196 | 211 | if (isset($globalArchive) && $globalArchive) { |
| 197 | 212 | $query = "SELECT * FROM ( |
| 198 | 213 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
| 199 | 214 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
| 200 | - if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 215 | + if ($usecoord) { |
|
| 216 | + $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 217 | + } |
|
| 201 | 218 | $query .= "UNION |
| 202 | 219 | SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
| 203 | 220 | FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date "; |
| 204 | - if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 221 | + if ($usecoord) { |
|
| 222 | + $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 223 | + } |
|
| 205 | 224 | $query .= ") AS tracker |
| 206 | 225 | WHERE latitude <> '0' AND longitude <> '0' |
| 207 | 226 | ORDER BY famtrackid, date"; |
| 208 | - if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 227 | + if ($limit) { |
|
| 228 | + $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 229 | + } |
|
| 209 | 230 | } else { |
| 210 | 231 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
| 211 | 232 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date "; |
| 212 | - if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 233 | + if ($usecoord) { |
|
| 234 | + $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 235 | + } |
|
| 213 | 236 | $query .= "AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
| 214 | 237 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
| 215 | - if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 238 | + if ($limit) { |
|
| 239 | + $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 240 | + } |
|
| 216 | 241 | } |
| 217 | 242 | } else { |
| 218 | 243 | if (isset($globalArchive) && $globalArchive) { |
| 219 | 244 | $query = "SELECT * FROM ( |
| 220 | 245 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
| 221 | 246 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
| 222 | - if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 247 | + if ($usecoord) { |
|
| 248 | + $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 249 | + } |
|
| 223 | 250 | $query .= "UNION |
| 224 | 251 | SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
| 225 | 252 | FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date"; |
| 226 | - if ($usecoord) $query .= " AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 253 | + if ($usecoord) { |
|
| 254 | + $query .= " AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 255 | + } |
|
| 227 | 256 | $query .= ") AS tracker |
| 228 | 257 | WHERE latitude <> '0' AND longitude <> '0' |
| 229 | 258 | ORDER BY famtrackid, date"; |
| 230 | - if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 259 | + if ($limit) { |
|
| 260 | + $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 261 | + } |
|
| 231 | 262 | } else { |
| 232 | 263 | $query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
| 233 | 264 | FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' "; |
| 234 | - if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 265 | + if ($usecoord) { |
|
| 266 | + $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 267 | + } |
|
| 235 | 268 | $query .= "ORDER BY tracker_live.famtrackid, tracker_live.date"; |
| 236 | - if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 269 | + if ($limit) { |
|
| 270 | + $query .= " LIMIT ".$globalMap3DTrackersLimit; |
|
| 271 | + } |
|
| 237 | 272 | } |
| 238 | 273 | } |
| 239 | 274 | |
@@ -259,7 +294,9 @@ discard block |
||
| 259 | 294 | global $globalDBdriver, $globalLiveInterval; |
| 260 | 295 | $filter_query = $this->getFilter($filter,true,true); |
| 261 | 296 | |
| 262 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 297 | + if (!isset($globalLiveInterval)) { |
|
| 298 | + $globalLiveInterval = '200'; |
|
| 299 | + } |
|
| 263 | 300 | if ($globalDBdriver == 'mysql') { |
| 264 | 301 | $query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
| 265 | 302 | } else { |
@@ -287,7 +324,9 @@ discard block |
||
| 287 | 324 | { |
| 288 | 325 | global $globalDBdriver, $globalLiveInterval; |
| 289 | 326 | $Tracker = new Tracker($this->db); |
| 290 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 327 | + if (!isset($globalLiveInterval)) { |
|
| 328 | + $globalLiveInterval = '200'; |
|
| 329 | + } |
|
| 291 | 330 | $filter_query = $this->getFilter($filter); |
| 292 | 331 | |
| 293 | 332 | if (is_array($coord)) { |
@@ -295,7 +334,9 @@ discard block |
||
| 295 | 334 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 296 | 335 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 297 | 336 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 298 | - } else return array(); |
|
| 337 | + } else { |
|
| 338 | + return array(); |
|
| 339 | + } |
|
| 299 | 340 | if ($globalDBdriver == 'mysql') { |
| 300 | 341 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
| 301 | 342 | } else { |
@@ -315,7 +356,9 @@ discard block |
||
| 315 | 356 | { |
| 316 | 357 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 317 | 358 | $Tracker = new Tracker($this->db); |
| 318 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 359 | + if (!isset($globalLiveInterval)) { |
|
| 360 | + $globalLiveInterval = '200'; |
|
| 361 | + } |
|
| 319 | 362 | $filter_query = $this->getFilter($filter,true,true); |
| 320 | 363 | |
| 321 | 364 | if (is_array($coord)) { |
@@ -323,7 +366,9 @@ discard block |
||
| 323 | 366 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 324 | 367 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 325 | 368 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 326 | - } else return array(); |
|
| 369 | + } else { |
|
| 370 | + return array(); |
|
| 371 | + } |
|
| 327 | 372 | /* |
| 328 | 373 | if ($globalDBdriver == 'mysql') { |
| 329 | 374 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
@@ -557,13 +602,19 @@ discard block |
||
| 557 | 602 | //$query = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date'; |
| 558 | 603 | if ($globalDBdriver == 'mysql') { |
| 559 | 604 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
| 560 | - if ($liveinterval === true) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 561 | - elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
| 605 | + if ($liveinterval === true) { |
|
| 606 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 607 | + } elseif ($liveinterval !== false) { |
|
| 608 | + $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
| 609 | + } |
|
| 562 | 610 | $query .= ' ORDER BY date'; |
| 563 | 611 | } else { |
| 564 | 612 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
| 565 | - if ($liveinterval === true) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 566 | - elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
| 613 | + if ($liveinterval === true) { |
|
| 614 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 615 | + } elseif ($liveinterval !== false) { |
|
| 616 | + $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
| 617 | + } |
|
| 567 | 618 | $query .= ' ORDER BY date'; |
| 568 | 619 | } |
| 569 | 620 | |
@@ -658,7 +709,9 @@ discard block |
||
| 658 | 709 | $i++; |
| 659 | 710 | $j++; |
| 660 | 711 | if ($j == 30) { |
| 661 | - if ($globalDebug) echo "."; |
|
| 712 | + if ($globalDebug) { |
|
| 713 | + echo "."; |
|
| 714 | + } |
|
| 662 | 715 | try { |
| 663 | 716 | |
| 664 | 717 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -905,7 +958,9 @@ discard block |
||
| 905 | 958 | { |
| 906 | 959 | return false; |
| 907 | 960 | } |
| 908 | - } else return ''; |
|
| 961 | + } else { |
|
| 962 | + return ''; |
|
| 963 | + } |
|
| 909 | 964 | |
| 910 | 965 | if ($longitude != '') |
| 911 | 966 | { |
@@ -913,7 +968,9 @@ discard block |
||
| 913 | 968 | { |
| 914 | 969 | return false; |
| 915 | 970 | } |
| 916 | - } else return ''; |
|
| 971 | + } else { |
|
| 972 | + return ''; |
|
| 973 | + } |
|
| 917 | 974 | |
| 918 | 975 | if ($altitude != '') |
| 919 | 976 | { |
@@ -921,7 +978,9 @@ discard block |
||
| 921 | 978 | { |
| 922 | 979 | return false; |
| 923 | 980 | } |
| 924 | - } else $altitude = 0; |
|
| 981 | + } else { |
|
| 982 | + $altitude = 0; |
|
| 983 | + } |
|
| 925 | 984 | |
| 926 | 985 | if ($heading != '') |
| 927 | 986 | { |
@@ -929,7 +988,9 @@ discard block |
||
| 929 | 988 | { |
| 930 | 989 | return false; |
| 931 | 990 | } |
| 932 | - } else $heading = 0; |
|
| 991 | + } else { |
|
| 992 | + $heading = 0; |
|
| 993 | + } |
|
| 933 | 994 | |
| 934 | 995 | if ($groundspeed != '') |
| 935 | 996 | { |
@@ -937,9 +998,13 @@ discard block |
||
| 937 | 998 | { |
| 938 | 999 | return false; |
| 939 | 1000 | } |
| 940 | - } else $groundspeed = 0; |
|
| 1001 | + } else { |
|
| 1002 | + $groundspeed = 0; |
|
| 1003 | + } |
|
| 941 | 1004 | date_default_timezone_set('UTC'); |
| 942 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 1005 | + if ($date == '') { |
|
| 1006 | + $date = date("Y-m-d H:i:s", time()); |
|
| 1007 | + } |
|
| 943 | 1008 | |
| 944 | 1009 | |
| 945 | 1010 | $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
@@ -955,12 +1020,18 @@ discard block |
||
| 955 | 1020 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
| 956 | 1021 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
| 957 | 1022 | |
| 958 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 959 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1023 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 1024 | + $groundspeed = 0; |
|
| 1025 | + } |
|
| 1026 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 1027 | + $heading = 0; |
|
| 1028 | + } |
|
| 960 | 1029 | |
| 961 | 1030 | $query = ''; |
| 962 | 1031 | if ($globalArchive) { |
| 963 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
| 1032 | + if ($globalDebug) { |
|
| 1033 | + echo '-- Delete previous data -- '; |
|
| 1034 | + } |
|
| 964 | 1035 | $query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;'; |
| 965 | 1036 | } |
| 966 | 1037 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
@@ -979,10 +1050,14 @@ discard block |
||
| 979 | 1050 | echo 'noarchive : '.$noarchive."\n"; |
| 980 | 1051 | */ |
| 981 | 1052 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 982 | - if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
| 1053 | + if ($globalDebug) { |
|
| 1054 | + echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
| 1055 | + } |
|
| 983 | 1056 | $TrackerArchive = new TrackerArchive($this->db); |
| 984 | 1057 | $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
| 985 | - if ($globalDebug) echo $result.')'; |
|
| 1058 | + if ($globalDebug) { |
|
| 1059 | + echo $result.')'; |
|
| 1060 | + } |
|
| 986 | 1061 | } |
| 987 | 1062 | |
| 988 | 1063 | return "success"; |
@@ -1036,8 +1036,11 @@ discard block |
||
| 1036 | 1036 | public function parseNOTAMtextFile($filename) { |
| 1037 | 1037 | $data = file_get_contents($filename); |
| 1038 | 1038 | preg_match_all("/%%(.+?)%%/is", $data, $matches); |
| 1039 | - if (isset($matches[1])) return $matches[1]; |
|
| 1040 | - else return array(); |
|
| 1039 | + if (isset($matches[1])) { |
|
| 1040 | + return $matches[1]; |
|
| 1041 | + } else { |
|
| 1042 | + return array(); |
|
| 1043 | + } |
|
| 1041 | 1044 | } |
| 1042 | 1045 | public function getAllNOTAMbyScope($scope) { |
| 1043 | 1046 | global $globalDBdriver; |
@@ -1073,7 +1076,9 @@ discard block |
||
| 1073 | 1076 | $minlong = $maxlong; |
| 1074 | 1077 | $maxlong = $tmplong; |
| 1075 | 1078 | } |
| 1076 | - } else return array(); |
|
| 1079 | + } else { |
|
| 1080 | + return array(); |
|
| 1081 | + } |
|
| 1077 | 1082 | if ($globalDBdriver == 'mysql') { |
| 1078 | 1083 | $query = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()'; |
| 1079 | 1084 | } else { |
@@ -1096,7 +1101,9 @@ discard block |
||
| 1096 | 1101 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1097 | 1102 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1098 | 1103 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1099 | - } else return array(); |
|
| 1104 | + } else { |
|
| 1105 | + return array(); |
|
| 1106 | + } |
|
| 1100 | 1107 | if ($globalDBdriver == 'mysql') { |
| 1101 | 1108 | $query = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope'; |
| 1102 | 1109 | } else { |
@@ -1122,8 +1129,11 @@ discard block |
||
| 1122 | 1129 | return "error : ".$e->getMessage(); |
| 1123 | 1130 | } |
| 1124 | 1131 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1125 | - if (isset($all[0])) return $all[0]; |
|
| 1126 | - else return array(); |
|
| 1132 | + if (isset($all[0])) { |
|
| 1133 | + return $all[0]; |
|
| 1134 | + } else { |
|
| 1135 | + return array(); |
|
| 1136 | + } |
|
| 1127 | 1137 | } |
| 1128 | 1138 | |
| 1129 | 1139 | public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) { |
@@ -1201,7 +1211,9 @@ discard block |
||
| 1201 | 1211 | foreach ($alldata as $initial_data) { |
| 1202 | 1212 | $data = $this->parse($initial_data); |
| 1203 | 1213 | $notamref = $this->getNOTAMbyRef($data['ref']); |
| 1204 | - if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
| 1214 | + if (count($notamref) == 0) { |
|
| 1215 | + $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
| 1216 | + } |
|
| 1205 | 1217 | } |
| 1206 | 1218 | } |
| 1207 | 1219 | } |
@@ -1212,20 +1224,28 @@ discard block |
||
| 1212 | 1224 | $alldata = $this->parseNOTAMtextFile($filename); |
| 1213 | 1225 | if (count($alldata) > 0) { |
| 1214 | 1226 | $this->deleteOldNOTAM(); |
| 1215 | - if ($globalTransaction) $this->db->beginTransaction(); |
|
| 1227 | + if ($globalTransaction) { |
|
| 1228 | + $this->db->beginTransaction(); |
|
| 1229 | + } |
|
| 1216 | 1230 | $j = 0; |
| 1217 | 1231 | foreach ($alldata as $initial_data) { |
| 1218 | 1232 | $j++; |
| 1219 | 1233 | $data = $this->parse($initial_data); |
| 1220 | 1234 | $notamref = $this->getNOTAMbyRef($data['ref']); |
| 1221 | - if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
| 1235 | + if (!isset($notamref['notam_id'])) { |
|
| 1236 | + $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
| 1237 | + } |
|
| 1222 | 1238 | if ($globalTransaction && $j % 1000 == 0) { |
| 1223 | 1239 | $this->db->commit(); |
| 1224 | - if ($globalDebug) echo '.'; |
|
| 1240 | + if ($globalDebug) { |
|
| 1241 | + echo '.'; |
|
| 1242 | + } |
|
| 1225 | 1243 | $this->db->beginTransaction(); |
| 1226 | 1244 | } |
| 1227 | 1245 | } |
| 1228 | - if ($globalTransaction) $this->db->commit(); |
|
| 1246 | + if ($globalTransaction) { |
|
| 1247 | + $this->db->commit(); |
|
| 1248 | + } |
|
| 1229 | 1249 | } |
| 1230 | 1250 | } |
| 1231 | 1251 | |
@@ -1236,11 +1256,15 @@ discard block |
||
| 1236 | 1256 | foreach (array_chunk($allairports,20) as $airport) { |
| 1237 | 1257 | $airports_icao = array(); |
| 1238 | 1258 | foreach($airport as $icao) { |
| 1239 | - if (isset($icao['icao'])) $airports_icao[] = $icao['icao']; |
|
| 1259 | + if (isset($icao['icao'])) { |
|
| 1260 | + $airports_icao[] = $icao['icao']; |
|
| 1261 | + } |
|
| 1240 | 1262 | } |
| 1241 | 1263 | $airport_icao = implode(',',$airports_icao); |
| 1242 | 1264 | $alldata = $this->downloadNOTAM($airport_icao); |
| 1243 | - if ($globalTransaction) $this->db->beginTransaction(); |
|
| 1265 | + if ($globalTransaction) { |
|
| 1266 | + $this->db->beginTransaction(); |
|
| 1267 | + } |
|
| 1244 | 1268 | if (count($alldata) > 0) { |
| 1245 | 1269 | foreach ($alldata as $initial_data) { |
| 1246 | 1270 | //print_r($initial_data); |
@@ -1249,14 +1273,23 @@ discard block |
||
| 1249 | 1273 | if (isset($data['ref'])) { |
| 1250 | 1274 | $notamref = $this->getNOTAMbyRef($data['ref']); |
| 1251 | 1275 | if (count($notamref) == 0) { |
| 1252 | - if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']); |
|
| 1253 | - if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']); |
|
| 1254 | - elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
| 1276 | + if (isset($data['ref_replaced'])) { |
|
| 1277 | + $this->deleteNOTAMbyRef($data['ref_replaced']); |
|
| 1278 | + } |
|
| 1279 | + if (isset($data['ref_cancelled'])) { |
|
| 1280 | + $this->deleteNOTAMbyRef($data['ref_cancelled']); |
|
| 1281 | + } elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) { |
|
| 1282 | + echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
| 1283 | + } |
|
| 1255 | 1284 | } |
| 1256 | 1285 | } |
| 1257 | 1286 | } |
| 1258 | - } else echo 'Error on download. Nothing matches for '.$airport_icao."\n"; |
|
| 1259 | - if ($globalTransaction) $this->db->commit(); |
|
| 1287 | + } else { |
|
| 1288 | + echo 'Error on download. Nothing matches for '.$airport_icao."\n"; |
|
| 1289 | + } |
|
| 1290 | + if ($globalTransaction) { |
|
| 1291 | + $this->db->commit(); |
|
| 1292 | + } |
|
| 1260 | 1293 | sleep(5); |
| 1261 | 1294 | } |
| 1262 | 1295 | } |
@@ -1269,8 +1302,11 @@ discard block |
||
| 1269 | 1302 | $data = $Common->getData($url); |
| 1270 | 1303 | preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches); |
| 1271 | 1304 | //print_r($matches); |
| 1272 | - if (isset($matches[1])) return $matches[1]; |
|
| 1273 | - else return array(); |
|
| 1305 | + if (isset($matches[1])) { |
|
| 1306 | + return $matches[1]; |
|
| 1307 | + } else { |
|
| 1308 | + return array(); |
|
| 1309 | + } |
|
| 1274 | 1310 | } |
| 1275 | 1311 | |
| 1276 | 1312 | public function parse($data) { |
@@ -1301,99 +1337,156 @@ discard block |
||
| 1301 | 1337 | $rules = str_split($matches[3]); |
| 1302 | 1338 | foreach ($rules as $rule) { |
| 1303 | 1339 | if ($rule == 'I') { |
| 1304 | - if (isset($result['rules'])) $result['rules'] = $result['rules'].'/IFR'; |
|
| 1305 | - else $result['rules'] = 'IFR'; |
|
| 1340 | + if (isset($result['rules'])) { |
|
| 1341 | + $result['rules'] = $result['rules'].'/IFR'; |
|
| 1342 | + } else { |
|
| 1343 | + $result['rules'] = 'IFR'; |
|
| 1344 | + } |
|
| 1306 | 1345 | } elseif ($rule == 'V') { |
| 1307 | - if (isset($result['rules'])) $result['rules'] = $result['rules'].'/VFR'; |
|
| 1308 | - else $result['rules'] = 'VFR'; |
|
| 1346 | + if (isset($result['rules'])) { |
|
| 1347 | + $result['rules'] = $result['rules'].'/VFR'; |
|
| 1348 | + } else { |
|
| 1349 | + $result['rules'] = 'VFR'; |
|
| 1350 | + } |
|
| 1309 | 1351 | } elseif ($rule == 'K') { |
| 1310 | - if (isset($result['rules'])) $result['rules'] = $result['rules'].'/Checklist'; |
|
| 1311 | - else $result['rules'] = 'Checklist'; |
|
| 1352 | + if (isset($result['rules'])) { |
|
| 1353 | + $result['rules'] = $result['rules'].'/Checklist'; |
|
| 1354 | + } else { |
|
| 1355 | + $result['rules'] = 'Checklist'; |
|
| 1356 | + } |
|
| 1312 | 1357 | } |
| 1313 | 1358 | } |
| 1314 | 1359 | $attentions = str_split($matches[4]); |
| 1315 | 1360 | foreach ($attentions as $attention) { |
| 1316 | 1361 | if ($attention == 'N') { |
| 1317 | - if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Immediate attention'; |
|
| 1318 | - else $result['rules'] = 'Immediate attention'; |
|
| 1362 | + if (isset($result['attention'])) { |
|
| 1363 | + $result['attention'] = $result['attention'].' / Immediate attention'; |
|
| 1364 | + } else { |
|
| 1365 | + $result['rules'] = 'Immediate attention'; |
|
| 1366 | + } |
|
| 1319 | 1367 | } elseif ($attention == 'B') { |
| 1320 | - if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Operational significance'; |
|
| 1321 | - else $result['rules'] = 'Operational significance'; |
|
| 1368 | + if (isset($result['attention'])) { |
|
| 1369 | + $result['attention'] = $result['attention'].' / Operational significance'; |
|
| 1370 | + } else { |
|
| 1371 | + $result['rules'] = 'Operational significance'; |
|
| 1372 | + } |
|
| 1322 | 1373 | } elseif ($attention == 'O') { |
| 1323 | - if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Flight operations'; |
|
| 1324 | - else $result['rules'] = 'Flight operations'; |
|
| 1374 | + if (isset($result['attention'])) { |
|
| 1375 | + $result['attention'] = $result['attention'].' / Flight operations'; |
|
| 1376 | + } else { |
|
| 1377 | + $result['rules'] = 'Flight operations'; |
|
| 1378 | + } |
|
| 1325 | 1379 | } elseif ($attention == 'M') { |
| 1326 | - if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Misc'; |
|
| 1327 | - else $result['rules'] = 'Misc'; |
|
| 1380 | + if (isset($result['attention'])) { |
|
| 1381 | + $result['attention'] = $result['attention'].' / Misc'; |
|
| 1382 | + } else { |
|
| 1383 | + $result['rules'] = 'Misc'; |
|
| 1384 | + } |
|
| 1328 | 1385 | } elseif ($attention == 'K') { |
| 1329 | - if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Checklist'; |
|
| 1330 | - else $result['rules'] = 'Checklist'; |
|
| 1386 | + if (isset($result['attention'])) { |
|
| 1387 | + $result['attention'] = $result['attention'].' / Checklist'; |
|
| 1388 | + } else { |
|
| 1389 | + $result['rules'] = 'Checklist'; |
|
| 1390 | + } |
|
| 1331 | 1391 | } |
| 1332 | 1392 | } |
| 1333 | - if ($matches[5] == 'A') $result['scope'] = 'Airport warning'; |
|
| 1334 | - elseif ($matches[5] == 'E') $result['scope'] = 'Enroute warning'; |
|
| 1335 | - elseif ($matches[5] == 'W') $result['scope'] = 'Navigation warning'; |
|
| 1336 | - elseif ($matches[5] == 'K') $result['scope'] = 'Checklist'; |
|
| 1337 | - elseif ($matches[5] == 'AE') $result['scope'] = 'Airport/Enroute warning'; |
|
| 1338 | - elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning'; |
|
| 1393 | + if ($matches[5] == 'A') { |
|
| 1394 | + $result['scope'] = 'Airport warning'; |
|
| 1395 | + } elseif ($matches[5] == 'E') { |
|
| 1396 | + $result['scope'] = 'Enroute warning'; |
|
| 1397 | + } elseif ($matches[5] == 'W') { |
|
| 1398 | + $result['scope'] = 'Navigation warning'; |
|
| 1399 | + } elseif ($matches[5] == 'K') { |
|
| 1400 | + $result['scope'] = 'Checklist'; |
|
| 1401 | + } elseif ($matches[5] == 'AE') { |
|
| 1402 | + $result['scope'] = 'Airport/Enroute warning'; |
|
| 1403 | + } elseif ($matches[5] == 'AW') { |
|
| 1404 | + $result['scope'] = 'Airport/Navigation warning'; |
|
| 1405 | + } |
|
| 1339 | 1406 | $result['lower_limit'] = $matches[6]; |
| 1340 | 1407 | $result['upper_limit'] = $matches[7]; |
| 1341 | 1408 | $latitude = $Common->convertDec($matches[8],'latitude'); |
| 1342 | - if ($matches[9] == 'S') $latitude = -$latitude; |
|
| 1409 | + if ($matches[9] == 'S') { |
|
| 1410 | + $latitude = -$latitude; |
|
| 1411 | + } |
|
| 1343 | 1412 | $longitude = $Common->convertDec($matches[10],'longitude'); |
| 1344 | - if ($matches[11] == 'W') $longitude = -$longitude; |
|
| 1413 | + if ($matches[11] == 'W') { |
|
| 1414 | + $longitude = -$longitude; |
|
| 1415 | + } |
|
| 1345 | 1416 | $result['latitude'] = $latitude; |
| 1346 | 1417 | $result['longitude'] = $longitude; |
| 1347 | - if ($matches[12] != '') $result['radius'] = intval($matches[12]); |
|
| 1348 | - else $result['radius'] = 0; |
|
| 1418 | + if ($matches[12] != '') { |
|
| 1419 | + $result['radius'] = intval($matches[12]); |
|
| 1420 | + } else { |
|
| 1421 | + $result['radius'] = 0; |
|
| 1422 | + } |
|
| 1349 | 1423 | $q = true; |
| 1350 | 1424 | } elseif ($globalDebug) { |
| 1351 | 1425 | echo 'NOTAM error : '.$result['full_notam']."\n"; |
| 1352 | 1426 | echo "Can't parse : ".$line."\n"; |
| 1353 | 1427 | } |
| 1354 | - } |
|
| 1355 | - elseif (preg_match('#(^|\s)A\) (.*)#',$line,$matches) && $a === false) { |
|
| 1428 | + } elseif (preg_match('#(^|\s)A\) (.*)#',$line,$matches) && $a === false) { |
|
| 1356 | 1429 | $result['icao'] = $matches[2]; |
| 1357 | 1430 | $a = true; |
| 1358 | - } |
|
| 1359 | - elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches) && $b === false) { |
|
| 1360 | - if ($matches[1] > 50) $year = '19'.$matches[2]; |
|
| 1361 | - else $year = '20'.$matches[2]; |
|
| 1431 | + } elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches) && $b === false) { |
|
| 1432 | + if ($matches[1] > 50) { |
|
| 1433 | + $year = '19'.$matches[2]; |
|
| 1434 | + } else { |
|
| 1435 | + $year = '20'.$matches[2]; |
|
| 1436 | + } |
|
| 1362 | 1437 | $result['date_begin'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6]; |
| 1363 | 1438 | $b = true; |
| 1364 | - } |
|
| 1365 | - elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches) && $c === false) { |
|
| 1366 | - if ($matches[2] > 50) $year = '19'.$matches[2]; |
|
| 1367 | - else $year = '20'.$matches[2]; |
|
| 1439 | + } elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches) && $c === false) { |
|
| 1440 | + if ($matches[2] > 50) { |
|
| 1441 | + $year = '19'.$matches[2]; |
|
| 1442 | + } else { |
|
| 1443 | + $year = '20'.$matches[2]; |
|
| 1444 | + } |
|
| 1368 | 1445 | $result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6]; |
| 1369 | 1446 | $result['permanent'] = 0; |
| 1370 | 1447 | $c = true; |
| 1371 | - } |
|
| 1372 | - elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches) && $c === false) { |
|
| 1373 | - if ($matches[2] > 50) $year = '19'.$matches[2]; |
|
| 1374 | - else $year = '20'.$matches[2]; |
|
| 1448 | + } elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches) && $c === false) { |
|
| 1449 | + if ($matches[2] > 50) { |
|
| 1450 | + $year = '19'.$matches[2]; |
|
| 1451 | + } else { |
|
| 1452 | + $year = '20'.$matches[2]; |
|
| 1453 | + } |
|
| 1375 | 1454 | $result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6]; |
| 1376 | - if ($matches[7] == 'EST') $result['estimated'] = 1; |
|
| 1377 | - else $result['estimated'] = 0; |
|
| 1378 | - if ($matches[7] == 'PERM') $result['permanent'] = 1; |
|
| 1379 | - else $result['permanent'] = 0; |
|
| 1455 | + if ($matches[7] == 'EST') { |
|
| 1456 | + $result['estimated'] = 1; |
|
| 1457 | + } else { |
|
| 1458 | + $result['estimated'] = 0; |
|
| 1459 | + } |
|
| 1460 | + if ($matches[7] == 'PERM') { |
|
| 1461 | + $result['permanent'] = 1; |
|
| 1462 | + } else { |
|
| 1463 | + $result['permanent'] = 0; |
|
| 1464 | + } |
|
| 1380 | 1465 | $c = true; |
| 1381 | - } |
|
| 1382 | - elseif (preg_match('#(^|\s)C\) (EST|PERM)$#',$line,$matches) && $c === false) { |
|
| 1466 | + } elseif (preg_match('#(^|\s)C\) (EST|PERM)$#',$line,$matches) && $c === false) { |
|
| 1383 | 1467 | $result['date_end'] = '2030/12/20 12:00'; |
| 1384 | - if ($matches[2] == 'EST') $result['estimated'] = 1; |
|
| 1385 | - else $result['estimated'] = 0; |
|
| 1386 | - if ($matches[2] == 'PERM') $result['permanent'] = 1; |
|
| 1387 | - else $result['permanent'] = 0; |
|
| 1468 | + if ($matches[2] == 'EST') { |
|
| 1469 | + $result['estimated'] = 1; |
|
| 1470 | + } else { |
|
| 1471 | + $result['estimated'] = 0; |
|
| 1472 | + } |
|
| 1473 | + if ($matches[2] == 'PERM') { |
|
| 1474 | + $result['permanent'] = 1; |
|
| 1475 | + } else { |
|
| 1476 | + $result['permanent'] = 0; |
|
| 1477 | + } |
|
| 1388 | 1478 | $c = true; |
| 1389 | - } |
|
| 1390 | - elseif (preg_match('#(^|\s)E\) (.*)#',$line,$matches) && $e === false) { |
|
| 1479 | + } elseif (preg_match('#(^|\s)E\) (.*)#',$line,$matches) && $e === false) { |
|
| 1391 | 1480 | $rtext = array(); |
| 1392 | 1481 | $text = explode(' ',$matches[2]); |
| 1393 | 1482 | foreach ($text as $word) { |
| 1394 | - if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]); |
|
| 1395 | - elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3); |
|
| 1396 | - else $rtext[] = $word; |
|
| 1483 | + if (isset($this->abbr[$word])) { |
|
| 1484 | + $rtext[] = strtoupper($this->abbr[$word]); |
|
| 1485 | + } elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) { |
|
| 1486 | + $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3); |
|
| 1487 | + } else { |
|
| 1488 | + $rtext[] = $word; |
|
| 1489 | + } |
|
| 1397 | 1490 | } |
| 1398 | 1491 | $result['text'] = implode(' ',$rtext); |
| 1399 | 1492 | $e = true; |
@@ -1402,7 +1495,9 @@ discard block |
||
| 1402 | 1495 | } elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) { |
| 1403 | 1496 | $text = explode(' ',$line); |
| 1404 | 1497 | $result['ref'] = $text[0]; |
| 1405 | - if ($matches[1] == 'NOTAMN') $result['type'] = 'new'; |
|
| 1498 | + if ($matches[1] == 'NOTAMN') { |
|
| 1499 | + $result['type'] = 'new'; |
|
| 1500 | + } |
|
| 1406 | 1501 | if ($matches[1] == 'NOTAMC') { |
| 1407 | 1502 | $result['type'] = 'cancel'; |
| 1408 | 1503 | $result['ref_cancelled'] = $text[2]; |
@@ -1424,69 +1519,101 @@ discard block |
||
| 1424 | 1519 | switch ($code[1]) { |
| 1425 | 1520 | case 'A': |
| 1426 | 1521 | $result = 'Airspace organization '; |
| 1427 | - if (isset($this->code_airspace[$code_fp])) $result .= $this->code_airspace[$code_fp]; |
|
| 1522 | + if (isset($this->code_airspace[$code_fp])) { |
|
| 1523 | + $result .= $this->code_airspace[$code_fp]; |
|
| 1524 | + } |
|
| 1428 | 1525 | break; |
| 1429 | 1526 | case 'C': |
| 1430 | 1527 | $result = 'Communications and radar facilities '; |
| 1431 | - if (isset($this->code_comradar[$code_fp])) $result .= $this->code_comradar[$code_fp]; |
|
| 1528 | + if (isset($this->code_comradar[$code_fp])) { |
|
| 1529 | + $result .= $this->code_comradar[$code_fp]; |
|
| 1530 | + } |
|
| 1432 | 1531 | break; |
| 1433 | 1532 | case 'F': |
| 1434 | 1533 | $result = 'Facilities and services '; |
| 1435 | - if (isset($this->code_facilities[$code_fp])) $result .= $this->code_facilities[$code_fp]; |
|
| 1534 | + if (isset($this->code_facilities[$code_fp])) { |
|
| 1535 | + $result .= $this->code_facilities[$code_fp]; |
|
| 1536 | + } |
|
| 1436 | 1537 | break; |
| 1437 | 1538 | case 'I': |
| 1438 | 1539 | $result = 'Instrument and Microwave Landing System '; |
| 1439 | - if (isset($this->code_instrumentlanding[$code_fp])) $result .= $this->code_instrumentlanding[$code_fp]; |
|
| 1540 | + if (isset($this->code_instrumentlanding[$code_fp])) { |
|
| 1541 | + $result .= $this->code_instrumentlanding[$code_fp]; |
|
| 1542 | + } |
|
| 1440 | 1543 | break; |
| 1441 | 1544 | case 'L': |
| 1442 | 1545 | $result = 'Lighting facilities '; |
| 1443 | - if (isset($this->code_lightingfacilities[$code_fp])) $result .= $this->code_lightingfacilities[$code_fp]; |
|
| 1546 | + if (isset($this->code_lightingfacilities[$code_fp])) { |
|
| 1547 | + $result .= $this->code_lightingfacilities[$code_fp]; |
|
| 1548 | + } |
|
| 1444 | 1549 | break; |
| 1445 | 1550 | case 'M': |
| 1446 | 1551 | $result = 'Movement and landing areas '; |
| 1447 | - if (isset($this->code_movementareas[$code_fp])) $result .= $this->code_movementareas[$code_fp]; |
|
| 1552 | + if (isset($this->code_movementareas[$code_fp])) { |
|
| 1553 | + $result .= $this->code_movementareas[$code_fp]; |
|
| 1554 | + } |
|
| 1448 | 1555 | break; |
| 1449 | 1556 | case 'N': |
| 1450 | 1557 | $result = 'Terminal and En Route Navigation Facilities '; |
| 1451 | - if (isset($this->code_terminalfacilities[$code_fp])) $result .= $this->code_terminalfacilities[$code_fp]; |
|
| 1558 | + if (isset($this->code_terminalfacilities[$code_fp])) { |
|
| 1559 | + $result .= $this->code_terminalfacilities[$code_fp]; |
|
| 1560 | + } |
|
| 1452 | 1561 | break; |
| 1453 | 1562 | case 'O': |
| 1454 | 1563 | $result = 'Other information '; |
| 1455 | - if (isset($this->code_information[$code_fp])) $result .= $this->code_information[$code_fp]; |
|
| 1564 | + if (isset($this->code_information[$code_fp])) { |
|
| 1565 | + $result .= $this->code_information[$code_fp]; |
|
| 1566 | + } |
|
| 1456 | 1567 | break; |
| 1457 | 1568 | case 'P': |
| 1458 | 1569 | $result = 'Air Traffic procedures '; |
| 1459 | - if (isset($this->code_airtraffic[$code_fp])) $result .= $this->code_airtraffic[$code_fp]; |
|
| 1570 | + if (isset($this->code_airtraffic[$code_fp])) { |
|
| 1571 | + $result .= $this->code_airtraffic[$code_fp]; |
|
| 1572 | + } |
|
| 1460 | 1573 | break; |
| 1461 | 1574 | case 'R': |
| 1462 | 1575 | $result = 'Navigation Warnings: Airspace Restrictions '; |
| 1463 | - if (isset($this->code_navigationw[$code_fp])) $result .= $this->code_navigationw[$code_fp]; |
|
| 1576 | + if (isset($this->code_navigationw[$code_fp])) { |
|
| 1577 | + $result .= $this->code_navigationw[$code_fp]; |
|
| 1578 | + } |
|
| 1464 | 1579 | break; |
| 1465 | 1580 | case 'S': |
| 1466 | 1581 | $result = 'Air Traffic and VOLMET Services '; |
| 1467 | - if (isset($this->code_volmet[$code_fp])) $result .= $this->code_volmet[$code_fp]; |
|
| 1582 | + if (isset($this->code_volmet[$code_fp])) { |
|
| 1583 | + $result .= $this->code_volmet[$code_fp]; |
|
| 1584 | + } |
|
| 1468 | 1585 | break; |
| 1469 | 1586 | case 'W': |
| 1470 | 1587 | $result = 'Navigation Warnings: Warnings '; |
| 1471 | - if (isset($this->code_warnings[$code_fp])) $result .= $this->code_warnings[$code_fp]; |
|
| 1588 | + if (isset($this->code_warnings[$code_fp])) { |
|
| 1589 | + $result .= $this->code_warnings[$code_fp]; |
|
| 1590 | + } |
|
| 1472 | 1591 | break; |
| 1473 | 1592 | } |
| 1474 | 1593 | switch ($code[3]) { |
| 1475 | 1594 | case 'A': |
| 1476 | 1595 | // Availability |
| 1477 | - if (isset($this->code_sp_availabity[$code_sp])) $result .= ' '.$this->code_sp_availabity[$code_sp]; |
|
| 1596 | + if (isset($this->code_sp_availabity[$code_sp])) { |
|
| 1597 | + $result .= ' '.$this->code_sp_availabity[$code_sp]; |
|
| 1598 | + } |
|
| 1478 | 1599 | break; |
| 1479 | 1600 | case 'C': |
| 1480 | 1601 | // Changes |
| 1481 | - if (isset($this->code_sp_changes[$code_sp])) $result .= ' '.$this->code_sp_changes[$code_sp]; |
|
| 1602 | + if (isset($this->code_sp_changes[$code_sp])) { |
|
| 1603 | + $result .= ' '.$this->code_sp_changes[$code_sp]; |
|
| 1604 | + } |
|
| 1482 | 1605 | break; |
| 1483 | 1606 | case 'H': |
| 1484 | 1607 | // Hazardous conditions |
| 1485 | - if (isset($this->code_sp_hazardous[$code_sp])) $result .= ' '.$this->code_sp_hazardous[$code_sp]; |
|
| 1608 | + if (isset($this->code_sp_hazardous[$code_sp])) { |
|
| 1609 | + $result .= ' '.$this->code_sp_hazardous[$code_sp]; |
|
| 1610 | + } |
|
| 1486 | 1611 | break; |
| 1487 | 1612 | case 'L': |
| 1488 | 1613 | // Limitations |
| 1489 | - if (isset($this->code_sp_limitations[$code_sp])) $result .= ' '.$this->code_sp_limitations[$code_sp]; |
|
| 1614 | + if (isset($this->code_sp_limitations[$code_sp])) { |
|
| 1615 | + $result .= ' '.$this->code_sp_limitations[$code_sp]; |
|
| 1616 | + } |
|
| 1490 | 1617 | break; |
| 1491 | 1618 | case 'X': |
| 1492 | 1619 | // Other Information |
@@ -37,8 +37,12 @@ discard block |
||
| 37 | 37 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 38 | 38 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
| 39 | 39 | $filter = array(); |
| 40 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
| 41 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
| 40 | + if ($year != '') { |
|
| 41 | + $filter = array_merge($filter,array('year' => $year)); |
|
| 42 | + } |
|
| 43 | + if ($month != '') { |
|
| 44 | + $filter = array_merge($filter,array('month' => $month)); |
|
| 45 | + } |
|
| 42 | 46 | if ($sort != '') |
| 43 | 47 | { |
| 44 | 48 | $spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter); |
@@ -56,8 +60,12 @@ discard block |
||
| 56 | 60 | { |
| 57 | 61 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']); |
| 58 | 62 | $ident = $spotter_array[0]['ident']; |
| 59 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
| 60 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
| 63 | + if (isset($spotter_array[0]['latitude'])) { |
|
| 64 | + $latitude = $spotter_array[0]['latitude']; |
|
| 65 | + } |
|
| 66 | + if (isset($spotter_array[0]['longitude'])) { |
|
| 67 | + $longitude = $spotter_array[0]['longitude']; |
|
| 68 | + } |
|
| 61 | 69 | require_once('header.php'); |
| 62 | 70 | /* |
| 63 | 71 | if (isset($globalArchive) && $globalArchive) { |
@@ -110,12 +118,18 @@ discard block |
||
| 110 | 118 | */ |
| 111 | 119 | print '<div class="info column">'; |
| 112 | 120 | print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>'; |
| 113 | - if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>'; |
|
| 121 | + if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') { |
|
| 122 | + print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>'; |
|
| 123 | + } |
|
| 114 | 124 | if ($year == '' && $month == '') { |
| 115 | 125 | $Stats = new Stats(); |
| 116 | 126 | $flights = $Stats->getStatsPilot($pilot); |
| 117 | - } else $flights = 0; |
|
| 118 | - if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter); |
|
| 127 | + } else { |
|
| 128 | + $flights = 0; |
|
| 129 | + } |
|
| 130 | + if ($flights == 0) { |
|
| 131 | + $flights = $Spotter->countFlightsByPilot($pilot,$filter); |
|
| 132 | + } |
|
| 119 | 133 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
| 120 | 134 | $aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter)); |
| 121 | 135 | print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>'; |
@@ -126,7 +140,9 @@ discard block |
||
| 126 | 140 | $airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter)); |
| 127 | 141 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
| 128 | 142 | $duration = $Spotter->getFlightDurationByPilot($pilot,$filter); |
| 129 | - if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
|
| 143 | + if ($duration != '0') { |
|
| 144 | + print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
|
| 145 | + } |
|
| 130 | 146 | print '</div>'; |
| 131 | 147 | |
| 132 | 148 | include('pilot-sub-menu.php'); |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | print '<h1>'._("Aircraft Types").'</h1>'; |
| 17 | 17 | |
| 18 | 18 | $aircraft_types = $Stats->getAllAircraftTypes(); |
| 19 | - if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
| 19 | + if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') { |
|
| 20 | + $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
| 21 | + } |
|
| 20 | 22 | $previous = null; |
| 21 | 23 | print '<div class="alphabet-legend">'; |
| 22 | 24 | foreach($aircraft_types as $value) { |
@@ -24,10 +26,14 @@ discard block |
||
| 24 | 26 | $firstLetter = substr($value['aircraft_manufacturer'], 0, 1); |
| 25 | 27 | if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')') |
| 26 | 28 | { |
| 27 | - if ($previous !== null) print ' | '; |
|
| 29 | + if ($previous !== null) { |
|
| 30 | + print ' | '; |
|
| 31 | + } |
|
| 28 | 32 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
| 29 | 33 | } |
| 30 | - if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter; |
|
| 34 | + if ($firstLetter != '(' && $firstLetter != ')') { |
|
| 35 | + $previous = $firstLetter; |
|
| 36 | + } |
|
| 31 | 37 | } |
| 32 | 38 | print '</div>'; |
| 33 | 39 | $previous = null; |
@@ -38,10 +44,14 @@ discard block |
||
| 38 | 44 | { |
| 39 | 45 | if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')') |
| 40 | 46 | { |
| 41 | - if ($previous !== null) print '</div>'; |
|
| 47 | + if ($previous !== null) { |
|
| 48 | + print '</div>'; |
|
| 49 | + } |
|
| 42 | 50 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
| 43 | 51 | } |
| 44 | - if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter; |
|
| 52 | + if ($firstLetter != '(' && $firstLetter != ')') { |
|
| 53 | + $previous = $firstLetter; |
|
| 54 | + } |
|
| 45 | 55 | print '<div class="alphabet-item">'; |
| 46 | 56 | print '<a href="'.$globalURL.'/aircraft/'.$value['aircraft_icao'].'">'; |
| 47 | 57 | if ($value['aircraft_name'] == '') { |
@@ -38,8 +38,11 @@ discard block |
||
| 38 | 38 | global $globalGeoidSource; |
| 39 | 39 | //if ($name == '') $name = dirname(__FILE__).'/../install/tmp/egm2008-1.pgm'; |
| 40 | 40 | if ($name == '') { |
| 41 | - if (isset($globalGeoidSource) && $globalGeoidSource != '') $name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'; |
|
| 42 | - else $name = dirname(__FILE__).'/../data/egm96-15.pgm'; |
|
| 41 | + if (isset($globalGeoidSource) && $globalGeoidSource != '') { |
|
| 42 | + $name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'; |
|
| 43 | + } else { |
|
| 44 | + $name = dirname(__FILE__).'/../data/egm96-15.pgm'; |
|
| 45 | + } |
|
| 43 | 46 | } |
| 44 | 47 | |
| 45 | 48 | if (file_exists($name) === FALSE) { |
@@ -159,7 +162,9 @@ discard block |
||
| 159 | 162 | } |
| 160 | 163 | } |
| 161 | 164 | $this->t = $t; |
| 162 | - } else $t = $this->t; |
|
| 165 | + } else { |
|
| 166 | + $t = $this->t; |
|
| 167 | + } |
|
| 163 | 168 | if (!($cubic)) { |
| 164 | 169 | $a = (((1 - $fx) * $this->v00) + ($fx * $this->v01)); |
| 165 | 170 | $b = (((1 - $fx) * $this->v10) + ($fx * $this->v11)); |
@@ -11,7 +11,9 @@ discard block |
||
| 11 | 11 | print '<h1>'._("Geoid Height Calculator").'</h1>'; |
| 12 | 12 | print '</div>'; |
| 13 | 13 | print '<p>Not available</p>'; |
| 14 | - if (isset($globalDebug) && $globalDebug) echo '<p>'.$e.'</p>'; |
|
| 14 | + if (isset($globalDebug) && $globalDebug) { |
|
| 15 | + echo '<p>'.$e.'</p>'; |
|
| 16 | + } |
|
| 15 | 17 | require_once('footer.php'); |
| 16 | 18 | exit(); |
| 17 | 19 | } |
@@ -69,8 +71,11 @@ discard block |
||
| 69 | 71 | print '<div class="col-sm-6">'.round($altitude-$geoid,3).'</div>'; |
| 70 | 72 | } |
| 71 | 73 | print '<div class="col-sm-6"><b>Earth Gravity Model</b></div>'; |
| 72 | - if (isset($globalGeoidSource) && $globalGeoidSource != '') $geoidsource = $globalGeoidSource; |
|
| 73 | - else $geoidsource = 'EGM96-15'; |
|
| 74 | + if (isset($globalGeoidSource) && $globalGeoidSource != '') { |
|
| 75 | + $geoidsource = $globalGeoidSource; |
|
| 76 | + } else { |
|
| 77 | + $geoidsource = 'EGM96-15'; |
|
| 78 | + } |
|
| 74 | 79 | print '<div class="col-sm-6">'.$geoidsource.'</div>'; |
| 75 | 80 | print '</div>'; |
| 76 | 81 | } |
@@ -6,7 +6,13 @@ discard block |
||
| 6 | 6 | if (!isset($type) || $type != 'satellite') { |
| 7 | 7 | ?> |
| 8 | 8 | <form id="changedate" method="post"> |
| 9 | - <input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" /> |
|
| 9 | + <input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') { |
|
| 10 | + echo $year.'-'; |
|
| 11 | +} |
|
| 12 | +?><?php if (isset($month) && $month != '') { |
|
| 13 | + echo $month; |
|
| 14 | +} |
|
| 15 | +?>" /> |
|
| 10 | 16 | </form> |
| 11 | 17 | <?php |
| 12 | 18 | } |
@@ -38,7 +44,9 @@ discard block |
||
| 38 | 44 | print '<option disabled>──────────</option>'; |
| 39 | 45 | } |
| 40 | 46 | $Stats = new Stats(); |
| 41 | - if (!isset($filter_name)) $filter_name = ''; |
|
| 47 | + if (!isset($filter_name)) { |
|
| 48 | + $filter_name = ''; |
|
| 49 | + } |
|
| 42 | 50 | $airlines = $Stats->getAllAirlineNames($filter_name); |
| 43 | 51 | foreach($airlines as $airline) { |
| 44 | 52 | if ($airline['airline_icao'] != '') { |
@@ -69,10 +77,22 @@ discard block |
||
| 69 | 77 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 70 | 78 | </a> |
| 71 | 79 | <ul class="dropdown-menu"> |
| 72 | - <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
| 73 | - <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Registration"); ?></a></li> |
|
| 74 | - <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
| 75 | - <li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Country"); ?></a></li> |
|
| 80 | + <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 81 | + echo '/'.$airline_icao; |
|
| 82 | +} |
|
| 83 | +?>"><?php echo _("Aircraft"); ?></a></li> |
|
| 84 | + <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 85 | + echo '/'.$airline_icao; |
|
| 86 | +} |
|
| 87 | +?>"><?php echo _("Registration"); ?></a></li> |
|
| 88 | + <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 89 | + echo '/'.$airline_icao; |
|
| 90 | +} |
|
| 91 | +?>"><?php echo _("Manufacturer"); ?></a></li> |
|
| 92 | + <li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 93 | + echo '/'.$airline_icao; |
|
| 94 | +} |
|
| 95 | +?>"><?php echo _("Country"); ?></a></li> |
|
| 76 | 96 | </ul> |
| 77 | 97 | </li> |
| 78 | 98 | <li class="dropdown"> |
@@ -83,12 +103,21 @@ discard block |
||
| 83 | 103 | <?php |
| 84 | 104 | if (!isset($airline_icao) || $airline_icao == 'all') { |
| 85 | 105 | ?> |
| 86 | - <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline"); ?></a></li> |
|
| 87 | - <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
| 106 | + <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 107 | + echo '/'.$airline_icao; |
|
| 108 | +} |
|
| 109 | +?>"><?php echo _("Airline"); ?></a></li> |
|
| 110 | + <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 111 | + echo '/'.$airline_icao; |
|
| 112 | +} |
|
| 113 | +?>"><?php echo _("Airline by Country"); ?></a></li> |
|
| 88 | 114 | <?php |
| 89 | 115 | } |
| 90 | 116 | ?> |
| 91 | - <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Callsign"); ?></a></li> |
|
| 117 | + <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 118 | + echo '/'.$airline_icao; |
|
| 119 | +} |
|
| 120 | +?>"><?php echo _("Callsign"); ?></a></li> |
|
| 92 | 121 | </ul> |
| 93 | 122 | </li> |
| 94 | 123 | <li class="dropdown"> |
@@ -96,10 +125,22 @@ discard block |
||
| 96 | 125 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 97 | 126 | </a> |
| 98 | 127 | <ul class="dropdown-menu" role="menu"> |
| 99 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
| 100 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
| 101 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
| 102 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
| 128 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 129 | + echo '/'.$airline_icao; |
|
| 130 | +} |
|
| 131 | +?>"><?php echo _("Departure Airport"); ?></a></li> |
|
| 132 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 133 | + echo '/'.$airline_icao; |
|
| 134 | +} |
|
| 135 | +?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
| 136 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 137 | + echo '/'.$airline_icao; |
|
| 138 | +} |
|
| 139 | +?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
| 140 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 141 | + echo '/'.$airline_icao; |
|
| 142 | +} |
|
| 143 | +?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
| 103 | 144 | </ul> |
| 104 | 145 | </li> |
| 105 | 146 | <li class="dropdown"> |
@@ -107,8 +148,14 @@ discard block |
||
| 107 | 148 | <?php echo _("Route"); ?> <span class="caret"></span> |
| 108 | 149 | </a> |
| 109 | 150 | <ul class="dropdown-menu" role="menu"> |
| 110 | - <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Airport"); ?></a></li> |
|
| 111 | - <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Waypoint"); ?></a></li> |
|
| 151 | + <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 152 | + echo '/'.$airline_icao; |
|
| 153 | +} |
|
| 154 | +?>"><?php echo _("Route by Airport"); ?></a></li> |
|
| 155 | + <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 156 | + echo '/'.$airline_icao; |
|
| 157 | +} |
|
| 158 | +?>"><?php echo _("Route by Waypoint"); ?></a></li> |
|
| 112 | 159 | </ul> |
| 113 | 160 | </li> |
| 114 | 161 | <li class="dropdown"> |
@@ -116,8 +163,14 @@ discard block |
||
| 116 | 163 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 117 | 164 | </a> |
| 118 | 165 | <ul class="dropdown-menu" role="menu"> |
| 119 | - <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Date"); ?></a></li> |
|
| 120 | - <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Time"); ?></a></li> |
|
| 166 | + <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 167 | + echo '/'.$airline_icao; |
|
| 168 | +} |
|
| 169 | +?>"><?php echo _("Date"); ?></a></li> |
|
| 170 | + <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 171 | + echo '/'.$airline_icao; |
|
| 172 | +} |
|
| 173 | +?>"><?php echo _("Time"); ?></a></li> |
|
| 121 | 174 | </ul> |
| 122 | 175 | </li> |
| 123 | 176 | <?php |
@@ -173,9 +226,18 @@ discard block |
||
| 173 | 226 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 174 | 227 | </a> |
| 175 | 228 | <ul class="dropdown-menu"> |
| 176 | - <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
| 177 | - <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li> |
|
| 178 | - <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
| 229 | + <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 230 | + echo '/'.$airline_icao; |
|
| 231 | +} |
|
| 232 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
| 233 | + <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 234 | + echo '/'.$airline_icao; |
|
| 235 | +} |
|
| 236 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li> |
|
| 237 | + <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 238 | + echo '/'.$airline_icao; |
|
| 239 | +} |
|
| 240 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
| 179 | 241 | <!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> --> |
| 180 | 242 | </ul> |
| 181 | 243 | </li> |
@@ -187,12 +249,21 @@ discard block |
||
| 187 | 249 | <?php |
| 188 | 250 | if (!isset($airline_icao) || $airline_icao == 'all') { |
| 189 | 251 | ?> |
| 190 | - <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li> |
|
| 191 | - <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
| 252 | + <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 253 | + echo '/'.$airline_icao; |
|
| 254 | +} |
|
| 255 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li> |
|
| 256 | + <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 257 | + echo '/'.$airline_icao; |
|
| 258 | +} |
|
| 259 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
| 192 | 260 | <?php |
| 193 | 261 | } |
| 194 | 262 | ?> |
| 195 | - <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li> |
|
| 263 | + <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 264 | + echo '/'.$airline_icao; |
|
| 265 | +} |
|
| 266 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li> |
|
| 196 | 267 | </ul> |
| 197 | 268 | </li> |
| 198 | 269 | <li class="dropdown"> |
@@ -200,10 +271,22 @@ discard block |
||
| 200 | 271 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 201 | 272 | </a> |
| 202 | 273 | <ul class="dropdown-menu" role="menu"> |
| 203 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
| 204 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
| 205 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
| 206 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
| 274 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 275 | + echo '/'.$airline_icao; |
|
| 276 | +} |
|
| 277 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
| 278 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 279 | + echo '/'.$airline_icao; |
|
| 280 | +} |
|
| 281 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
| 282 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 283 | + echo '/'.$airline_icao; |
|
| 284 | +} |
|
| 285 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
| 286 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 287 | + echo '/'.$airline_icao; |
|
| 288 | +} |
|
| 289 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
| 207 | 290 | </ul> |
| 208 | 291 | </li> |
| 209 | 292 | <!-- |