@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | } |
| 9 | 9 | header('Content-Type: text/javascript'); |
| 10 | 10 | |
| 11 | -$tskfile = filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); |
|
| 11 | +$tskfile = filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); |
|
| 12 | 12 | |
| 13 | 13 | $spotter_array = $TSK->parse_xml($tskfile); |
| 14 | 14 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | if (!empty($spotter_array)) |
| 17 | 17 | { |
| 18 | 18 | $j = 0; |
| 19 | - foreach($spotter_array['Point'] as $spotter_item) |
|
| 19 | + foreach ($spotter_array['Point'] as $spotter_item) |
|
| 20 | 20 | { |
| 21 | 21 | date_default_timezone_set('UTC'); |
| 22 | 22 | //waypoint plotting |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $output .= '"geometry": {'; |
| 54 | 54 | $output .= '"type": "LineString",'; |
| 55 | 55 | $output .= '"coordinates": ['; |
| 56 | - foreach($spotter_array['Point'] as $spotter_item) |
|
| 56 | + foreach ($spotter_array['Point'] as $spotter_item) |
|
| 57 | 57 | { |
| 58 | 58 | $output .= '['.$spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude'].'],'; |
| 59 | 59 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function parse_xml($url) { |
| 17 | 17 | $Common = new Common(); |
| 18 | - $filedata = $Common->getData($url,'get','','','','','','',true); |
|
| 18 | + $filedata = $Common->getData($url, 'get', '', '', '', '', '', '', true); |
|
| 19 | 19 | if ($filedata != '' && $filedata !== false) { |
| 20 | 20 | $xml = simplexml_load_string($filedata); |
| 21 | 21 | if ($xml !== false) { |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | header('Content-Type: text/javascript'); |
| 18 | 18 | |
| 19 | 19 | |
| 20 | -$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
| 20 | +$polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
| 21 | 21 | $output = '{"type": "FeatureCollection","features": ['; |
| 22 | 22 | if (!empty($polar)) { |
| 23 | - foreach($polar as $eachpolar) { |
|
| 23 | + foreach ($polar as $eachpolar) { |
|
| 24 | 24 | $data = json_decode($eachpolar['source_data']); |
| 25 | 25 | $name = $eachpolar['source_name']; |
| 26 | 26 | $coord = $Location->getLocationInfobySourceName($name); |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | $initial_longitude = $globalCenterLongitude; |
| 34 | 34 | } |
| 35 | 35 | $first = ''; |
| 36 | - foreach($data as $value => $key) { |
|
| 37 | - $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude,$initial_longitude,$value*22.5,$key); |
|
| 38 | - if ($first == '') $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']'; |
|
| 36 | + foreach ($data as $value => $key) { |
|
| 37 | + $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude, $initial_longitude, $value*22.5, $key); |
|
| 38 | + if ($first == '') $first = '['.round($final_coord['longitude'], 5).','.round($final_coord['latitude'], 5).']'; |
|
| 39 | 39 | $output .= '['.$final_coord['longitude'].','.$final_coord['latitude'].'],'; |
| 40 | 40 | } |
| 41 | 41 | $output .= $first; |
| 42 | 42 | $output .= ']]}},'; |
| 43 | 43 | } |
| 44 | - $output = substr($output, 0, -1); |
|
| 44 | + $output = substr($output, 0, -1); |
|
| 45 | 45 | } |
| 46 | 46 | $output .= ']}'; |
| 47 | 47 | print $output; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | if (isset($this->all_tracked[$key]['id'])) { |
| 48 | 48 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
| 49 | 49 | $Tracker = new Tracker($this->db); |
| 50 | - $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'],$this->all_tracked[$key]['datetime']); |
|
| 50 | + $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'], $this->all_tracked[$key]['datetime']); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 59 | 59 | foreach ($this->all_tracked as $key => $flight) { |
| 60 | 60 | if (isset($flight['lastupdate'])) { |
| 61 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 61 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
| 62 | 62 | if (isset($this->all_tracked[$key]['id'])) { |
| 63 | 63 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
| 64 | 64 | /* |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | //$real_arrival = $this->arrival($key); |
| 70 | 70 | $Tracker = new Tracker($this->db); |
| 71 | 71 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
| 72 | - $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']); |
|
| 72 | + $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 | 73 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 74 | 74 | } |
| 75 | 75 | // Put in archive |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $send = false; |
| 90 | 90 | |
| 91 | 91 | // SBS format is CSV format |
| 92 | - if(is_array($line) && isset($line['ident'])) { |
|
| 92 | + if (is_array($line) && isset($line['ident'])) { |
|
| 93 | 93 | //print_r($line); |
| 94 | 94 | if (isset($line['ident'])) { |
| 95 | 95 | |
@@ -113,33 +113,33 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | if (!isset($this->all_tracked[$id])) { |
| 115 | 115 | $this->all_tracked[$id] = array(); |
| 116 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
| 117 | - $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 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 116 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedTracker' => 0)); |
|
| 117 | + $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 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
| 119 | 119 | if (!isset($line['id'])) { |
| 120 | 120 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 121 | - $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'])); |
|
| 121 | + $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 | 123 | if ($globalAllTracked !== FALSE) $dataFound = true; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
| 126 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
| 127 | 127 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
| 128 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
| 128 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
| 129 | 129 | } else { |
| 130 | 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 | 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"; |
| 132 | 132 | return ''; |
| 133 | 133 | } |
| 134 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
| 134 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
| 135 | 135 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
| 136 | 136 | return ''; |
| 137 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
| 137 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
| 138 | 138 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
| 139 | 139 | return ''; |
| 140 | 140 | } elseif (!isset($line['datetime'])) { |
| 141 | 141 | date_default_timezone_set('UTC'); |
| 142 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 142 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
| 143 | 143 | } else { |
| 144 | 144 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
| 145 | 145 | return ''; |
@@ -147,38 +147,38 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
| 149 | 149 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
| 150 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 150 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
| 151 | 151 | if ($this->all_tracked[$id]['addedTracker'] == 1) { |
| 152 | 152 | $timeelapsed = microtime(true); |
| 153 | 153 | $Tracker = new Tracker($this->db); |
| 154 | 154 | $fromsource = NULL; |
| 155 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
| 155 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
| 156 | 156 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 157 | 157 | $Tracker->db = null; |
| 158 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 158 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 159 | 159 | } |
| 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'])); |
|
| 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 | 161 | } |
| 162 | 162 | |
| 163 | 163 | if (isset($line['speed']) && $line['speed'] != '') { |
| 164 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 164 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed']))); |
|
| 165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
| 166 | 166 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 167 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 167 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
| 168 | 168 | if ($distance > 100 && $distance < 10000) { |
| 169 | 169 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 170 | 170 | $speed = $speed*3.6; |
| 171 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
| 171 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed))); |
|
| 172 | 172 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | 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']); |
|
| 177 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
| 178 | 178 | else unset($timediff); |
| 179 | - 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')))) { |
|
| 179 | + 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 | 180 | 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 | - 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)) { |
|
| 181 | + 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)) { |
|
| 182 | 182 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 183 | 183 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 184 | 184 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -186,10 +186,10 @@ discard block |
||
| 186 | 186 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
| 187 | 187 | $timeelapsed = microtime(true); |
| 188 | 188 | $Tracker = new Tracker($this->db); |
| 189 | - $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 189 | + $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
| 190 | 190 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
| 191 | 191 | $Tracker->db = null; |
| 192 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 192 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 193 | 193 | $this->tmd = 0; |
| 194 | 194 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
| 195 | 195 | } |
@@ -197,75 +197,75 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 199 | 199 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 200 | - 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') { |
|
| 200 | + 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 | 201 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
| 202 | 202 | $dataFound = true; |
| 203 | 203 | $this->all_tracked[$id]['time_last_coord'] = time(); |
| 204 | 204 | } |
| 205 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
| 205 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
| 206 | 206 | } |
| 207 | 207 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 208 | 208 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
| 209 | 209 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 210 | - 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') { |
|
| 210 | + 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 | 211 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
| 212 | 212 | $dataFound = true; |
| 213 | 213 | $this->all_tracked[$id]['time_last_coord'] = time(); |
| 214 | 214 | } |
| 215 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
| 215 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | } else if ($globalDebug && $timediff > 20) { |
| 219 | 219 | $this->tmd = $this->tmd + 1; |
| 220 | 220 | if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) { |
| 221 | 221 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
| 222 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
| 223 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
| 222 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
| 223 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
| 224 | 224 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 229 | 229 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
| 230 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 230 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
| 231 | 231 | } |
| 232 | 232 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 233 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 233 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
| 234 | 234 | } |
| 235 | 235 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 236 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 236 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
| 237 | 237 | } |
| 238 | 238 | if (isset($line['comment']) && $line['comment'] != '') { |
| 239 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
| 239 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('comment' => $line['comment'])); |
|
| 240 | 240 | //$dataFound = true; |
| 241 | 241 | } |
| 242 | 242 | if (isset($line['type']) && $line['type'] != '') { |
| 243 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 243 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
| 244 | 244 | //$dataFound = true; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 248 | 248 | //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; |
|
| 250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
|
| 251 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
|
| 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; |
|
| 250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude' => $line['altitude'])); |
|
| 251 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude_real' => $line['altitude'])); |
|
| 252 | 252 | //$dataFound = true; |
| 253 | 253 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 257 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 257 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | 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; |
|
| 262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 263 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 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; |
|
| 262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
| 263 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
| 264 | 264 | //$dataFound = true; |
| 265 | 265 | } 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 | - $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 | - $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; |
|
| 266 | + $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 | + $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 | 269 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
| 270 | 270 | } |
| 271 | 271 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -273,54 +273,54 @@ discard block |
||
| 273 | 273 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
| 274 | 274 | $this->all_tracked[$id]['lastupdate'] = time(); |
| 275 | 275 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
| 276 | - 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'])) { |
|
| 276 | + 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 | 277 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
| 278 | 278 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
| 279 | 279 | $timeelapsed = microtime(true); |
| 280 | 280 | $TrackerLive = new TrackerLive($this->db); |
| 281 | 281 | if (isset($line['id'])) { |
| 282 | 282 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
| 283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 283 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 284 | 284 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
| 285 | 285 | $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"; |
|
| 286 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 287 | 287 | } else $recent_ident = ''; |
| 288 | - $TrackerLive->db=null; |
|
| 288 | + $TrackerLive->db = null; |
|
| 289 | 289 | |
| 290 | 290 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 291 | 291 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 292 | 292 | } else { |
| 293 | 293 | $recent_ident = ''; |
| 294 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
| 294 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
| 295 | 295 | } |
| 296 | 296 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 297 | - if($recent_ident == "") |
|
| 297 | + if ($recent_ident == "") |
|
| 298 | 298 | { |
| 299 | 299 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
| 300 | 300 | //adds the spotter data for the archive |
| 301 | 301 | $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'))); |
|
| 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'))); |
|
| 303 | 303 | $timeelapsed = microtime(true); |
| 304 | 304 | $Tracker = new Tracker($this->db); |
| 305 | - $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']); |
|
| 305 | + $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 | 306 | $Tracker->db = null; |
| 307 | 307 | if ($globalDebug && isset($result)) echo $result."\n"; |
| 308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 308 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 309 | 309 | |
| 310 | 310 | |
| 311 | 311 | // Add source stat in DB |
| 312 | 312 | $Stats = new Stats($this->db); |
| 313 | 313 | if (!empty($this->stats)) { |
| 314 | 314 | if ($globalDebug) echo 'Add source stats : '; |
| 315 | - foreach($this->stats as $date => $data) { |
|
| 316 | - foreach($data as $source => $sourced) { |
|
| 315 | + foreach ($this->stats as $date => $data) { |
|
| 316 | + foreach ($data as $source => $sourced) { |
|
| 317 | 317 | //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); |
|
| 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); |
|
| 320 | 320 | if (isset($sourced['msg'])) { |
| 321 | 321 | if (time() - $sourced['msg']['date'] > 10) { |
| 322 | 322 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
| 323 | - echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
| 323 | + echo $Stats->addStatSource($nbmsg, $source, 'msg_tracker', $date); |
|
| 324 | 324 | unset($this->stats[$date][$source]['msg']); |
| 325 | 325 | } |
| 326 | 326 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
| 344 | 344 | $TrackerLive = new TrackerLive($this->db); |
| 345 | 345 | $TrackerLive->deleteLiveTrackerData(); |
| 346 | - $TrackerLive->db=null; |
|
| 346 | + $TrackerLive->db = null; |
|
| 347 | 347 | if ($globalDebug) echo " Done\n"; |
| 348 | 348 | $this->last_delete = time(); |
| 349 | 349 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | $this->all_tracked[$id]['addedTracker'] = 1; |
| 353 | 353 | if (isset($globalDaemon) && !$globalDaemon) { |
| 354 | 354 | $Tracker = new Tracker($this->db); |
| 355 | - $Tracker->updateLatestTrackerData($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]['speed'],$this->all_tracked[$id]['datetime']); |
|
| 355 | + $Tracker->updateLatestTrackerData($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]['speed'], $this->all_tracked[$id]['datetime']); |
|
| 356 | 356 | $Tracker->db = null; |
| 357 | 357 | } |
| 358 | 358 | |
@@ -366,14 +366,14 @@ discard block |
||
| 366 | 366 | $ignoreImport = false; |
| 367 | 367 | |
| 368 | 368 | if (!$ignoreImport) { |
| 369 | - 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'])) { |
|
| 369 | + 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 | 370 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
| 371 | 371 | $timeelapsed = microtime(true); |
| 372 | 372 | $TrackerLive = new TrackerLive($this->db); |
| 373 | - $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']); |
|
| 373 | + $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 | 374 | $TrackerLive->db = null; |
| 375 | 375 | $this->all_tracked[$id]['putinarchive'] = false; |
| 376 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 376 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 377 | 377 | |
| 378 | 378 | // Put statistics in $this->stats variable |
| 379 | 379 | |
@@ -390,19 +390,19 @@ discard block |
||
| 390 | 390 | $latitude = $globalCenterLatitude; |
| 391 | 391 | $longitude = $globalCenterLongitude; |
| 392 | 392 | } |
| 393 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
| 393 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
| 394 | 394 | } else { |
| 395 | 395 | $latitude = $this->source_location[$source]['latitude']; |
| 396 | 396 | $longitude = $this->source_location[$source]['longitude']; |
| 397 | 397 | } |
| 398 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
| 398 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
| 399 | 399 | //$stats_heading = $stats_heading%22.5; |
| 400 | 400 | $stats_heading = round($stats_heading/22.5); |
| 401 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
| 401 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
| 402 | 402 | $current_date = date('Y-m-d'); |
| 403 | 403 | if ($stats_heading == 16) $stats_heading = 0; |
| 404 | 404 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 405 | - for ($i=0;$i<=15;$i++) { |
|
| 405 | + for ($i = 0; $i <= 15; $i++) { |
|
| 406 | 406 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
| 407 | 407 | } |
| 408 | 408 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -417,9 +417,9 @@ discard block |
||
| 417 | 417 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 418 | 418 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 419 | 419 | end($this->stats[$current_date][$source]['hist']); |
| 420 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 420 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
| 421 | 421 | } else $mini = 0; |
| 422 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
| 422 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
| 423 | 423 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 424 | 424 | } |
| 425 | 425 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | $this->all_tracked[$id]['lastupdate'] = time(); |
| 432 | 432 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
| 433 | 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"; |
|
| 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"; |
|
| 435 | 435 | //$this->del(); |
| 436 | 436 | |
| 437 | 437 | |
@@ -14,35 +14,35 @@ discard block |
||
| 14 | 14 | if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline'; |
| 15 | 15 | |
| 16 | 16 | if (isset($_GET['3d'])) { |
| 17 | - setcookie('MapFormat','3d'); |
|
| 17 | + setcookie('MapFormat', '3d'); |
|
| 18 | 18 | } else if (isset($_GET['2d'])) { |
| 19 | - setcookie('MapFormat','2d'); |
|
| 19 | + setcookie('MapFormat', '2d'); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
| 23 | - $tsk = filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); |
|
| 23 | + $tsk = filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | if (isset($_POST['archive'])) { |
| 27 | - setcookie('archive','true'); |
|
| 28 | - setcookie('archive_begin',strtotime($_POST['start_date'])); |
|
| 29 | - setcookie('archive_end',strtotime($_POST['end_date'])); |
|
| 30 | - setcookie('archive_speed',$_POST['archivespeed']); |
|
| 27 | + setcookie('archive', 'true'); |
|
| 28 | + setcookie('archive_begin', strtotime($_POST['start_date'])); |
|
| 29 | + setcookie('archive_end', strtotime($_POST['end_date'])); |
|
| 30 | + setcookie('archive_speed', $_POST['archivespeed']); |
|
| 31 | 31 | } |
| 32 | 32 | if (isset($_POST['noarchive'])) { |
| 33 | - setcookie('archive','false',-1); |
|
| 34 | - setcookie('archive_begin','',-1); |
|
| 35 | - setcookie('archive_end','',-1); |
|
| 36 | - setcookie('archive_speed','',-1); |
|
| 33 | + setcookie('archive', 'false', -1); |
|
| 34 | + setcookie('archive_begin', '', -1); |
|
| 35 | + setcookie('archive_end', '', -1); |
|
| 36 | + setcookie('archive_speed', '', -1); |
|
| 37 | 37 | } |
| 38 | 38 | // When button "Remove all filters" is clicked |
| 39 | 39 | if (isset($_POST['removefilters'])) { |
| 40 | - $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
|
| 41 | - return strpos($key,'filter_') === 0; |
|
| 40 | + $allfilters = array_filter(array_keys($_COOKIE), function($key) { |
|
| 41 | + return strpos($key, 'filter_') === 0; |
|
| 42 | 42 | }); |
| 43 | 43 | foreach ($allfilters as $filt) { |
| 44 | 44 | unset($_COOKIE[$filt]); |
| 45 | - setcookie($filt,null,-1); |
|
| 45 | + setcookie($filt, null, -1); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | ?> |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
| 265 | 265 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
| 266 | 266 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 267 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 267 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 268 | 268 | <?php |
| 269 | 269 | if (!isset($type) || $type == 'aircraft') { |
| 270 | 270 | ?> |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
| 338 | 338 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
| 339 | 339 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 340 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 340 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 341 | 341 | <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
| 342 | 342 | <?php |
| 343 | 343 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -742,8 +742,8 @@ discard block |
||
| 742 | 742 | ?> |
| 743 | 743 | <div class="search"> |
| 744 | 744 | <form action="<?php print $globalURL; ?>/search" method="get"> |
| 745 | - <!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>--> |
|
| 746 | - <input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != ""){ print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
| 745 | + <!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>--> |
|
| 746 | + <input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != "") { print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
| 747 | 747 | </form> |
| 748 | 748 | </div> |
| 749 | 749 | <div class="social"> |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | print '</div>'; |
| 762 | 762 | } |
| 763 | 763 | |
| 764 | -if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
| 764 | +if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
| 765 | 765 | ?> |
| 766 | 766 | <div class="top-header clear" role="main"> |
| 767 | 767 | <?php |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | </div> |
| 775 | 775 | <?php |
| 776 | 776 | } |
| 777 | -if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
|
| 777 | +if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false)) |
|
| 778 | 778 | { |
| 779 | 779 | ?> |
| 780 | 780 | <div class="top-header clear" role="main"> |
@@ -787,15 +787,15 @@ discard block |
||
| 787 | 787 | var zoom = 13; |
| 788 | 788 | //create the map |
| 789 | 789 | <?php |
| 790 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 790 | + if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 791 | 791 | ?> |
| 792 | 792 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
| 793 | 793 | <?php |
| 794 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 794 | + } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) { |
|
| 795 | 795 | ?> |
| 796 | 796 | map = L.map('map', { zoomControl:true }); |
| 797 | 797 | <?php |
| 798 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 798 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 799 | 799 | ?> |
| 800 | 800 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
| 801 | 801 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 804 | 804 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 805 | 805 | <?php |
| 806 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
| 806 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
| 807 | 807 | ?> |
| 808 | 808 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
| 809 | 809 | <?php |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | $gpx .= '<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpsies="http://www.gpsies.com/GPX/1/0" creator="GPSies http://www.gpsies.com - Sendl.-O&apos;sch-heim" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.gpsies.com/GPX/1/0 http://www.gpsies.com/gpsies.xsd">'; |
| 45 | 45 | $gpx .= '<trk>'; |
| 46 | 46 | $gpx .= '<trkseg>'; |
| 47 | - foreach($spotter_history_array as $spotter_data) { |
|
| 48 | - $gpx .= '<trkpt lat="'.sprintf("%.8f",$spotter_data['latitude']).'" lon="'.sprintf("%.8f",$spotter_data['longitude']).'">'; |
|
| 49 | - if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>'; |
|
| 50 | - $gpx .= '<time>'.date("Y-m-d\TH:i:s\Z",strtotime($spotter_data['date'])).'</time>'; |
|
| 47 | + foreach ($spotter_history_array as $spotter_data) { |
|
| 48 | + $gpx .= '<trkpt lat="'.sprintf("%.8f", $spotter_data['latitude']).'" lon="'.sprintf("%.8f", $spotter_data['longitude']).'">'; |
|
| 49 | + if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f", $spotter_data['altitude']).'</ele>'; |
|
| 50 | + $gpx .= '<time>'.date("Y-m-d\TH:i:s\Z", strtotime($spotter_data['date'])).'</time>'; |
|
| 51 | 51 | $gpx .= '</trkpt>'; |
| 52 | 52 | } |
| 53 | 53 | $gpx .= '</trkseg>'; |
@@ -84,18 +84,18 @@ discard block |
||
| 84 | 84 | global $globalMapMatchingMaxPts, $globalTrackMatchingAppKey, $globalTrackMatchingAppId; |
| 85 | 85 | if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100; |
| 86 | 86 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
| 87 | - if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
| 87 | + if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
| 88 | 88 | $data = $this->create_gpx($spotter_history_array); |
| 89 | 89 | $url = 'https://test.roadmatching.com/rest/mapmatch/?app_id='.$globalTrackMatchingAppId.'&app_key='.$globalTrackMatchingAppKey.'&output.waypoints=true'; |
| 90 | 90 | $Common = new Common(); |
| 91 | - $matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml','Accept: application/json')); |
|
| 92 | - $matching = json_decode($matching,true); |
|
| 91 | + $matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml', 'Accept: application/json')); |
|
| 92 | + $matching = json_decode($matching, true); |
|
| 93 | 93 | if (isset($matching['diary']['entries'][0]['route']['links'])) { |
| 94 | 94 | $spotter_history_array = array(); |
| 95 | 95 | foreach ($matching['diary']['entries'][0]['route']['links'] as $match) { |
| 96 | 96 | if (isset($match['wpts'])) { |
| 97 | 97 | foreach ($match['wpts'] as $coord) { |
| 98 | - $spotter_history_array[] = array('longitude' => $coord['x'],'latitude' => $coord['y']); |
|
| 98 | + $spotter_history_array[] = array('longitude' => $coord['x'], 'latitude' => $coord['y']); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -115,22 +115,22 @@ discard block |
||
| 115 | 115 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
| 116 | 116 | $spotter_history_initial_array = array(); |
| 117 | 117 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
| 118 | - $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
| 119 | - $spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts); |
|
| 118 | + $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
| 119 | + $spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts); |
|
| 120 | 120 | } |
| 121 | 121 | $data = $this->create_gpx($spotter_history_array); |
| 122 | 122 | $url = 'https://graphhopper.com/api/1/match?vehicle=car&points_encoded=0&instructions=false&key='.$globalGraphHopperKey; |
| 123 | 123 | $Common = new Common(); |
| 124 | - $matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml')); |
|
| 125 | - $matching = json_decode($matching,true); |
|
| 124 | + $matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml')); |
|
| 125 | + $matching = json_decode($matching, true); |
|
| 126 | 126 | if (isset($matching['paths'][0]['points']['coordinates'])) { |
| 127 | 127 | $spotter_history_array = array(); |
| 128 | 128 | foreach ($matching['paths'][0]['points']['coordinates'] as $match) { |
| 129 | 129 | $coord = $match; |
| 130 | - $spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]); |
|
| 130 | + $spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | - $spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array); |
|
| 133 | + $spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array); |
|
| 134 | 134 | $spotter_history_array[0]['mapmatching_engine'] = 'graphhopper'; |
| 135 | 135 | return $spotter_history_array; |
| 136 | 136 | } |
@@ -146,23 +146,23 @@ discard block |
||
| 146 | 146 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
| 147 | 147 | $spotter_history_initial_array = array(); |
| 148 | 148 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
| 149 | - $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
| 150 | - $spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts); |
|
| 149 | + $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
| 150 | + $spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts); |
|
| 151 | 151 | } |
| 152 | 152 | $data = $this->create_gpx($spotter_history_array); |
| 153 | 153 | $url = 'https://mapmatching.flightairmap.com/api/1/match?vehicle=car&points_encoded=0&instructions=false'; |
| 154 | 154 | //$url = 'https://mapmatching.flightairmap.com/api/1/match?vehicle=car&points_encoded=0'; |
| 155 | 155 | $Common = new Common(); |
| 156 | - $matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml')); |
|
| 157 | - $matching = json_decode($matching,true); |
|
| 156 | + $matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml')); |
|
| 157 | + $matching = json_decode($matching, true); |
|
| 158 | 158 | if (isset($matching['paths'][0]['points']['coordinates'])) { |
| 159 | 159 | $spotter_history_array = array(); |
| 160 | 160 | foreach ($matching['paths'][0]['points']['coordinates'] as $match) { |
| 161 | 161 | $coord = $match; |
| 162 | - $spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]); |
|
| 162 | + $spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | - $spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array); |
|
| 165 | + $spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array); |
|
| 166 | 166 | $spotter_history_array[0]['mapmatching_engine'] = 'fam'; |
| 167 | 167 | return $spotter_history_array; |
| 168 | 168 | } |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
| 179 | 179 | $spotter_history_initial_array = array(); |
| 180 | 180 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
| 181 | - $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
| 182 | - $spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts); |
|
| 181 | + $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
| 182 | + $spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts); |
|
| 183 | 183 | } |
| 184 | 184 | $coord = ''; |
| 185 | 185 | $ts = ''; |
@@ -195,15 +195,15 @@ discard block |
||
| 195 | 195 | $url = 'https://router.project-osrm.org/match/v1/driving/'.$coord.'?timestamps='.$ts.'&overview=full&geometries=geojson&tidy=true&gaps=ignore'; |
| 196 | 196 | $Common = new Common(); |
| 197 | 197 | $matching = $Common->getData($url); |
| 198 | - $matching = json_decode($matching,true); |
|
| 198 | + $matching = json_decode($matching, true); |
|
| 199 | 199 | if (isset($matching['matchings'][0]['geometry']['coordinates'])) { |
| 200 | 200 | $spotter_history_array = array(); |
| 201 | 201 | foreach ($matching['matchings'][0]['geometry']['coordinates'] as $match) { |
| 202 | 202 | $coord = $match; |
| 203 | - $spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]); |
|
| 203 | + $spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]); |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | - $spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array); |
|
| 206 | + $spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array); |
|
| 207 | 207 | $spotter_history_array[0]['mapmatching_engine'] = 'osmr'; |
| 208 | 208 | return $spotter_history_array; |
| 209 | 209 | } |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
| 220 | 220 | $spotter_history_initial_array = array(); |
| 221 | 221 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
| 222 | - $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
| 223 | - $spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts); |
|
| 222 | + $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
| 223 | + $spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts); |
|
| 224 | 224 | } |
| 225 | 225 | $coord = ''; |
| 226 | 226 | $ts = ''; |
@@ -237,15 +237,15 @@ discard block |
||
| 237 | 237 | $url = 'https://api.mapbox.com/matching/v5/mapbox/driving/'.$coord.'?access_token='.$globalMapboxToken.'×tamps='.$ts.'&overview=full&tidy=true&geometries=geojson'; |
| 238 | 238 | $Common = new Common(); |
| 239 | 239 | $matching = $Common->getData($url); |
| 240 | - $matching = json_decode($matching,true); |
|
| 240 | + $matching = json_decode($matching, true); |
|
| 241 | 241 | if (isset($matching['matchings'][0]['geometry']['coordinates'])) { |
| 242 | 242 | $spotter_history_array = array(); |
| 243 | 243 | foreach ($matching['matchings'][0]['geometry']['coordinates'] as $match) { |
| 244 | 244 | $coord = $match; |
| 245 | - $spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]); |
|
| 245 | + $spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]); |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | - $spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array); |
|
| 248 | + $spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array); |
|
| 249 | 249 | $spotter_history_array[0]['mapmatching_engine'] = 'mapbox'; |
| 250 | 250 | return $spotter_history_array; |
| 251 | 251 | } |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | require_once('header.php'); |
| 8 | 8 | |
| 9 | 9 | //calculuation for the pagination |
| 10 | -if(!isset($_GET['limit'])) |
|
| 10 | +if (!isset($_GET['limit'])) |
|
| 11 | 11 | { |
| 12 | 12 | $limit_start = 0; |
| 13 | 13 | $limit_end = 28; |
| 14 | 14 | $absolute_difference = 28; |
| 15 | 15 | } else { |
| 16 | 16 | $limit_explode = explode(",", $_GET['limit']); |
| 17 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 18 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 17 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 18 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 19 | 19 | if (!ctype_digit(strval($limit_start)) || !ctype_digit(strval($limit_end))) { |
| 20 | 20 | $limit_start = 0; |
| 21 | 21 | $limit_end = 25; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | print '<div class="column">'; |
| 40 | 40 | print '<p>'._("The view below shows all aircraft that have been selected to have some sort of special characteristic about them, such as unique liveries, destinations etc.").'</p>'; |
| 41 | 41 | |
| 42 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 42 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 43 | 43 | if ($sort != '') { |
| 44 | 44 | $spotter_array = $Spotter->getSpotterDataByHighlight($limit_start.",".$absolute_difference, $sort); |
| 45 | 45 | } else { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | if (!empty($spotter_array)) |
| 49 | 49 | { |
| 50 | 50 | print '<div class="dispay-view">'; |
| 51 | - foreach($spotter_array as $spotter_item) |
|
| 51 | + foreach ($spotter_array as $spotter_item) |
|
| 52 | 52 | { |
| 53 | 53 | if (isset($spotter_item['image']) && $spotter_item['image'] != "") |
| 54 | 54 | { |
@@ -8,13 +8,13 @@ discard block |
||
| 8 | 8 | die(); |
| 9 | 9 | } |
| 10 | 10 | $Spotter = new Spotter(); |
| 11 | -$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)))); |
|
| 12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 13 | -$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort); |
|
| 11 | +$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)))); |
|
| 12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 13 | +$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort); |
|
| 14 | 14 | |
| 15 | 15 | if (!empty($spotter_array)) |
| 16 | 16 | { |
| 17 | - $title = sprintf(_("Most Common Aircraft from %s"),$manufacturer); |
|
| 17 | + $title = sprintf(_("Most Common Aircraft from %s"), $manufacturer); |
|
| 18 | 18 | |
| 19 | 19 | require_once('header.php'); |
| 20 | 20 | print '<div class="select-item">'; |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | $Stats = new Stats(); |
| 24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
| 25 | 25 | if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
| 26 | - foreach($all_manufacturers as $all_manufacturer) |
|
| 26 | + foreach ($all_manufacturers as $all_manufacturer) |
|
| 27 | 27 | { |
| 28 | - if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
|
| 28 | + if ($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
|
| 29 | 29 | { |
| 30 | 30 | print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>'; |
| 31 | 31 | } else { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | include('manufacturer-sub-menu.php'); |
| 45 | 45 | print '<div class="column">'; |
| 46 | 46 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
| 47 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights from <strong>%s</strong>."),$manufacturer).'</p>'; |
|
| 47 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights from <strong>%s</strong>."), $manufacturer).'</p>'; |
|
| 48 | 48 | |
| 49 | 49 | $aircraft_array = $Spotter->countAllAircraftTypesByManufacturer($manufacturer); |
| 50 | 50 | if (!empty($aircraft_array)) |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | print '</thead>'; |
| 60 | 60 | print '<tbody>'; |
| 61 | 61 | $i = 1; |
| 62 | - foreach($aircraft_array as $aircraft_item) |
|
| 62 | + foreach ($aircraft_array as $aircraft_item) |
|
| 63 | 63 | { |
| 64 | 64 | print '<tr>'; |
| 65 | 65 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,13 +5,13 @@ discard block |
||
| 5 | 5 | require_once('require/class.Language.php'); |
| 6 | 6 | require_once('require/class.SpotterArchive.php'); |
| 7 | 7 | |
| 8 | -if (!isset($_GET['pilot'])){ |
|
| 8 | +if (!isset($_GET['pilot'])) { |
|
| 9 | 9 | header('Location: '.$globalURL.'/'); |
| 10 | 10 | } else { |
| 11 | 11 | $Spotter = new Spotter(); |
| 12 | 12 | $SpotterArchive = new SpotterArchive(); |
| 13 | 13 | //calculuation for the pagination |
| 14 | - if(!isset($_GET['limit'])) |
|
| 14 | + if (!isset($_GET['limit'])) |
|
| 15 | 15 | { |
| 16 | 16 | $limit_start = 0; |
| 17 | 17 | $limit_end = 25; |
@@ -32,29 +32,29 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $page_url = $globalURL.'/pilot/'.$_GET['pilot']; |
| 34 | 34 | |
| 35 | - $pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING); |
|
| 36 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 37 | - $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 38 | - $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 35 | + $pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING); |
|
| 36 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 37 | + $year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 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 != '') $filter = array_merge($filter, array('year' => $year)); |
|
| 41 | + if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
| 42 | 42 | if ($sort != '') |
| 43 | 43 | { |
| 44 | - $spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter); |
|
| 44 | + $spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter); |
|
| 45 | 45 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
| 46 | - $spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter); |
|
| 46 | + $spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter); |
|
| 47 | 47 | } |
| 48 | 48 | } else { |
| 49 | - $spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter); |
|
| 49 | + $spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter); |
|
| 50 | 50 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
| 51 | - $spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter); |
|
| 51 | + $spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter); |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if (!empty($spotter_array)) |
| 56 | 56 | { |
| 57 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']); |
|
| 57 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['pilot_name']); |
|
| 58 | 58 | $ident = $spotter_array[0]['ident']; |
| 59 | 59 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
| 60 | 60 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -115,23 +115,23 @@ discard block |
||
| 115 | 115 | $Stats = new Stats(); |
| 116 | 116 | $flights = $Stats->getStatsPilot($pilot); |
| 117 | 117 | } else $flights = 0; |
| 118 | - if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter); |
|
| 118 | + if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot, $filter); |
|
| 119 | 119 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
| 120 | - $aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter)); |
|
| 120 | + $aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot, $filter)); |
|
| 121 | 121 | print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>'; |
| 122 | - $aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot,$filter)); |
|
| 122 | + $aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot, $filter)); |
|
| 123 | 123 | print '<div><span class="label">'._("Aircraft").'</span>'.$aircraft_registration.'</div>'; |
| 124 | - $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot,$filter)); |
|
| 124 | + $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot, $filter)); |
|
| 125 | 125 | print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>'; |
| 126 | - $airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter)); |
|
| 126 | + $airlines = count($Spotter->countAllAirlinesByPilot($pilot, $filter)); |
|
| 127 | 127 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
| 128 | - $duration = $Spotter->getFlightDurationByPilot($pilot,$filter); |
|
| 128 | + $duration = $Spotter->getFlightDurationByPilot($pilot, $filter); |
|
| 129 | 129 | if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
| 130 | 130 | print '</div>'; |
| 131 | 131 | |
| 132 | 132 | include('pilot-sub-menu.php'); |
| 133 | 133 | print '<div class="table column">'; |
| 134 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>'; |
|
| 134 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>'; |
|
| 135 | 135 | |
| 136 | 136 | include('table-output.php'); |
| 137 | 137 | print '<div class="pagination">'; |