@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | require_once(dirname(__FILE__).'/class.Source.php'); |
8 | 8 | |
9 | 9 | class TrackerImport { |
10 | - private $all_tracked = array(); |
|
11 | - private $last_delete_hourly = 0; |
|
12 | - private $last_delete = 0; |
|
13 | - private $stats = array(); |
|
14 | - private $tmd = 0; |
|
15 | - private $source_location = array(); |
|
16 | - public $db = null; |
|
17 | - public $nb = 0; |
|
10 | + private $all_tracked = array(); |
|
11 | + private $last_delete_hourly = 0; |
|
12 | + private $last_delete = 0; |
|
13 | + private $stats = array(); |
|
14 | + private $tmd = 0; |
|
15 | + private $source_location = array(); |
|
16 | + public $db = null; |
|
17 | + public $nb = 0; |
|
18 | 18 | |
19 | - public function __construct($dbc = null) { |
|
19 | + public function __construct($dbc = null) { |
|
20 | 20 | global $globalBeta; |
21 | 21 | $Connection = new Connection($dbc); |
22 | 22 | $this->db = $Connection->db(); |
@@ -38,50 +38,50 @@ discard block |
||
38 | 38 | } |
39 | 39 | } |
40 | 40 | */ |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | - public function checkAll() { |
|
43 | + public function checkAll() { |
|
44 | 44 | global $globalDebug; |
45 | 45 | if ($globalDebug) echo "Update last seen tracked data...\n"; |
46 | 46 | foreach ($this->all_tracked as $key => $flight) { |
47 | - if (isset($this->all_tracked[$key]['id'])) { |
|
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 | - $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']); |
|
51 | - } |
|
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']); |
|
51 | + } |
|
52 | + } |
|
52 | 53 | } |
53 | - } |
|
54 | 54 | |
55 | - public function del() { |
|
55 | + public function del() { |
|
56 | 56 | global $globalDebug; |
57 | 57 | // Delete old infos |
58 | 58 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
59 | 59 | foreach ($this->all_tracked as $key => $flight) { |
60 | - if (isset($flight['lastupdate'])) { |
|
61 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
62 | - if (isset($this->all_tracked[$key]['id'])) { |
|
63 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
60 | + if (isset($flight['lastupdate'])) { |
|
61 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
62 | + if (isset($this->all_tracked[$key]['id'])) { |
|
63 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
64 | 64 | /* |
65 | 65 | $TrackerLive = new TrackerLive(); |
66 | 66 | $TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); |
67 | 67 | $TrackerLive->db = null; |
68 | 68 | */ |
69 | - //$real_arrival = $this->arrival($key); |
|
70 | - $Tracker = new Tracker($this->db); |
|
71 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
69 | + //$real_arrival = $this->arrival($key); |
|
70 | + $Tracker = new Tracker($this->db); |
|
71 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
72 | 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 |
76 | 76 | // $Tracker->db = null; |
77 | - } |
|
78 | - unset($this->all_tracked[$key]); |
|
79 | - } |
|
80 | - } |
|
81 | - } |
|
82 | - } |
|
77 | + } |
|
78 | + unset($this->all_tracked[$key]); |
|
79 | + } |
|
80 | + } |
|
81 | + } |
|
82 | + } |
|
83 | 83 | |
84 | - public function add($line) { |
|
84 | + public function add($line) { |
|
85 | 85 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; |
86 | 86 | if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChangeTracker = '0.015'; |
87 | 87 | date_default_timezone_set('UTC'); |
@@ -90,47 +90,47 @@ discard block |
||
90 | 90 | |
91 | 91 | // SBS format is CSV format |
92 | 92 | if(is_array($line) && isset($line['ident'])) { |
93 | - //print_r($line); |
|
94 | - if (isset($line['ident'])) { |
|
93 | + //print_r($line); |
|
94 | + if (isset($line['ident'])) { |
|
95 | 95 | |
96 | 96 | |
97 | 97 | // Increment message number |
98 | 98 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
99 | - $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']; |
|
103 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
104 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
105 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
106 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
99 | + $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']; |
|
103 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
104 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
105 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
106 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
110 | 110 | $Common = new Common(); |
111 | - if (!isset($line['id'])) $id = trim($line['ident']); |
|
112 | - else $id = trim($line['id']); |
|
111 | + if (!isset($line['id'])) $id = trim($line['ident']); |
|
112 | + else $id = trim($line['id']); |
|
113 | 113 | |
114 | 114 | if (!isset($this->all_tracked[$id])) { |
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())); |
|
119 | - if (!isset($line['id'])) { |
|
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())); |
|
119 | + if (!isset($line['id'])) { |
|
120 | 120 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
121 | 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 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
122 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
123 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
127 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
|
127 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
|
128 | 128 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
129 | - } else { |
|
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 | 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 ''; |
@@ -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']))); |
|
151 | - if ($this->all_tracked[$id]['addedTracker'] == 1) { |
|
150 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
151 | + if ($this->all_tracked[$id]['addedTracker'] == 1) { |
|
152 | 152 | $timeelapsed = microtime(true); |
153 | - $Tracker = new Tracker($this->db); |
|
154 | - $fromsource = NULL; |
|
155 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
153 | + $Tracker = new Tracker($this->db); |
|
154 | + $fromsource = NULL; |
|
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 | 158 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
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'])); |
|
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'])); |
|
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'); |
|
168 | - if ($distance > 100 && $distance < 10000) { |
|
167 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
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 | 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 | - 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); |
|
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')))) { |
|
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']); |
|
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')))) { |
|
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; |
@@ -192,30 +192,30 @@ discard block |
||
192 | 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 | + } |
|
196 | 196 | } |
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 | 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 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
202 | - $dataFound = true; |
|
203 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
201 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
202 | + $dataFound = true; |
|
203 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
204 | 204 | } |
205 | 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 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
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 | 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 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
212 | - $dataFound = true; |
|
213 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
211 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
212 | + $dataFound = true; |
|
213 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
214 | 214 | } |
215 | 215 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
216 | 216 | } |
217 | 217 | |
218 | - } else if ($globalDebug && $timediff > 20) { |
|
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"; |
@@ -223,131 +223,131 @@ discard block |
||
223 | 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 | - 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'])); |
|
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'])); |
|
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'])); |
|
240 | - //$dataFound = true; |
|
239 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
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'])); |
|
244 | - //$dataFound = true; |
|
243 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
244 | + //$dataFound = true; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | if (isset($line['altitude']) && $line['altitude'] != '') { |
248 | - //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
248 | + //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
249 | 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 | 250 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
251 | 251 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
252 | 252 | //$dataFound = true; |
253 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
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)); |
|
264 | - //$dataFound = 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 | + //$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; |
|
269 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
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 | + 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; |
272 | 272 | |
273 | 273 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
274 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
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'])) { |
|
277 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
274 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
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'])) { |
|
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 | - $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
|
283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
282 | + $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
|
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 | - $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"; |
|
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"; |
|
287 | 287 | } else $recent_ident = ''; |
288 | 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 | - } else { |
|
292 | + } else { |
|
293 | 293 | $recent_ident = ''; |
294 | 294 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
295 | - } |
|
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 == "") |
|
298 | - { |
|
295 | + } |
|
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 == "") |
|
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 | - $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'))); |
|
303 | - $timeelapsed = microtime(true); |
|
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']); |
|
306 | - $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"; |
|
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'))); |
|
303 | + $timeelapsed = microtime(true); |
|
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']); |
|
306 | + $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"; |
|
309 | 309 | |
310 | 310 | |
311 | - // Add source stat in DB |
|
312 | - $Stats = new Stats($this->db); |
|
313 | - if (!empty($this->stats)) { |
|
311 | + // Add source stat in DB |
|
312 | + $Stats = new Stats($this->db); |
|
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) { |
|
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); |
|
320 | - if (isset($sourced['msg'])) { |
|
321 | - if (time() - $sourced['msg']['date'] > 10) { |
|
322 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
323 | - echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
324 | - unset($this->stats[$date][$source]['msg']); |
|
325 | - } |
|
326 | - } |
|
327 | - } |
|
328 | - if ($date != date('Y-m-d')) { |
|
329 | - unset($this->stats[$date]); |
|
330 | - } |
|
331 | - } |
|
332 | - if ($globalDebug) echo 'Done'."\n"; |
|
315 | + foreach($this->stats as $date => $data) { |
|
316 | + foreach($data as $source => $sourced) { |
|
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); |
|
320 | + if (isset($sourced['msg'])) { |
|
321 | + if (time() - $sourced['msg']['date'] > 10) { |
|
322 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
323 | + echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
324 | + unset($this->stats[$date][$source]['msg']); |
|
325 | + } |
|
326 | + } |
|
327 | + } |
|
328 | + if ($date != date('Y-m-d')) { |
|
329 | + unset($this->stats[$date]); |
|
330 | + } |
|
331 | + } |
|
332 | + if ($globalDebug) echo 'Done'."\n"; |
|
333 | 333 | |
334 | - } |
|
335 | - $Stats->db = null; |
|
334 | + } |
|
335 | + $Stats->db = null; |
|
336 | 336 | |
337 | - $this->del(); |
|
337 | + $this->del(); |
|
338 | 338 | //$ignoreImport = false; |
339 | 339 | $this->all_tracked[$id]['addedTracker'] = 1; |
340 | 340 | //print_r($this->all_tracked[$id]); |
341 | 341 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
342 | - if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
343 | - //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
344 | - $TrackerLive = new TrackerLive($this->db); |
|
345 | - $TrackerLive->deleteLiveTrackerData(); |
|
346 | - $TrackerLive->db=null; |
|
347 | - if ($globalDebug) echo " Done\n"; |
|
348 | - $this->last_delete = time(); |
|
342 | + if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
343 | + //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
344 | + $TrackerLive = new TrackerLive($this->db); |
|
345 | + $TrackerLive->deleteLiveTrackerData(); |
|
346 | + $TrackerLive->db=null; |
|
347 | + if ($globalDebug) echo " Done\n"; |
|
348 | + $this->last_delete = time(); |
|
349 | 349 | } |
350 | - } else { |
|
350 | + } else { |
|
351 | 351 | $this->all_tracked[$id]['id'] = $recent_ident; |
352 | 352 | $this->all_tracked[$id]['addedTracker'] = 1; |
353 | 353 | if (isset($globalDaemon) && !$globalDaemon) { |
@@ -356,16 +356,16 @@ discard block |
||
356 | 356 | $Tracker->db = null; |
357 | 357 | } |
358 | 358 | |
359 | - } |
|
359 | + } |
|
360 | 360 | } |
361 | - } |
|
362 | - //adds the spotter LIVE data |
|
363 | - if ($globalDebug) { |
|
361 | + } |
|
362 | + //adds the spotter LIVE data |
|
363 | + if ($globalDebug) { |
|
364 | 364 | echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Altitude : '.$this->all_tracked[$id]['altitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
365 | - } |
|
366 | - $ignoreImport = false; |
|
365 | + } |
|
366 | + $ignoreImport = false; |
|
367 | 367 | |
368 | - if (!$ignoreImport) { |
|
368 | + if (!$ignoreImport) { |
|
369 | 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); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | if ($stats_heading == 16) $stats_heading = 0; |
404 | 404 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
405 | 405 | for ($i=0;$i<=15;$i++) { |
406 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
406 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
407 | 407 | } |
408 | 408 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
409 | 409 | } else { |
@@ -416,11 +416,11 @@ discard block |
||
416 | 416 | //var_dump($this->stats); |
417 | 417 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
418 | 418 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
419 | - end($this->stats[$current_date][$source]['hist']); |
|
420 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
419 | + end($this->stats[$current_date][$source]['hist']); |
|
420 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
421 | 421 | } else $mini = 0; |
422 | 422 | for ($i=$mini;$i<=$distance;$i+=10) { |
423 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
423 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
424 | 424 | } |
425 | 425 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
426 | 426 | } else { |
@@ -436,22 +436,22 @@ discard block |
||
436 | 436 | |
437 | 437 | |
438 | 438 | 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..."; |
|
440 | - $TrackerLive = new TrackerLive($this->db); |
|
441 | - $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
442 | - $TrackerLive->db = null; |
|
443 | - //TrackerLive->deleteLiveTrackerData(); |
|
444 | - if ($globalDebug) echo " Done\n"; |
|
445 | - $this->last_delete_hourly = time(); |
|
439 | + if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
440 | + $TrackerLive = new TrackerLive($this->db); |
|
441 | + $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
442 | + $TrackerLive->db = null; |
|
443 | + //TrackerLive->deleteLiveTrackerData(); |
|
444 | + if ($globalDebug) echo " Done\n"; |
|
445 | + $this->last_delete_hourly = time(); |
|
446 | 446 | } |
447 | 447 | |
448 | - } |
|
449 | - //$ignoreImport = false; |
|
448 | + } |
|
449 | + //$ignoreImport = false; |
|
450 | 450 | } |
451 | 451 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
452 | 452 | if ($send) return $this->all_tracked[$id]; |
453 | - } |
|
453 | + } |
|
454 | + } |
|
454 | 455 | } |
455 | - } |
|
456 | 456 | } |
457 | 457 | ?> |
@@ -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 |
@@ -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 | } |
@@ -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 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | // When button "Remove all filters" is clicked |
39 | 39 | if (isset($_POST['removefilters'])) { |
40 | 40 | $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
41 | - return strpos($key,'filter_') === 0; |
|
41 | + return strpos($key,'filter_') === 0; |
|
42 | 42 | }); |
43 | 43 | foreach ($allfilters as $filt) { |
44 | 44 | unset($_COOKIE[$filt]); |
@@ -188,17 +188,17 @@ discard block |
||
188 | 188 | } |
189 | 189 | ?> |
190 | 190 | <?php |
191 | - if (isset($_POST['archive'])) { |
|
191 | + if (isset($_POST['archive'])) { |
|
192 | 192 | ?> |
193 | 193 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
194 | 194 | <?php |
195 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
195 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
196 | 196 | ?> |
197 | 197 | |
198 | 198 | <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script> |
199 | 199 | <?php |
200 | - } |
|
201 | - } else { |
|
200 | + } |
|
201 | + } else { |
|
202 | 202 | ?> |
203 | 203 | <?php |
204 | 204 | /* if (isset($globalBeta) && $globalBeta) { |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | ?> |
212 | 212 | <?php |
213 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
213 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
214 | 214 | ?> |
215 | 215 | <?php |
216 | 216 | // if (isset($globalBeta) && $globalBeta) { |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | <script src="<?php print $globalURL; ?>/js/map-satellite.2d.js.php?<?php print time(); ?>"></script> |
242 | 242 | <?php |
243 | 243 | } |
244 | - } |
|
244 | + } |
|
245 | 245 | ?> |
246 | 246 | <?php |
247 | 247 | // } |
248 | 248 | ?> |
249 | 249 | <?php |
250 | - } |
|
250 | + } |
|
251 | 251 | } |
252 | 252 | ?> |
253 | 253 | <?php |
@@ -424,34 +424,34 @@ discard block |
||
424 | 424 | |
425 | 425 | <ul class="nav navbar-nav"> |
426 | 426 | <?php |
427 | - if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) { |
|
427 | + if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) { |
|
428 | 428 | ?> |
429 | 429 | <li><a href="<?php print $globalURL; ?>/news"><?php echo _("News"); ?></a></li> |
430 | 430 | <?php |
431 | - } |
|
431 | + } |
|
432 | 432 | ?> |
433 | 433 | |
434 | 434 | <?php |
435 | - $sub = false; |
|
436 | - if ( |
|
435 | + $sub = false; |
|
436 | + if ( |
|
437 | 437 | ( |
438 | - (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
438 | + (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
439 | 439 | ) || |
440 | 440 | ( |
441 | - isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
441 | + isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
442 | 442 | ) || |
443 | 443 | ( |
444 | - isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
444 | + isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
445 | 445 | ) || |
446 | 446 | ( |
447 | - isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE)) |
|
447 | + isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE)) |
|
448 | 448 | ) |
449 | - ) { |
|
449 | + ) { |
|
450 | 450 | $sub = true; |
451 | - } |
|
451 | + } |
|
452 | 452 | ?> |
453 | 453 | <?php |
454 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
454 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
455 | 455 | ?> |
456 | 456 | <li class="dropdown"> |
457 | 457 | <?php |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | <ul class="dropdown-menu multi-level"> |
463 | 463 | <li class="dropdown-submenu"> |
464 | 464 | <?php |
465 | - } |
|
465 | + } |
|
466 | 466 | ?> |
467 | 467 | <?php |
468 | 468 | if (isset($globalNewsFeeds['aircraft']) && !empty($globalNewsFeeds['aircraft'])) { |
@@ -477,25 +477,25 @@ discard block |
||
477 | 477 | <ul class="dropdown-menu"> |
478 | 478 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li> |
479 | 479 | <?php |
480 | - if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
480 | + if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
481 | 481 | ?> |
482 | 482 | <li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li> |
483 | 483 | <?php |
484 | - } |
|
484 | + } |
|
485 | 485 | ?> |
486 | 486 | <li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li> |
487 | 487 | <?php |
488 | - if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
488 | + if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
489 | 489 | ?> |
490 | 490 | <li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li> |
491 | 491 | <?php |
492 | - } |
|
493 | - if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
492 | + } |
|
493 | + if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
494 | 494 | |
495 | 495 | ?> |
496 | 496 | <li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li> |
497 | 497 | <?php |
498 | - } |
|
498 | + } |
|
499 | 499 | ?> |
500 | 500 | <li><hr /></li> |
501 | 501 | <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li> |
@@ -503,43 +503,43 @@ discard block |
||
503 | 503 | <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li> |
504 | 504 | <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li> |
505 | 505 | <?php |
506 | - if ($globalACARS) { |
|
507 | - if (isset($globalDemo) && $globalDemo) { |
|
508 | - ?> |
|
506 | + if ($globalACARS) { |
|
507 | + if (isset($globalDemo) && $globalDemo) { |
|
508 | + ?> |
|
509 | 509 | <li><hr /></li> |
510 | 510 | <li><i><?php echo _('ACARS data not available publicly'); ?></i></li> |
511 | 511 | <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li> |
512 | 512 | <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li> |
513 | 513 | <?php |
514 | - } else { |
|
515 | - ?> |
|
514 | + } else { |
|
515 | + ?> |
|
516 | 516 | <li><hr /></li> |
517 | 517 | <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li> |
518 | 518 | <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li> |
519 | 519 | <?php |
520 | - } |
|
521 | - } |
|
522 | - ?> |
|
520 | + } |
|
521 | + } |
|
522 | + ?> |
|
523 | 523 | <?php |
524 | - if (isset($globalAccidents) && $globalAccidents) { |
|
525 | - ?> |
|
524 | + if (isset($globalAccidents) && $globalAccidents) { |
|
525 | + ?> |
|
526 | 526 | <li><hr /></li> |
527 | 527 | <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li> |
528 | 528 | <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li> |
529 | 529 | <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li> |
530 | 530 | <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li> |
531 | 531 | <?php |
532 | - } |
|
533 | - ?> |
|
532 | + } |
|
533 | + ?> |
|
534 | 534 | <li><hr /></li> |
535 | 535 | <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li> |
536 | 536 | <?php |
537 | 537 | if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) { |
538 | - ?> |
|
538 | + ?> |
|
539 | 539 | <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li> |
540 | 540 | <?php |
541 | 541 | } |
542 | - ?> |
|
542 | + ?> |
|
543 | 543 | </ul> |
544 | 544 | </li> |
545 | 545 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
@@ -566,14 +566,14 @@ discard block |
||
566 | 566 | </ul> |
567 | 567 | <?php |
568 | 568 | } |
569 | - } |
|
569 | + } |
|
570 | 570 | ?> |
571 | 571 | <?php |
572 | - if (isset($globalMarine) && $globalMarine) { |
|
572 | + if (isset($globalMarine) && $globalMarine) { |
|
573 | 573 | ?> |
574 | 574 | <li class="dropdown"> |
575 | 575 | <?php |
576 | - if ($sub) { |
|
576 | + if ($sub) { |
|
577 | 577 | ?> |
578 | 578 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Marines"); ?> <b class="caret"></b></a> |
579 | 579 | <ul class="dropdown-menu multi-level"> |
@@ -607,14 +607,14 @@ discard block |
||
607 | 607 | } |
608 | 608 | ?> |
609 | 609 | <?php |
610 | - } |
|
610 | + } |
|
611 | 611 | ?> |
612 | 612 | <?php |
613 | - if (isset($globalTracker) && $globalTracker) { |
|
613 | + if (isset($globalTracker) && $globalTracker) { |
|
614 | 614 | ?> |
615 | 615 | <li class="dropdown"> |
616 | 616 | <?php |
617 | - if ($sub) { |
|
617 | + if ($sub) { |
|
618 | 618 | ?> |
619 | 619 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a> |
620 | 620 | <ul class="dropdown-menu multi-level"> |
@@ -648,14 +648,14 @@ discard block |
||
648 | 648 | } |
649 | 649 | ?> |
650 | 650 | <?php |
651 | - } |
|
651 | + } |
|
652 | 652 | ?> |
653 | 653 | <?php |
654 | - if (isset($globalSatellite) && $globalSatellite) { |
|
654 | + if (isset($globalSatellite) && $globalSatellite) { |
|
655 | 655 | ?> |
656 | 656 | <li class="dropdown"> |
657 | 657 | <?php |
658 | - if ($sub) { |
|
658 | + if ($sub) { |
|
659 | 659 | ?> |
660 | 660 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Satellites"); ?> <b class="caret"></b></a> |
661 | 661 | <ul class="dropdown-menu multi-level"> |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | } |
692 | 692 | ?> |
693 | 693 | <?php |
694 | - } |
|
694 | + } |
|
695 | 695 | ?> |
696 | 696 | |
697 | 697 | <li class="dropdown"> |
@@ -700,12 +700,12 @@ discard block |
||
700 | 700 | <li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li> |
701 | 701 | <li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li> |
702 | 702 | <?php |
703 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
703 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
704 | 704 | ?> |
705 | 705 | <li><hr /></li> |
706 | 706 | <li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li> |
707 | 707 | <?php |
708 | - } |
|
708 | + } |
|
709 | 709 | ?> |
710 | 710 | <?php if (isset($globalContribute) && $globalContribute) { ?> |
711 | 711 | <li><hr /></li> |
@@ -726,14 +726,14 @@ discard block |
||
726 | 726 | <form> |
727 | 727 | <select class="selectpicker" data-width="120px" onchange="language(this);"> |
728 | 728 | <?php |
729 | - $Language = new Language(); |
|
730 | - $alllang = $Language->getLanguages(); |
|
731 | - foreach ($alllang as $key => $lang) { |
|
732 | - print '<option value="'.$key.'"'; |
|
733 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
734 | - print '>'.$lang[0].'</option>'; |
|
735 | - } |
|
736 | - ?> |
|
729 | + $Language = new Language(); |
|
730 | + $alllang = $Language->getLanguages(); |
|
731 | + foreach ($alllang as $key => $lang) { |
|
732 | + print '<option value="'.$key.'"'; |
|
733 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
734 | + print '>'.$lang[0].'</option>'; |
|
735 | + } |
|
736 | + ?> |
|
737 | 737 | </select> |
738 | 738 | </form> |
739 | 739 | </div> |
@@ -765,18 +765,18 @@ discard block |
||
765 | 765 | ?> |
766 | 766 | <div class="top-header clear" role="main"> |
767 | 767 | <?php |
768 | - if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
768 | + if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
769 | 769 | ?> |
770 | 770 | <div id="archive-map"></div> |
771 | 771 | <?php |
772 | - } |
|
772 | + } |
|
773 | 773 | ?> |
774 | 774 | </div> |
775 | 775 | <?php |
776 | 776 | } |
777 | 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"> |
781 | 781 | <div id="map"></div> |
782 | 782 | <link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" /> |
@@ -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,22 +803,22 @@ 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 |
810 | - } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
810 | + } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
811 | 811 | ?> |
812 | 812 | map = L.map('map', { zoomControl:true }); |
813 | 813 | <?php |
814 | - } |
|
814 | + } |
|
815 | 815 | ?> |
816 | 816 | //initialize the layer group for the aircrft markers |
817 | 817 | var layer_data = L.layerGroup(); |
818 | 818 | |
819 | 819 | //a few title layers |
820 | 820 | <?php |
821 | - if ($globalMapProvider == 'Mapbox') { |
|
821 | + if ($globalMapProvider == 'Mapbox') { |
|
822 | 822 | ?> |
823 | 823 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
824 | 824 | maxZoom: 18, |
@@ -829,14 +829,14 @@ discard block |
||
829 | 829 | token : '<?php print $globalMapboxToken; ?>' |
830 | 830 | }).addTo(map); |
831 | 831 | <?php |
832 | - } elseif ($globalMapProvider == 'Mapbox-GL') { |
|
832 | + } elseif ($globalMapProvider == 'Mapbox-GL') { |
|
833 | 833 | ?> |
834 | 834 | L.mapboxGL({ |
835 | 835 | accessToken: '<?php print $globalMapboxToken; ?>', |
836 | 836 | style: 'mapbox://styles/mapbox/bright-v8' |
837 | 837 | }).addTo(map); |
838 | 838 | <?php |
839 | - } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
839 | + } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
840 | 840 | ?> |
841 | 841 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { |
842 | 842 | maxZoom: 18, |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>' |
846 | 846 | }).addTo(map); |
847 | 847 | <?php |
848 | - } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
848 | + } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
849 | 849 | ?> |
850 | 850 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', { |
851 | 851 | maxZoom: 18, |
@@ -854,27 +854,27 @@ discard block |
||
854 | 854 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"' |
855 | 855 | }).addTo(map); |
856 | 856 | <?php |
857 | - } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
857 | + } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
858 | 858 | ?> |
859 | 859 | var googleLayer = new L.Google('ROADMAP'); |
860 | 860 | map.addLayer(googleLayer); |
861 | 861 | <?php |
862 | - } elseif ($globalMapProvider == 'Google-Satellite') { |
|
862 | + } elseif ($globalMapProvider == 'Google-Satellite') { |
|
863 | 863 | ?> |
864 | 864 | var googleLayer = new L.Google('SATELLITE'); |
865 | 865 | map.addLayer(googleLayer); |
866 | 866 | <?php |
867 | - } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
867 | + } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
868 | 868 | ?> |
869 | 869 | var googleLayer = new L.Google('HYBRID'); |
870 | 870 | map.addLayer(googleLayer); |
871 | 871 | <?php |
872 | - } elseif ($globalMapProvider == 'Google-Terrain') { |
|
872 | + } elseif ($globalMapProvider == 'Google-Terrain') { |
|
873 | 873 | ?> |
874 | 874 | var googleLayer = new L.Google('Terrain'); |
875 | 875 | map.addLayer(googleLayer); |
876 | 876 | <?php |
877 | - } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
877 | + } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
878 | 878 | $customid = $globalMapProvider; |
879 | 879 | ?> |
880 | 880 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
885 | 885 | }).addTo(map); |
886 | 886 | <?php |
887 | - } elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) { |
|
887 | + } elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) { |
|
888 | 888 | ?> |
889 | 889 | var center = map.getCenter(); |
890 | 890 | map.options.crs = L.CRS.EPSG4326; |
@@ -899,8 +899,8 @@ discard block |
||
899 | 899 | attribution: 'Natural Earth' |
900 | 900 | }).addTo(map); |
901 | 901 | <?php |
902 | - //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
903 | - } else { |
|
902 | + //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
903 | + } else { |
|
904 | 904 | ?> |
905 | 905 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
906 | 906 | maxZoom: 18, |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | }).addTo(map); |
910 | 910 | |
911 | 911 | <?php |
912 | - } |
|
912 | + } |
|
913 | 913 | ?> |
914 | 914 | </script> |
915 | 915 | </div> |
@@ -6,12 +6,19 @@ discard block |
||
6 | 6 | //gets the page file and stores it in a variable |
7 | 7 | $file_path = pathinfo($_SERVER['SCRIPT_NAME']); |
8 | 8 | $current_page = $file_path['filename']; |
9 | -if ($globalTimezone == '') $globalTimezone = 'UTC'; |
|
9 | +if ($globalTimezone == '') { |
|
10 | + $globalTimezone = 'UTC'; |
|
11 | +} |
|
10 | 12 | date_default_timezone_set($globalTimezone); |
11 | -if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType']; |
|
12 | -else $MapType = $globalMapProvider; |
|
13 | +if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') { |
|
14 | + $MapType = $_COOKIE['MapType']; |
|
15 | +} else { |
|
16 | + $MapType = $globalMapProvider; |
|
17 | +} |
|
13 | 18 | |
14 | -if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline'; |
|
19 | +if (isset($globalMapOffline) && $globalMapOffline) { |
|
20 | + $MapType = 'offline'; |
|
21 | +} |
|
15 | 22 | |
16 | 23 | if (isset($_GET['3d'])) { |
17 | 24 | setcookie('MapFormat','3d'); |
@@ -219,7 +226,10 @@ discard block |
||
219 | 226 | <?php |
220 | 227 | // } |
221 | 228 | ?> |
222 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) print '&tsk='.$tsk; ?>"></script> |
|
229 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) { |
|
230 | + print '&tsk='.$tsk; |
|
231 | +} |
|
232 | +?>"></script> |
|
223 | 233 | <?php |
224 | 234 | if (!isset($globalAircraft) || $globalAircraft) { |
225 | 235 | ?> |
@@ -264,7 +274,13 @@ discard block |
||
264 | 274 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
265 | 275 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
266 | 276 | <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> |
|
277 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) { |
|
278 | + print '&latitude='.$latitude; |
|
279 | +} |
|
280 | +?><?php if(isset($longitude)) { |
|
281 | + print '&longitude='.$longitude; |
|
282 | +} |
|
283 | +?>&<?php print time(); ?>"></script> |
|
268 | 284 | <?php |
269 | 285 | if (!isset($type) || $type == 'aircraft') { |
270 | 286 | ?> |
@@ -337,7 +353,13 @@ discard block |
||
337 | 353 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
338 | 354 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
339 | 355 | <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> |
|
356 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) { |
|
357 | + print '&latitude='.$latitude; |
|
358 | +} |
|
359 | +?><?php if(isset($longitude)) { |
|
360 | + print '&longitude='.$longitude; |
|
361 | +} |
|
362 | +?>&<?php print time(); ?>"></script> |
|
341 | 363 | <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
342 | 364 | <?php |
343 | 365 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -418,7 +440,12 @@ discard block |
||
418 | 440 | <span class="icon-bar"></span> |
419 | 441 | </button> |
420 | 442 | <a href="<?php print $globalURL; ?>/search" class="navbar-toggle search"><i class="fa fa-search"></i></a> |
421 | - <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
443 | + <a class="navbar-brand" href="<?php if ($globalURL == '') { |
|
444 | + print '/'; |
|
445 | +} else { |
|
446 | + print $globalURL; |
|
447 | +} |
|
448 | +?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
422 | 449 | </div> |
423 | 450 | <div class="collapse navbar-collapse"> |
424 | 451 | |
@@ -473,7 +500,10 @@ discard block |
||
473 | 500 | } |
474 | 501 | ?> |
475 | 502 | |
476 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
503 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
504 | + echo 'right-'; |
|
505 | +} |
|
506 | +?>caret"></b></a> |
|
477 | 507 | <ul class="dropdown-menu"> |
478 | 508 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li> |
479 | 509 | <?php |
@@ -544,8 +574,14 @@ discard block |
||
544 | 574 | </li> |
545 | 575 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
546 | 576 | <li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li> |
547 | - <li class="dropdown<?php if ($sub) echo '-submenu'; ?>"> |
|
548 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
577 | + <li class="dropdown<?php if ($sub) { |
|
578 | + echo '-submenu'; |
|
579 | +} |
|
580 | +?>"> |
|
581 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) { |
|
582 | + echo 'right-'; |
|
583 | +} |
|
584 | +?>caret"></b></a> |
|
549 | 585 | <ul class="dropdown-menu"> |
550 | 586 | <li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li> |
551 | 587 | <li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li> |
@@ -589,7 +625,10 @@ discard block |
||
589 | 625 | <?php |
590 | 626 | } |
591 | 627 | ?> |
592 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
628 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
629 | + echo 'right-'; |
|
630 | +} |
|
631 | +?>caret"></b></a> |
|
593 | 632 | <ul class="dropdown-menu"> |
594 | 633 | <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li> |
595 | 634 | <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -630,7 +669,10 @@ discard block |
||
630 | 669 | <?php |
631 | 670 | } |
632 | 671 | ?> |
633 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
672 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
673 | + echo 'right-'; |
|
674 | +} |
|
675 | +?>caret"></b></a> |
|
634 | 676 | <ul class="dropdown-menu"> |
635 | 677 | <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li> |
636 | 678 | <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -673,7 +715,10 @@ discard block |
||
673 | 715 | ?> |
674 | 716 | |
675 | 717 | <!-- |
676 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
718 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
719 | + echo 'right-'; |
|
720 | +} |
|
721 | +?>caret"></b></a> |
|
677 | 722 | <ul class="dropdown-menu"> |
678 | 723 | <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li> |
679 | 724 | <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -730,7 +775,9 @@ discard block |
||
730 | 775 | $alllang = $Language->getLanguages(); |
731 | 776 | foreach ($alllang as $key => $lang) { |
732 | 777 | print '<option value="'.$key.'"'; |
733 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
778 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) { |
|
779 | + print ' selected '; |
|
780 | + } |
|
734 | 781 | print '>'.$lang[0].'</option>'; |
735 | 782 | } |
736 | 783 | ?> |
@@ -878,9 +925,24 @@ discard block |
||
878 | 925 | $customid = $globalMapProvider; |
879 | 926 | ?> |
880 | 927 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
881 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
882 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
883 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
928 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
929 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
930 | +} else { |
|
931 | + print '18'; |
|
932 | +} |
|
933 | +?>, |
|
934 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
935 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
936 | +} else { |
|
937 | + print '0'; |
|
938 | +} |
|
939 | +?>, |
|
940 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
941 | + print 'false'; |
|
942 | +} else { |
|
943 | + print 'true'; |
|
944 | +} |
|
945 | +?>, |
|
884 | 946 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
885 | 947 | }).addTo(map); |
886 | 948 | <?php |
@@ -895,7 +957,12 @@ discard block |
||
895 | 957 | maxZoom: 5, |
896 | 958 | tms : true, |
897 | 959 | zindex : 3, |
898 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
960 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
961 | + print 'false'; |
|
962 | +} else { |
|
963 | + print 'true'; |
|
964 | +} |
|
965 | +?>, |
|
899 | 966 | attribution: 'Natural Earth' |
900 | 967 | }).addTo(map); |
901 | 968 | <?php |
@@ -918,4 +985,7 @@ discard block |
||
918 | 985 | |
919 | 986 | ?> |
920 | 987 | |
921 | -<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear"> |
|
988 | +<section class="container main-content <?php if (strtolower($current_page) == 'index') { |
|
989 | + print 'index '; |
|
990 | +} |
|
991 | +?>clear"> |
@@ -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 | } |
@@ -46,7 +46,9 @@ discard block |
||
46 | 46 | $gpx .= '<trkseg>'; |
47 | 47 | foreach($spotter_history_array as $spotter_data) { |
48 | 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>'; |
|
49 | + if (isset($spotter_data['altitude'])) { |
|
50 | + $gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>'; |
|
51 | + } |
|
50 | 52 | $gpx .= '<time>'.date("Y-m-d\TH:i:s\Z",strtotime($spotter_data['date'])).'</time>'; |
51 | 53 | $gpx .= '</trkpt>'; |
52 | 54 | } |
@@ -82,9 +84,15 @@ discard block |
||
82 | 84 | |
83 | 85 | public function TrackMatching($spotter_history_array) { |
84 | 86 | global $globalMapMatchingMaxPts, $globalTrackMatchingAppKey, $globalTrackMatchingAppId; |
85 | - if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100; |
|
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 (!isset($globalMapMatchingMaxPts)) { |
|
88 | + $globalMapMatchingMaxPts = 100; |
|
89 | + } |
|
90 | + if (count($spotter_history_array) < 2) { |
|
91 | + return $spotter_history_array; |
|
92 | + } |
|
93 | + if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
|
94 | + $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
95 | + } |
|
88 | 96 | $data = $this->create_gpx($spotter_history_array); |
89 | 97 | $url = 'https://test.roadmatching.com/rest/mapmatch/?app_id='.$globalTrackMatchingAppId.'&app_key='.$globalTrackMatchingAppKey.'&output.waypoints=true'; |
90 | 98 | $Common = new Common(); |
@@ -111,8 +119,12 @@ discard block |
||
111 | 119 | */ |
112 | 120 | public function GraphHopper($spotter_history_array) { |
113 | 121 | global $globalMapMatchingMaxPts, $globalGraphHopperKey; |
114 | - if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100; |
|
115 | - if (count($spotter_history_array) < 2) return $spotter_history_array; |
|
122 | + if (!isset($globalMapMatchingMaxPts)) { |
|
123 | + $globalMapMatchingMaxPts = 100; |
|
124 | + } |
|
125 | + if (count($spotter_history_array) < 2) { |
|
126 | + return $spotter_history_array; |
|
127 | + } |
|
116 | 128 | $spotter_history_initial_array = array(); |
117 | 129 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
118 | 130 | $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
@@ -142,8 +154,12 @@ discard block |
||
142 | 154 | */ |
143 | 155 | public function FAMMapMatching($spotter_history_array) { |
144 | 156 | global $globalMapMatchingMaxPts, $globalGraphHopperKey; |
145 | - if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100; |
|
146 | - if (count($spotter_history_array) < 2) return $spotter_history_array; |
|
157 | + if (!isset($globalMapMatchingMaxPts)) { |
|
158 | + $globalMapMatchingMaxPts = 100; |
|
159 | + } |
|
160 | + if (count($spotter_history_array) < 2) { |
|
161 | + return $spotter_history_array; |
|
162 | + } |
|
147 | 163 | $spotter_history_initial_array = array(); |
148 | 164 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
149 | 165 | $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
@@ -174,8 +190,12 @@ discard block |
||
174 | 190 | */ |
175 | 191 | public function osmr($spotter_history_array) { |
176 | 192 | global $globalMapMatchingMaxPts; |
177 | - if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 50; |
|
178 | - if (count($spotter_history_array) < 2) return $spotter_history_array; |
|
193 | + if (!isset($globalMapMatchingMaxPts)) { |
|
194 | + $globalMapMatchingMaxPts = 50; |
|
195 | + } |
|
196 | + if (count($spotter_history_array) < 2) { |
|
197 | + return $spotter_history_array; |
|
198 | + } |
|
179 | 199 | $spotter_history_initial_array = array(); |
180 | 200 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
181 | 201 | $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
@@ -185,11 +205,17 @@ discard block |
||
185 | 205 | $ts = ''; |
186 | 206 | $rd = ''; |
187 | 207 | foreach ($spotter_history_array as $spotter_data) { |
188 | - if ($coord != '') $coord .= ';'; |
|
208 | + if ($coord != '') { |
|
209 | + $coord .= ';'; |
|
210 | + } |
|
189 | 211 | $coord .= $spotter_data['longitude'].','.$spotter_data['latitude']; |
190 | - if ($ts != '') $ts .= ';'; |
|
212 | + if ($ts != '') { |
|
213 | + $ts .= ';'; |
|
214 | + } |
|
191 | 215 | $ts .= strtotime($spotter_data['date']); |
192 | - if ($rd != '') $rd .= ';'; |
|
216 | + if ($rd != '') { |
|
217 | + $rd .= ';'; |
|
218 | + } |
|
193 | 219 | $rd .= '20'; |
194 | 220 | } |
195 | 221 | $url = 'https://router.project-osrm.org/match/v1/driving/'.$coord.'?timestamps='.$ts.'&overview=full&geometries=geojson&tidy=true&gaps=ignore'; |
@@ -215,8 +241,12 @@ discard block |
||
215 | 241 | */ |
216 | 242 | public function mapbox($spotter_history_array) { |
217 | 243 | global $globalMapMatchingMaxPts, $globalMapboxToken; |
218 | - if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 60; |
|
219 | - if (count($spotter_history_array) < 2) return $spotter_history_array; |
|
244 | + if (!isset($globalMapMatchingMaxPts)) { |
|
245 | + $globalMapMatchingMaxPts = 60; |
|
246 | + } |
|
247 | + if (count($spotter_history_array) < 2) { |
|
248 | + return $spotter_history_array; |
|
249 | + } |
|
220 | 250 | $spotter_history_initial_array = array(); |
221 | 251 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
222 | 252 | $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
@@ -226,11 +256,17 @@ discard block |
||
226 | 256 | $ts = ''; |
227 | 257 | $rd = ''; |
228 | 258 | foreach ($spotter_history_array as $spotter_data) { |
229 | - if ($coord != '') $coord .= ';'; |
|
259 | + if ($coord != '') { |
|
260 | + $coord .= ';'; |
|
261 | + } |
|
230 | 262 | $coord .= $spotter_data['longitude'].','.$spotter_data['latitude']; |
231 | - if ($ts != '') $ts .= ';'; |
|
263 | + if ($ts != '') { |
|
264 | + $ts .= ';'; |
|
265 | + } |
|
232 | 266 | $ts .= strtotime($spotter_data['date']); |
233 | - if ($rd != '') $rd .= ';'; |
|
267 | + if ($rd != '') { |
|
268 | + $rd .= ';'; |
|
269 | + } |
|
234 | 270 | $rd .= '20'; |
235 | 271 | } |
236 | 272 | //$url = 'https://api.mapbox.com/matching/v5/mapbox/driving/'.$coord.'?access_token='.$globalMapboxToken.'×tamps='.$ts.'&overview=full&tidy=true&geometries=geojson&radiuses='.$rd; |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | $tracker = false; |
13 | 13 | $marine = false; |
14 | 14 | $usecoord = false; |
15 | -if (isset($_GET['test'])) exit(); |
|
15 | +if (isset($_GET['test'])) { |
|
16 | + exit(); |
|
17 | +} |
|
16 | 18 | if (isset($_GET['tracker'])) { |
17 | 19 | $tracker = true; |
18 | 20 | } |
@@ -57,28 +59,55 @@ discard block |
||
57 | 59 | } |
58 | 60 | header('Content-Type: text/javascript'); |
59 | 61 | |
60 | -if (!isset($globalJsonCompress)) $compress = true; |
|
61 | -else $compress = $globalJsonCompress; |
|
62 | +if (!isset($globalJsonCompress)) { |
|
63 | + $compress = true; |
|
64 | +} else { |
|
65 | + $compress = $globalJsonCompress; |
|
66 | +} |
|
62 | 67 | |
63 | 68 | $from_archive = false; |
64 | 69 | $min = true; |
65 | 70 | $allhistory = false; |
66 | 71 | $filter['source'] = array(); |
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
72 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
72 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
73 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
74 | +} |
|
75 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
76 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
77 | +} |
|
78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
79 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
80 | +} |
|
81 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
82 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
83 | +} |
|
84 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
85 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
86 | +} |
|
87 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
88 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
89 | +} |
|
90 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
91 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
92 | +} |
|
93 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
94 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
95 | +} |
|
96 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
97 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
98 | +} |
|
99 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
100 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
101 | +} |
|
102 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
103 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
104 | +} |
|
78 | 105 | |
79 | 106 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
80 | 107 | $min = true; |
81 | -} else $min = false; |
|
108 | +} else { |
|
109 | + $min = false; |
|
110 | +} |
|
82 | 111 | |
83 | 112 | $spotter_array = array(); |
84 | 113 | |
@@ -189,24 +218,38 @@ discard block |
||
189 | 218 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
190 | 219 | } |
191 | 220 | } |
192 | - if ($flightcnt == '') $flightcnt = 0; |
|
193 | -} else $flightcnt = 0; |
|
221 | + if ($flightcnt == '') { |
|
222 | + $flightcnt = 0; |
|
223 | + } |
|
224 | + } else { |
|
225 | + $flightcnt = 0; |
|
226 | +} |
|
194 | 227 | |
195 | 228 | $sqltime = round(microtime(true)-$begintime,2); |
196 | 229 | |
197 | 230 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
198 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
231 | +if ($currenttime != '') { |
|
232 | + $currenttime = round($currenttime/1000); |
|
233 | +} |
|
199 | 234 | |
200 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
201 | -else $usenextlatlon = true; |
|
202 | -if ($usenextlatlon === false) $currenttime = ''; |
|
235 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
236 | + $usenextlatlon = false; |
|
237 | +} else { |
|
238 | + $usenextlatlon = true; |
|
239 | +} |
|
240 | +if ($usenextlatlon === false) { |
|
241 | + $currenttime = ''; |
|
242 | +} |
|
203 | 243 | $j = 0; |
204 | 244 | $prev_flightaware_id = ''; |
205 | 245 | $aircrafts_shadow = array(); |
206 | 246 | $output = '{'; |
207 | 247 | $output .= '"type": "FeatureCollection",'; |
208 | - if ($min) $output .= '"minimal": "true",'; |
|
209 | - else $output .= '"minimal": "false",'; |
|
248 | + if ($min) { |
|
249 | + $output .= '"minimal": "true",'; |
|
250 | + } else { |
|
251 | + $output .= '"minimal": "false",'; |
|
252 | + } |
|
210 | 253 | //$output .= '"fc": "'.$flightcnt.'",'; |
211 | 254 | $output .= '"sqt": "'.$sqltime.'",'; |
212 | 255 | |
@@ -251,18 +294,29 @@ discard block |
||
251 | 294 | } |
252 | 295 | $output .= '"properties": {'; |
253 | 296 | if (isset($spotter_item['flightaware_id'])) { |
254 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
255 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
297 | + if ($compress) { |
|
298 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
299 | + } else { |
|
300 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
301 | + } |
|
256 | 302 | } elseif (isset($spotter_item['famtrackid'])) { |
257 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
258 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
303 | + if ($compress) { |
|
304 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
305 | + } else { |
|
306 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
307 | + } |
|
259 | 308 | } elseif (isset($spotter_item['fammarine_id'])) { |
260 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
261 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
309 | + if ($compress) { |
|
310 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
311 | + } else { |
|
312 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
313 | + } |
|
262 | 314 | } |
263 | 315 | $output .= '"fc": "'.$flightcnt.'",'; |
264 | 316 | $output .= '"sqt": "'.$sqltime.'",'; |
265 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
317 | + if (isset($begindate)) { |
|
318 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
319 | + } |
|
266 | 320 | |
267 | 321 | /* |
268 | 322 | if ($min) $output .= '"minimal": "true",'; |
@@ -270,14 +324,22 @@ discard block |
||
270 | 324 | */ |
271 | 325 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
272 | 326 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
273 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
274 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
327 | + if ($compress) { |
|
328 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
329 | + } else { |
|
330 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
331 | + } |
|
275 | 332 | //" |
276 | 333 | } else { |
277 | - if ($compress) $output .= '"c": "NA",'; |
|
278 | - else $output .= '"callsign": "NA",'; |
|
334 | + if ($compress) { |
|
335 | + $output .= '"c": "NA",'; |
|
336 | + } else { |
|
337 | + $output .= '"callsign": "NA",'; |
|
338 | + } |
|
339 | + } |
|
340 | + if (isset($spotter_item['registration'])) { |
|
341 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
279 | 342 | } |
280 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
281 | 343 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
282 | 344 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
283 | 345 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -290,16 +352,23 @@ discard block |
||
290 | 352 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
291 | 353 | } |
292 | 354 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
293 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
294 | - else { |
|
355 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
356 | + $spotter_item['aircraft_shadow'] = ''; |
|
357 | + } else { |
|
295 | 358 | $aircraft_icao = $spotter_item['aircraft_icao']; |
296 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
297 | - else { |
|
359 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
360 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
361 | + } else { |
|
298 | 362 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
299 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
300 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
301 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
302 | - else $spotter_item['aircraft_shadow'] = ''; |
|
363 | + if (count($aircraft_info) > 0) { |
|
364 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
365 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
366 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
367 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
368 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
369 | + } else { |
|
370 | + $spotter_item['aircraft_shadow'] = ''; |
|
371 | + } |
|
303 | 372 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
304 | 373 | } |
305 | 374 | } |
@@ -307,73 +376,139 @@ discard block |
||
307 | 376 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
308 | 377 | if ($tracker) { |
309 | 378 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
310 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
311 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
379 | + if ($compress) { |
|
380 | + $output .= '"as": "ambulance.png",'; |
|
381 | + } else { |
|
382 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
383 | + } |
|
312 | 384 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
313 | - if ($compress) $output .= '"as": "police.png",'; |
|
314 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
385 | + if ($compress) { |
|
386 | + $output .= '"as": "police.png",'; |
|
387 | + } else { |
|
388 | + $output .= '"aircraft_shadow": "police.png",'; |
|
389 | + } |
|
315 | 390 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
316 | - if ($compress) $output .= '"as": "ship.png",'; |
|
317 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
391 | + if ($compress) { |
|
392 | + $output .= '"as": "ship.png",'; |
|
393 | + } else { |
|
394 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
395 | + } |
|
318 | 396 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
319 | - if ($compress) $output .= '"as": "ship.png",'; |
|
320 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
397 | + if ($compress) { |
|
398 | + $output .= '"as": "ship.png",'; |
|
399 | + } else { |
|
400 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
401 | + } |
|
321 | 402 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
322 | - if ($compress) $output .= '"as": "ship.png",'; |
|
323 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
403 | + if ($compress) { |
|
404 | + $output .= '"as": "ship.png",'; |
|
405 | + } else { |
|
406 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
407 | + } |
|
324 | 408 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
325 | - if ($compress) $output .= '"as": "truck.png",'; |
|
326 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
409 | + if ($compress) { |
|
410 | + $output .= '"as": "truck.png",'; |
|
411 | + } else { |
|
412 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
413 | + } |
|
327 | 414 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
328 | - if ($compress) $output .= '"as": "truck.png",'; |
|
329 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
415 | + if ($compress) { |
|
416 | + $output .= '"as": "truck.png",'; |
|
417 | + } else { |
|
418 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
419 | + } |
|
330 | 420 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
331 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
332 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
421 | + if ($compress) { |
|
422 | + $output .= '"as": "aircraft.png",'; |
|
423 | + } else { |
|
424 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
425 | + } |
|
333 | 426 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
334 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
335 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
427 | + if ($compress) { |
|
428 | + $output .= '"as": "aircraft.png",'; |
|
429 | + } else { |
|
430 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
431 | + } |
|
336 | 432 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
337 | - if ($compress) $output .= '"as": "helico.png",'; |
|
338 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
433 | + if ($compress) { |
|
434 | + $output .= '"as": "helico.png",'; |
|
435 | + } else { |
|
436 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
437 | + } |
|
339 | 438 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
340 | - if ($compress) $output .= '"as": "rail.png",'; |
|
341 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
439 | + if ($compress) { |
|
440 | + $output .= '"as": "rail.png",'; |
|
441 | + } else { |
|
442 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
443 | + } |
|
342 | 444 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
343 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
344 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
445 | + if ($compress) { |
|
446 | + $output .= '"as": "firetruck.png",'; |
|
447 | + } else { |
|
448 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
449 | + } |
|
345 | 450 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
346 | - if ($compress) $output .= '"as": "bus.png",'; |
|
347 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
451 | + if ($compress) { |
|
452 | + $output .= '"as": "bus.png",'; |
|
453 | + } else { |
|
454 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
455 | + } |
|
348 | 456 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
349 | - if ($compress) $output .= '"as": "phone.png",'; |
|
350 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
457 | + if ($compress) { |
|
458 | + $output .= '"as": "phone.png",'; |
|
459 | + } else { |
|
460 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
461 | + } |
|
351 | 462 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
352 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
353 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
463 | + if ($compress) { |
|
464 | + $output .= '"as": "jogger.png",'; |
|
465 | + } else { |
|
466 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
467 | + } |
|
354 | 468 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
355 | - if ($compress) $output .= '"as": "bike.png",'; |
|
356 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
469 | + if ($compress) { |
|
470 | + $output .= '"as": "bike.png",'; |
|
471 | + } else { |
|
472 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
473 | + } |
|
357 | 474 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
358 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
359 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
475 | + if ($compress) { |
|
476 | + $output .= '"as": "motorcycle.png",'; |
|
477 | + } else { |
|
478 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
479 | + } |
|
360 | 480 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
361 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
362 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
481 | + if ($compress) { |
|
482 | + $output .= '"as": "balloon.png",'; |
|
483 | + } else { |
|
484 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
485 | + } |
|
363 | 486 | } else { |
364 | - if ($compress) $output .= '"as": "car.png",'; |
|
365 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
487 | + if ($compress) { |
|
488 | + $output .= '"as": "car.png",'; |
|
489 | + } else { |
|
490 | + $output .= '"aircraft_shadow": "car.png",'; |
|
491 | + } |
|
366 | 492 | } |
367 | 493 | } elseif ($marine) { |
368 | - if ($compress) $output .= '"as": "ship.png",'; |
|
369 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
494 | + if ($compress) { |
|
495 | + $output .= '"as": "ship.png",'; |
|
496 | + } else { |
|
497 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
498 | + } |
|
370 | 499 | } else { |
371 | - if ($compress) $output .= '"as": "default.png",'; |
|
372 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
500 | + if ($compress) { |
|
501 | + $output .= '"as": "default.png",'; |
|
502 | + } else { |
|
503 | + $output .= '"aircraft_shadow": "default.png",'; |
|
504 | + } |
|
373 | 505 | } |
374 | 506 | } else { |
375 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
376 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
507 | + if ($compress) { |
|
508 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
509 | + } else { |
|
510 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
511 | + } |
|
377 | 512 | } |
378 | 513 | if (isset($spotter_item['airline_name'])) { |
379 | 514 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -381,8 +516,11 @@ discard block |
||
381 | 516 | $output .= '"airline_name": "NA",'; |
382 | 517 | } |
383 | 518 | if (isset($spotter_item['departure_airport'])) { |
384 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
385 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
519 | + if ($compress) { |
|
520 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
521 | + } else { |
|
522 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
523 | + } |
|
386 | 524 | } |
387 | 525 | if (isset($spotter_item['departure_airport_city'])) { |
388 | 526 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -394,8 +532,11 @@ discard block |
||
394 | 532 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
395 | 533 | } |
396 | 534 | if (isset($spotter_item['arrival_airport'])) { |
397 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
398 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
535 | + if ($compress) { |
|
536 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
537 | + } else { |
|
538 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
539 | + } |
|
399 | 540 | } |
400 | 541 | if (isset($spotter_item['arrival_airport_city'])) { |
401 | 542 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -414,8 +555,11 @@ discard block |
||
414 | 555 | } |
415 | 556 | |
416 | 557 | if (isset($spotter_item['altitude'])) { |
417 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
418 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
558 | + if ($compress) { |
|
559 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
560 | + } else { |
|
561 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
562 | + } |
|
419 | 563 | } |
420 | 564 | |
421 | 565 | $heading = $spotter_item['heading']; |
@@ -439,19 +583,24 @@ discard block |
||
439 | 583 | } |
440 | 584 | } |
441 | 585 | |
442 | - if ($compress)$output .= '"h": "'.$heading.'",'; |
|
443 | - else $output .= '"heading": "'.$heading.'",'; |
|
586 | + if ($compress) { |
|
587 | + $output .= '"h": "'.$heading.'",'; |
|
588 | + } else { |
|
589 | + $output .= '"heading": "'.$heading.'",'; |
|
590 | + } |
|
444 | 591 | if ($currenttime != '') { |
445 | 592 | if (strtotime($spotter_item['date']) < $currenttime) { |
446 | 593 | if (isset($archivespeed)) { |
447 | 594 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
448 | 595 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
449 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
450 | - else { |
|
596 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
597 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
598 | + } else { |
|
451 | 599 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
452 | 600 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
453 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
454 | - else { |
|
601 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
602 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
603 | + } else { |
|
455 | 604 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
456 | 605 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
457 | 606 | } |
@@ -459,12 +608,14 @@ discard block |
||
459 | 608 | } elseif ($usenextlatlon) { |
460 | 609 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
461 | 610 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
462 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
463 | - else { |
|
611 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
612 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
613 | + } else { |
|
464 | 614 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
465 | 615 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
466 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
467 | - else { |
|
616 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
617 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
618 | + } else { |
|
468 | 619 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
469 | 620 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
470 | 621 | } |
@@ -503,7 +654,9 @@ discard block |
||
503 | 654 | } |
504 | 655 | } |
505 | 656 | |
506 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
657 | + if (!$min) { |
|
658 | + $output .= '"image": "'.$image.'",'; |
|
659 | + } |
|
507 | 660 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
508 | 661 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
509 | 662 | } |
@@ -511,8 +664,11 @@ discard block |
||
511 | 664 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
512 | 665 | } |
513 | 666 | if (isset($spotter_item['squawk'])) { |
514 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
515 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
667 | + if ($compress) { |
|
668 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
669 | + } else { |
|
670 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
671 | + } |
|
516 | 672 | } |
517 | 673 | if (isset($spotter_item['squawk_usage'])) { |
518 | 674 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -531,14 +687,23 @@ discard block |
||
531 | 687 | } |
532 | 688 | // type when not aircraft ? |
533 | 689 | if (isset($spotter_item['type'])) { |
534 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
535 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
690 | + if ($compress) { |
|
691 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
692 | + } else { |
|
693 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
694 | + } |
|
536 | 695 | } elseif ($marine) { |
537 | - if ($compress) $output .= '"t": "ship"'; |
|
538 | - else $output .= '"type": "ship"'; |
|
696 | + if ($compress) { |
|
697 | + $output .= '"t": "ship"'; |
|
698 | + } else { |
|
699 | + $output .= '"type": "ship"'; |
|
700 | + } |
|
539 | 701 | } else { |
540 | - if ($compress) $output .= '"t": "aircraft"'; |
|
541 | - else $output .= '"type": "aircraft"'; |
|
702 | + if ($compress) { |
|
703 | + $output .= '"t": "aircraft"'; |
|
704 | + } else { |
|
705 | + $output .= '"type": "aircraft"'; |
|
706 | + } |
|
542 | 707 | } |
543 | 708 | $output .= '},'; |
544 | 709 | $output .= '"geometry": {'; |
@@ -546,15 +711,19 @@ discard block |
||
546 | 711 | $output .= '"coordinates": ['; |
547 | 712 | if ($currenttime != '') { |
548 | 713 | if (strtotime($spotter_item['date']) < $currenttime) { |
549 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
714 | + if (!isset($archivespeed)) { |
|
715 | + $archivespeed = 1; |
|
716 | + } |
|
550 | 717 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
551 | 718 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
552 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
553 | - else { |
|
719 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
720 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
721 | + } else { |
|
554 | 722 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
555 | 723 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
556 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
557 | - else { |
|
724 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
725 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
726 | + } else { |
|
558 | 727 | $output .= $spotter_item['longitude'].', '; |
559 | 728 | $output .= $spotter_item['latitude']; |
560 | 729 | } |
@@ -632,7 +801,9 @@ discard block |
||
632 | 801 | } |
633 | 802 | */ |
634 | 803 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
635 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
804 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
805 | + $history = $_COOKIE['history']; |
|
806 | + } |
|
636 | 807 | |
637 | 808 | if ( |
638 | 809 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -698,8 +869,11 @@ discard block |
||
698 | 869 | $output_history .= ']}},'; |
699 | 870 | $output .= $output_history; |
700 | 871 | } |
701 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
702 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
872 | + if ($compress) { |
|
873 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
874 | + } else { |
|
875 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
876 | + } |
|
703 | 877 | } |
704 | 878 | $output_history .= '['; |
705 | 879 | $output_history .= $spotter_history['longitude'].', '; |
@@ -720,10 +894,15 @@ discard block |
||
720 | 894 | if ($d == false) { |
721 | 895 | if ($compress) { |
722 | 896 | $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",'; |
723 | - if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
724 | - elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
897 | + if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') { |
|
898 | + $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
899 | + } elseif (isset($spotter_history_array[0]['mapmatching_engine'])) { |
|
900 | + $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
901 | + } |
|
725 | 902 | $output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
726 | - } else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
903 | + } else { |
|
904 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
905 | + } |
|
727 | 906 | $d = true; |
728 | 907 | } |
729 | 908 | $output_history .= '['; |
@@ -746,7 +925,9 @@ discard block |
||
746 | 925 | $output_historyd = '['; |
747 | 926 | $output_historyd .= $spotter_item['longitude'].', '; |
748 | 927 | $output_historyd .= $spotter_item['latitude']; |
749 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
928 | + if (isset($spotter_history['altitude'])) { |
|
929 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
930 | + } |
|
750 | 931 | $output_historyd .= '],'; |
751 | 932 | //$output_history = $output_historyd.$output_history; |
752 | 933 | $output_history = $output_history.$output_historyd; |
@@ -773,8 +954,11 @@ discard block |
||
773 | 954 | && $spotter_item['arrival_airport'] != 'NA' |
774 | 955 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
775 | 956 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
776 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
777 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
957 | + if ($compress) { |
|
958 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
959 | + } else { |
|
960 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
961 | + } |
|
778 | 962 | if (isset($spotter_item['departure_airport_latitude'])) { |
779 | 963 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
780 | 964 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -807,8 +991,11 @@ discard block |
||
807 | 991 | || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
808 | 992 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
809 | 993 | $havedata = false; |
810 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
811 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
994 | + if ($compress) { |
|
995 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
996 | + } else { |
|
997 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
998 | + } |
|
812 | 999 | $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
813 | 1000 | |
814 | 1001 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -823,7 +1010,9 @@ discard block |
||
823 | 1010 | } |
824 | 1011 | //$output_dest = substr($output_dest, 0, -1); |
825 | 1012 | $output_dest .= ']}},'; |
826 | - if ($havedata) $output .= $output_dest; |
|
1013 | + if ($havedata) { |
|
1014 | + $output .= $output_dest; |
|
1015 | + } |
|
827 | 1016 | unset($output_dest); |
828 | 1017 | } |
829 | 1018 | } |
@@ -831,7 +1020,9 @@ discard block |
||
831 | 1020 | $output .= ']'; |
832 | 1021 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
833 | 1022 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
834 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
1023 | + if (isset($begindate)) { |
|
1024 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
1025 | + } |
|
835 | 1026 | $output .= '"fc": "'.$j.'"'; |
836 | 1027 | } else { |
837 | 1028 | $output .= '"features": '; |
@@ -14,23 +14,23 @@ discard block |
||
14 | 14 | $usecoord = false; |
15 | 15 | if (isset($_GET['test'])) exit(); |
16 | 16 | if (isset($_GET['tracker'])) { |
17 | - $tracker = true; |
|
17 | + $tracker = true; |
|
18 | 18 | } |
19 | 19 | if (isset($_GET['marine'])) { |
20 | - $marine = true; |
|
20 | + $marine = true; |
|
21 | 21 | } |
22 | 22 | if ($tracker) { |
23 | - require_once('require/class.Tracker.php'); |
|
24 | - require_once('require/class.TrackerLive.php'); |
|
25 | - require_once('require/class.TrackerArchive.php'); |
|
23 | + require_once('require/class.Tracker.php'); |
|
24 | + require_once('require/class.TrackerLive.php'); |
|
25 | + require_once('require/class.TrackerArchive.php'); |
|
26 | 26 | } elseif ($marine) { |
27 | - require_once('require/class.Marine.php'); |
|
28 | - require_once('require/class.MarineLive.php'); |
|
29 | - require_once('require/class.MarineArchive.php'); |
|
27 | + require_once('require/class.Marine.php'); |
|
28 | + require_once('require/class.MarineLive.php'); |
|
29 | + require_once('require/class.MarineArchive.php'); |
|
30 | 30 | } else { |
31 | - require_once('require/class.Spotter.php'); |
|
32 | - require_once('require/class.SpotterLive.php'); |
|
33 | - require_once('require/class.SpotterArchive.php'); |
|
31 | + require_once('require/class.Spotter.php'); |
|
32 | + require_once('require/class.SpotterLive.php'); |
|
33 | + require_once('require/class.SpotterArchive.php'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $begintime = microtime(true); |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | $Common = new Common(); |
51 | 51 | |
52 | 52 | if (isset($_GET['download'])) { |
53 | - if ($_GET['download'] == "true") |
|
54 | - { |
|
53 | + if ($_GET['download'] == "true") |
|
54 | + { |
|
55 | 55 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
56 | - } |
|
56 | + } |
|
57 | 57 | } |
58 | 58 | header('Content-Type: text/javascript'); |
59 | 59 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $usecoord = true; |
132 | 132 | $coord = explode(',',$_GET['coord']); |
133 | 133 | if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
134 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
|
134 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
|
135 | 135 | if ($tracker) { |
136 | 136 | $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
137 | 137 | } elseif ($marine) { |
@@ -635,17 +635,17 @@ discard block |
||
635 | 635 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
636 | 636 | |
637 | 637 | if ( |
638 | - (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
|
639 | - || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
|
638 | + (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
|
639 | + || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
|
640 | 640 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
641 | 641 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
642 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
643 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
|
644 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
645 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
|
646 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
647 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
|
648 | - ) { |
|
642 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
643 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
|
644 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
645 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
|
646 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
647 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
|
648 | + ) { |
|
649 | 649 | if ($tracker) { |
650 | 650 | if ($from_archive || $globalArchive) { |
651 | 651 | $spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']); |
@@ -653,9 +653,9 @@ discard block |
||
653 | 653 | $spotter_history_array = $TrackerLive->getAllLiveTrackerDataById($spotter_item['famtrackid']); |
654 | 654 | } |
655 | 655 | if (((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || |
656 | - (!isset($_COOKIE['mapmatching']) && $globalMapMatching === TRUE)) && |
|
657 | - isset($_GET['zoom']) && $_GET['zoom'] > 12 && |
|
658 | - isset($spotter_item['type']) && ( |
|
656 | + (!isset($_COOKIE['mapmatching']) && $globalMapMatching === TRUE)) && |
|
657 | + isset($_GET['zoom']) && $_GET['zoom'] > 12 && |
|
658 | + isset($spotter_item['type']) && ( |
|
659 | 659 | $spotter_item['type'] == 'Firetruck' || |
660 | 660 | $spotter_item['type'] == 'Ambulance' || |
661 | 661 | $spotter_item['type'] == 'Truck (18 Wheeler)' || |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | $spotter_item['type'] == 'Jeep' || |
668 | 668 | $spotter_item['type'] == 'Motorcycle' || |
669 | 669 | $spotter_item['type'] == 'Car' |
670 | - ) |
|
670 | + ) |
|
671 | 671 | ) { |
672 | 672 | require(dirname(__FILE__).'/require/class.MapMatching.php'); |
673 | 673 | $MapMatching = new MapMatching(); |
@@ -770,65 +770,65 @@ discard block |
||
770 | 770 | } |
771 | 771 | |
772 | 772 | if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
773 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
774 | - && (isset($spotter_item['departure_airport']) |
|
775 | - && $spotter_item['departure_airport'] != 'NA' |
|
776 | - && isset($spotter_item['arrival_airport']) |
|
777 | - && $spotter_item['arrival_airport'] != 'NA' |
|
778 | - && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
|
779 | - || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
|
780 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
781 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
782 | - if (isset($spotter_item['departure_airport_latitude'])) { |
|
773 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
774 | + && (isset($spotter_item['departure_airport']) |
|
775 | + && $spotter_item['departure_airport'] != 'NA' |
|
776 | + && isset($spotter_item['arrival_airport']) |
|
777 | + && $spotter_item['arrival_airport'] != 'NA' |
|
778 | + && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
|
779 | + || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
|
780 | + if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
781 | + else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
782 | + if (isset($spotter_item['departure_airport_latitude'])) { |
|
783 | 783 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
784 | - } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
784 | + } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
785 | 785 | $dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
786 | 786 | if (isset($dairport[0]['latitude'])) { |
787 | - $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
787 | + $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
788 | 788 | } |
789 | - } |
|
790 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
789 | + } |
|
790 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
791 | 791 | $output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],'; |
792 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
792 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
793 | 793 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
794 | 794 | if (isset($aairport[0]['latitude'])) { |
795 | - $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],'; |
|
795 | + $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],'; |
|
796 | 796 | } |
797 | - } |
|
798 | - $output_air = substr($output_air, 0, -1); |
|
799 | - $output_air .= ']}},'; |
|
800 | - $output .= $output_air; |
|
801 | - unset($output_air); |
|
797 | + } |
|
798 | + $output_air = substr($output_air, 0, -1); |
|
799 | + $output_air .= ']}},'; |
|
800 | + $output .= $output_air; |
|
801 | + unset($output_air); |
|
802 | 802 | } |
803 | 803 | |
804 | 804 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
805 | 805 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
806 | 806 | if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
807 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
808 | - && (isset($spotter_item['arrival_airport']) |
|
809 | - && $spotter_item['arrival_airport'] != 'NA' |
|
810 | - && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") |
|
811 | - || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
|
812 | - || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
|
813 | - $havedata = false; |
|
814 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
815 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
816 | - $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
|
807 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
808 | + && (isset($spotter_item['arrival_airport']) |
|
809 | + && $spotter_item['arrival_airport'] != 'NA' |
|
810 | + && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") |
|
811 | + || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
|
812 | + || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
|
813 | + $havedata = false; |
|
814 | + if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
815 | + else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
816 | + $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
|
817 | 817 | |
818 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
818 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
819 | 819 | $output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']'; |
820 | 820 | $havedata = true; |
821 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
821 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
822 | 822 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
823 | 823 | if (isset($aairport[0]['latitude'])) { |
824 | - $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
825 | - $havedata = true; |
|
824 | + $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
825 | + $havedata = true; |
|
826 | 826 | } |
827 | - } |
|
828 | - //$output_dest = substr($output_dest, 0, -1); |
|
829 | - $output_dest .= ']}},'; |
|
830 | - if ($havedata) $output .= $output_dest; |
|
831 | - unset($output_dest); |
|
827 | + } |
|
828 | + //$output_dest = substr($output_dest, 0, -1); |
|
829 | + $output_dest .= ']}},'; |
|
830 | + if ($havedata) $output .= $output_dest; |
|
831 | + unset($output_dest); |
|
832 | 832 | } |
833 | 833 | } |
834 | 834 | $output = substr($output, 0, -1); |
@@ -64,17 +64,17 @@ discard block |
||
64 | 64 | $min = true; |
65 | 65 | $allhistory = false; |
66 | 66 | $filter['source'] = array(); |
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
72 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
69 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
71 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
72 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
73 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
74 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
75 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
76 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
77 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
78 | 78 | |
79 | 79 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
80 | 80 | $min = true; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $spotter_array = array(); |
84 | 84 | |
85 | 85 | if (isset($_GET['ident'])) { |
86 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
86 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
87 | 87 | if ($tracker) { |
88 | 88 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
89 | 89 | } elseif ($marine) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | $allhistory = true; |
99 | 99 | } elseif (isset($_GET['flightaware_id'])) { |
100 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
100 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
101 | 101 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
102 | 102 | if (empty($spotter_array)) { |
103 | 103 | $from_archive = true; |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | } |
106 | 106 | $allhistory = true; |
107 | 107 | } elseif (isset($_GET['famtrack_id'])) { |
108 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
108 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
109 | 109 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
110 | 110 | $allhistory = true; |
111 | 111 | } elseif (isset($_GET['fammarine_id'])) { |
112 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
112 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
113 | 113 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
114 | 114 | $allhistory = true; |
115 | 115 | /* |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | */ |
130 | 130 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
131 | 131 | $usecoord = true; |
132 | - $coord = explode(',',$_GET['coord']); |
|
133 | - if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
132 | + $coord = explode(',', $_GET['coord']); |
|
133 | + if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
134 | 134 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
135 | 135 | if ($tracker) { |
136 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
136 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
137 | 137 | } elseif ($marine) { |
138 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
138 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
139 | 139 | } else { |
140 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
140 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
141 | 141 | } |
142 | 142 | } else { |
143 | 143 | if ($tracker) { |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | $from_archive = true; |
153 | 153 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
154 | 154 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
155 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
156 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
157 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
158 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
159 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
160 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
155 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
156 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
157 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
158 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
159 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
160 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
161 | 161 | } elseif ($min) { |
162 | 162 | if ($tracker) { |
163 | 163 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -169,17 +169,17 @@ discard block |
||
169 | 169 | # $min = true; |
170 | 170 | } else { |
171 | 171 | if ($tracker) { |
172 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
172 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
173 | 173 | } elseif ($marine) { |
174 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
174 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
175 | 175 | } else { |
176 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
176 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | 180 | if ($usecoord) { |
181 | 181 | if (isset($_GET['archive'])) { |
182 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
182 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
183 | 183 | } else { |
184 | 184 | if ($tracker) { |
185 | 185 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | if ($flightcnt == '') $flightcnt = 0; |
193 | 193 | } else $flightcnt = 0; |
194 | 194 | |
195 | -$sqltime = round(microtime(true)-$begintime,2); |
|
195 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
196 | 196 | |
197 | -$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
197 | +$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
198 | 198 | if ($currenttime != '') $currenttime = round($currenttime/1000); |
199 | 199 | |
200 | 200 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | if (!empty($spotter_array) && is_array($spotter_array)) |
214 | 214 | { |
215 | 215 | $output .= '"features": ['; |
216 | - foreach($spotter_array as $spotter_item) |
|
216 | + foreach ($spotter_array as $spotter_item) |
|
217 | 217 | { |
218 | 218 | $j++; |
219 | 219 | unset($idistance); |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | */ |
271 | 271 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
272 | 272 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
273 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
274 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
273 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
274 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
275 | 275 | //" |
276 | 276 | } else { |
277 | 277 | if ($compress) $output .= '"c": "NA",'; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
281 | 281 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
282 | 282 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
283 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
283 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
284 | 284 | } elseif (isset($spotter_item['aircraft_type'])) { |
285 | 285 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
286 | 286 | } elseif (!$min) { |
@@ -423,15 +423,15 @@ discard block |
||
423 | 423 | if (isset($archivespeed) || $usenextlatlon) { |
424 | 424 | if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
425 | 425 | if (isset($spotter_item['arrival_airport_latitude'])) { |
426 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
427 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
426 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
427 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
428 | 428 | $farr_lat = $spotter_item['arrival_airport_latitude']; |
429 | 429 | $farr_lon = $spotter_item['arrival_airport_longitude']; |
430 | 430 | } else { |
431 | 431 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
432 | 432 | if (isset($aairport[0]['latitude'])) { |
433 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
434 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
433 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
434 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
435 | 435 | $farr_lat = $aairport[0]['latitude']; |
436 | 436 | $farr_lon = $aairport[0]['longitude']; |
437 | 437 | } |
@@ -444,59 +444,59 @@ discard block |
||
444 | 444 | if ($currenttime != '') { |
445 | 445 | if (strtotime($spotter_item['date']) < $currenttime) { |
446 | 446 | if (isset($archivespeed)) { |
447 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
448 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
447 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
448 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
449 | 449 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
450 | 450 | else { |
451 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
452 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
451 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
452 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
453 | 453 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
454 | 454 | else { |
455 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
455 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
456 | 456 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
457 | 457 | } |
458 | 458 | } |
459 | 459 | } elseif ($usenextlatlon) { |
460 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
461 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
460 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
461 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
462 | 462 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
463 | 463 | else { |
464 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
465 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
464 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
465 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
466 | 466 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
467 | 467 | else { |
468 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
468 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
469 | 469 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
470 | 470 | } |
471 | 471 | } |
472 | 472 | } |
473 | 473 | } else { |
474 | 474 | if (isset($archivespeed)) { |
475 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
475 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
476 | 476 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
477 | 477 | } elseif ($usenextlatlon) { |
478 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
478 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
479 | 479 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
480 | 480 | } |
481 | 481 | } |
482 | 482 | } else { |
483 | 483 | if (isset($archivespeed)) { |
484 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
485 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
484 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
485 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
486 | 486 | if (!isset($idistance) || $fdistance < $idistance) { |
487 | 487 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
488 | 488 | } else { |
489 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed); |
|
489 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed); |
|
490 | 490 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
491 | 491 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
492 | 492 | } |
493 | 493 | } elseif ($usenextlatlon) { |
494 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
495 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
494 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
495 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
496 | 496 | if (!isset($idistance) || $fdistance < $idistance) { |
497 | 497 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
498 | 498 | } else { |
499 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading); |
|
499 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading); |
|
500 | 500 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
501 | 501 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
502 | 502 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | if (!$min) $output .= '"image": "'.$image.'",'; |
507 | 507 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
508 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
508 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
509 | 509 | } |
510 | 510 | if (isset($spotter_item['image_source_website'])) { |
511 | 511 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
528 | 528 | } |
529 | 529 | if (isset($spotter_item['acars'])) { |
530 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
530 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
531 | 531 | } |
532 | 532 | // type when not aircraft ? |
533 | 533 | if (isset($spotter_item['type'])) { |
@@ -547,12 +547,12 @@ discard block |
||
547 | 547 | if ($currenttime != '') { |
548 | 548 | if (strtotime($spotter_item['date']) < $currenttime) { |
549 | 549 | if (!isset($archivespeed)) $archivespeed = 1; |
550 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
551 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
550 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
551 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
552 | 552 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
553 | 553 | else { |
554 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
555 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
554 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
555 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
556 | 556 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
557 | 557 | else { |
558 | 558 | $output .= $spotter_item['longitude'].', '; |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | |
632 | 632 | } |
633 | 633 | */ |
634 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
634 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
635 | 635 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
636 | 636 | |
637 | 637 | if ( |
@@ -639,11 +639,11 @@ discard block |
||
639 | 639 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
640 | 640 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
641 | 641 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
642 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
642 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
643 | 643 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
644 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
644 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
645 | 645 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
646 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
646 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
647 | 647 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
648 | 648 | ) { |
649 | 649 | if ($tracker) { |
@@ -672,9 +672,9 @@ discard block |
||
672 | 672 | require(dirname(__FILE__).'/require/class.MapMatching.php'); |
673 | 673 | $MapMatching = new MapMatching(); |
674 | 674 | if (isset($spotter_item['date_iso_8601'])) { |
675 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date_iso_8601']))))); |
|
675 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date_iso_8601']))))); |
|
676 | 676 | } else { |
677 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date']))))); |
|
677 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date']))))); |
|
678 | 678 | } |
679 | 679 | $spotter_history_array = $MapMatching->match($spotter_history_array_mm); |
680 | 680 | } |
@@ -706,9 +706,9 @@ discard block |
||
706 | 706 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
707 | 707 | } |
708 | 708 | $output_history .= '['; |
709 | - $output_history .= $spotter_history['longitude'].', '; |
|
710 | - $output_history .= $spotter_history['latitude'].', '; |
|
711 | - $output_history .= $spotter_history['altitude']*30.48; |
|
709 | + $output_history .= $spotter_history['longitude'].', '; |
|
710 | + $output_history .= $spotter_history['latitude'].', '; |
|
711 | + $output_history .= $spotter_history['altitude']*30.48; |
|
712 | 712 | $output_history .= '],'; |
713 | 713 | /* |
714 | 714 | if ($from_archive === false) { |
@@ -731,8 +731,8 @@ discard block |
||
731 | 731 | $d = true; |
732 | 732 | } |
733 | 733 | $output_history .= '['; |
734 | - $output_history .= $spotter_history['longitude'].', '; |
|
735 | - $output_history .= $spotter_history['latitude']; |
|
734 | + $output_history .= $spotter_history['longitude'].', '; |
|
735 | + $output_history .= $spotter_history['latitude']; |
|
736 | 736 | $output_history .= '],'; |
737 | 737 | /* |
738 | 738 | if ($from_archive === false) { |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | //echo $output_history; |
749 | 749 | if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) { |
750 | 750 | $output_historyd = '['; |
751 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
752 | - $output_historyd .= $spotter_item['latitude']; |
|
753 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
751 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
752 | + $output_historyd .= $spotter_item['latitude']; |
|
753 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
754 | 754 | $output_historyd .= '],'; |
755 | 755 | //$output_history = $output_historyd.$output_history; |
756 | 756 | $output_history = $output_history.$output_historyd; |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | $last = array_pop($spotter_history_array); |
759 | 759 | $latitude = $last['latitude']; |
760 | 760 | $longitude = $last['longitude']; |
761 | - $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output); |
|
761 | + $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | $output_history = substr($output_history, 0, -1); |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | } |
770 | 770 | } |
771 | 771 | |
772 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
772 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
773 | 773 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
774 | 774 | && (isset($spotter_item['departure_airport']) |
775 | 775 | && $spotter_item['departure_airport'] != 'NA' |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | |
804 | 804 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
805 | 805 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
806 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
806 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
807 | 807 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
808 | 808 | && (isset($spotter_item['arrival_airport']) |
809 | 809 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | $output = substr($output, 0, -1); |
835 | 835 | $output .= ']'; |
836 | 836 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
837 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
837 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
838 | 838 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
839 | 839 | $output .= '"fc": "'.$j.'"'; |
840 | 840 | } else { |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | |
12 | 12 | $from_archive = false; |
13 | 13 | if (isset($_GET['ident'])) { |
14 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
14 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
15 | 15 | if (isset($_GET['currenttime'])) { |
16 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
16 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
17 | 17 | $currenttime = round($currenttime/1000); |
18 | - $spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime); |
|
18 | + $spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime); |
|
19 | 19 | if (empty($spotter_array)) { |
20 | 20 | $from_archive = true; |
21 | - $spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime); |
|
21 | + $spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime); |
|
22 | 22 | } |
23 | 23 | } else { |
24 | 24 | $spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident); |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | } |
30 | 30 | } |
31 | 31 | if (isset($_GET['flightaware_id'])) { |
32 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
32 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
33 | 33 | if (isset($_GET['currenttime'])) { |
34 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
34 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
35 | 35 | $currenttime = round($currenttime/1000); |
36 | - $spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime); |
|
36 | + $spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime); |
|
37 | 37 | if (empty($spotter_array)) { |
38 | 38 | $from_archive = true; |
39 | 39 | // $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
40 | - $spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime); |
|
40 | + $spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime); |
|
41 | 41 | } |
42 | 42 | } else { |
43 | 43 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
58 | 58 | { |
59 | 59 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
60 | - $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
60 | + $image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
61 | 61 | } else $image = $spotter_item['image_thumbnail']; |
62 | 62 | } |
63 | 63 | /* else { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
81 | 81 | if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
82 | 82 | if ($spotter_item['departure_airport_time'] > 2460) { |
83 | - print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>'; |
|
83 | + print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>'; |
|
84 | 84 | } else { |
85 | 85 | print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>'; |
86 | 86 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country']; |
90 | 90 | if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
91 | 91 | if ($spotter_item['arrival_airport_time'] > 2460) { |
92 | - print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>'; |
|
92 | + print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>'; |
|
93 | 93 | } else { |
94 | 94 | print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>'; |
95 | 95 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | print '<span>'._("Aircraft").'</span>'; |
109 | 109 | if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
110 | 110 | if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') { |
111 | - $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
|
111 | + $aircraft_names = explode('/', $spotter_item['aircraft_name']); |
|
112 | 112 | if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
113 | 113 | else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
114 | 114 | } elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | print '<div id ="altitude"><span>'._("Altitude").'</span>'; |
119 | 119 | if (isset($globalGroundAltitude) && $globalGroundAltitude) { |
120 | 120 | try { |
121 | - $groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']); |
|
122 | - } catch(Exception $e) { |
|
121 | + $groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']); |
|
122 | + } catch (Exception $e) { |
|
123 | 123 | // If catched not exist |
124 | 124 | } |
125 | 125 | } |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | if (isset($globalCam) && $globalCam) { |
159 | 159 | require_once(dirname(__FILE__).'/require/class.Common.php'); |
160 | 160 | $Common = new Common(); |
161 | - $azimuth = round($Common->azimuth($globalCenterLatitude,$globalCenterLongitude,$spotter_item['latitude'],$spotter_item['longitude'])); |
|
162 | - $distance = $Common->distance($globalCenterLatitude,$globalCenterLongitude,$spotter_item['latitude'],$spotter_item['longitude'],'m'); |
|
163 | - $plunge = round($Common->plunge($globalCenterAltitude,$spotter_item['real_altitude'],$distance)); |
|
161 | + $azimuth = round($Common->azimuth($globalCenterLatitude, $globalCenterLongitude, $spotter_item['latitude'], $spotter_item['longitude'])); |
|
162 | + $distance = $Common->distance($globalCenterLatitude, $globalCenterLongitude, $spotter_item['latitude'], $spotter_item['longitude'], 'm'); |
|
163 | + $plunge = round($Common->plunge($globalCenterAltitude, $spotter_item['real_altitude'], $distance)); |
|
164 | 164 | print '<div id="camcoordinates"><span>'._("Cam Coordinates").'</span>'; |
165 | 165 | print 'azimuth: '.$azimuth; |
166 | 166 | print ' / '; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | print '</div>'; |
171 | 171 | //echo $Common->getData('http://127.0.0.1/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true); |
172 | 172 | //echo $Common->getData('file://'.dirname(__FILE__).'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true); |
173 | - echo $Common->getData('http://'.$_SERVER['SERVER_NAME'].'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true); |
|
173 | + echo $Common->getData('http://'.$_SERVER['SERVER_NAME'].'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge, 'get', '', '', '', '', '', '', false, true); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>'; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | print '</div>'; |
206 | 206 | if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
207 | 207 | if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
208 | - if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
208 | + if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>'; |
|
209 | 209 | if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
210 | 210 | print '</div>'; |
211 | 211 | } |
@@ -58,7 +58,9 @@ discard block |
||
58 | 58 | { |
59 | 59 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
60 | 60 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
61 | - } else $image = $spotter_item['image_thumbnail']; |
|
61 | + } else { |
|
62 | + $image = $spotter_item['image_thumbnail']; |
|
63 | + } |
|
62 | 64 | } |
63 | 65 | /* else { |
64 | 66 | $image = "images/placeholder_thumb.png"; |
@@ -73,8 +75,12 @@ discard block |
||
73 | 75 | } |
74 | 76 | print '<div class="right">'; |
75 | 77 | print '<div class="callsign-details">'; |
76 | - if ($spotter_item['ident'] != 'Not Available') print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
|
77 | - if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
78 | + if ($spotter_item['ident'] != 'Not Available') { |
|
79 | + print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
|
80 | + } |
|
81 | + if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') { |
|
82 | + print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
83 | + } |
|
78 | 84 | print '</div>'; |
79 | 85 | if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') { |
80 | 86 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
@@ -106,13 +112,21 @@ discard block |
||
106 | 112 | print '</div>'; |
107 | 113 | print '<div id="aircraft">'; |
108 | 114 | print '<span>'._("Aircraft").'</span>'; |
109 | - if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
115 | + if (isset($spotter_item['aircraft_wiki'])) { |
|
116 | + print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
117 | + } |
|
110 | 118 | if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') { |
111 | 119 | $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
112 | - if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
113 | - else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
114 | - } elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
115 | - else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
120 | + if (count($aircraft_names) == 1) { |
|
121 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
122 | + } else { |
|
123 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
124 | + } |
|
125 | + } elseif (isset($spotter_item['aircraft_type'])) { |
|
126 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
127 | + } else { |
|
128 | + print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
129 | + } |
|
116 | 130 | |
117 | 131 | print '</div>'; |
118 | 132 | print '<div id ="altitude"><span>'._("Altitude").'</span>'; |
@@ -125,11 +139,17 @@ discard block |
||
125 | 139 | } |
126 | 140 | |
127 | 141 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
128 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
129 | - else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
142 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
143 | + print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
144 | + } else { |
|
145 | + print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
146 | + } |
|
130 | 147 | } else { |
131 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
132 | - else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
148 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
149 | + print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
150 | + } else { |
|
151 | + print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
152 | + } |
|
133 | 153 | } |
134 | 154 | |
135 | 155 | if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*30.48) { |
@@ -143,7 +163,9 @@ discard block |
||
143 | 163 | print '</i>'; |
144 | 164 | } |
145 | 165 | print '</div>'; |
146 | - if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
166 | + if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') { |
|
167 | + print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
168 | + } |
|
147 | 169 | print '<div id="speed"><span>'._("Speed").'</span>'; |
148 | 170 | if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
149 | 171 | print round($spotter_item['ground_speed']*1.15078).' mph'; |
@@ -176,8 +198,11 @@ discard block |
||
176 | 198 | print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>'; |
177 | 199 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') { |
178 | 200 | print '<div id="pilot"><span>'._("Pilot").'</span>'; |
179 | - if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
180 | - else print $spotter_item['pilot_name']; |
|
201 | + if (isset($spotter_item['pilot_id'])) { |
|
202 | + print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
203 | + } else { |
|
204 | + print $spotter_item['pilot_name']; |
|
205 | + } |
|
181 | 206 | print '</div>'; |
182 | 207 | } |
183 | 208 | if (isset($spotter_item['aircraft_owner']) && $spotter_item['aircraft_owner'] != '') { |
@@ -203,10 +228,18 @@ discard block |
||
203 | 228 | } |
204 | 229 | print '</div>'; |
205 | 230 | print '</div>'; |
206 | - if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
207 | - if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
208 | - if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
209 | - if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
231 | + if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') { |
|
232 | + print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
233 | + } |
|
234 | + if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') { |
|
235 | + print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
236 | + } |
|
237 | + if (isset($spotter_item['acars']['message'])) { |
|
238 | + print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
239 | + } |
|
240 | + if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) { |
|
241 | + print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
242 | + } |
|
210 | 243 | print '</div>'; |
211 | 244 | } |
212 | 245 | ?> |
@@ -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 | { |
@@ -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">'; |
@@ -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'); |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | require_once('require/class.Connection.php'); |
8 | 8 | require_once('require/class.Spotter.php'); |
9 | 9 | require_once('require/class.Language.php'); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING); |
|
12 | -$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING); |
|
12 | +$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
13 | 13 | $Spotter = new Spotter(); |
14 | 14 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
15 | 15 | |
16 | 16 | if (!empty($spotter_array)) |
17 | 17 | { |
18 | - $title = sprintf(_("Most Common Aircraft between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']); |
|
18 | + $title = sprintf(_("Most Common Aircraft between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']); |
|
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="info column">'; |
21 | 21 | print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>'; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | include('route-sub-menu.php'); |
27 | 27 | print '<div class="column">'; |
28 | 28 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
29 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>'; |
|
29 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>'; |
|
30 | 30 | |
31 | 31 | $aircraft_array = $Spotter->countAllAircraftTypesByRoute($departure_airport, $arrival_airport); |
32 | 32 | if (!empty($aircraft_array)) |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | print '</thead>'; |
42 | 42 | print '<tbody>'; |
43 | 43 | $i = 1; |
44 | - foreach($aircraft_array as $aircraft_item) |
|
44 | + foreach ($aircraft_array as $aircraft_item) |
|
45 | 45 | { |
46 | 46 | print '<tr>'; |
47 | 47 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | //require_once('require/class.SpotterLive.php'); |
8 | 8 | require_once('require/class.SpotterArchive.php'); |
9 | 9 | |
10 | -if (!isset($_GET['owner'])){ |
|
10 | +if (!isset($_GET['owner'])) { |
|
11 | 11 | header('Location: '.$globalURL.''); |
12 | 12 | } else { |
13 | 13 | $Spotter = new Spotter(); |
14 | 14 | $SpotterArchive = new SpotterArchive(); |
15 | 15 | //$Translation = new Translation(); |
16 | 16 | //calculuation for the pagination |
17 | - if(!isset($_GET['limit'])) |
|
17 | + if (!isset($_GET['limit'])) |
|
18 | 18 | { |
19 | 19 | $limit_start = 0; |
20 | 20 | $limit_end = 25; |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | } else { |
23 | 23 | $limit_explode = explode(",", $_GET['limit']); |
24 | 24 | if (isset($limit_explode[1])) { |
25 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
26 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
26 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
27 | 27 | } else { |
28 | 28 | $limit_start = 0; |
29 | 29 | $limit_end = 25; |
@@ -40,29 +40,29 @@ discard block |
||
40 | 40 | |
41 | 41 | $page_url = $globalURL.'/owner/'.$_GET['owner']; |
42 | 42 | |
43 | - $owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
44 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
45 | - $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
46 | - $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
43 | + $owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
44 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
45 | + $year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
46 | + $month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
47 | 47 | $filter = array(); |
48 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
49 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
48 | + if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
49 | + if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
50 | 50 | if ($sort != '') |
51 | 51 | { |
52 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
|
52 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter); |
|
53 | 53 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
54 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
|
54 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter); |
|
55 | 55 | } |
56 | 56 | } else { |
57 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter); |
|
57 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter); |
|
58 | 58 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
59 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter); |
|
59 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | if (!empty($spotter_array)) |
64 | 64 | { |
65 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']); |
|
65 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']); |
|
66 | 66 | //$ident = $spotter_array[0]['ident']; |
67 | 67 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
68 | 68 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -122,23 +122,23 @@ discard block |
||
122 | 122 | $Stats = new Stats(); |
123 | 123 | if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner); |
124 | 124 | else $flights = 0; |
125 | - if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter); |
|
125 | + if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner, $filter); |
|
126 | 126 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
127 | - $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter)); |
|
127 | + $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner, $filter)); |
|
128 | 128 | print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>'; |
129 | - $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner,$filter)); |
|
129 | + $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner, $filter)); |
|
130 | 130 | print '<div><span class="label">'._("Aircraft").'</span>'.$aircraft_registration.'</div>'; |
131 | - $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner,$filter)); |
|
131 | + $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner, $filter)); |
|
132 | 132 | print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>'; |
133 | - $airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter)); |
|
133 | + $airlines = count($Spotter->countAllAirlinesByOwner($owner, $filter)); |
|
134 | 134 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
135 | - $duration = $Spotter->getFlightDurationByOwner($owner,$filter); |
|
135 | + $duration = $Spotter->getFlightDurationByOwner($owner, $filter); |
|
136 | 136 | if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
137 | 137 | print '</div>'; |
138 | 138 | |
139 | 139 | include('owner-sub-menu.php'); |
140 | 140 | print '<div class="table column">'; |
141 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
141 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
142 | 142 | |
143 | 143 | include('table-output.php'); |
144 | 144 | print '<div class="pagination">'; |
@@ -45,8 +45,12 @@ discard block |
||
45 | 45 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
46 | 46 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
47 | 47 | $filter = array(); |
48 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
49 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
48 | + if ($year != '') { |
|
49 | + $filter = array_merge($filter,array('year' => $year)); |
|
50 | + } |
|
51 | + if ($month != '') { |
|
52 | + $filter = array_merge($filter,array('month' => $month)); |
|
53 | + } |
|
50 | 54 | if ($sort != '') |
51 | 55 | { |
52 | 56 | $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
@@ -64,8 +68,12 @@ discard block |
||
64 | 68 | { |
65 | 69 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']); |
66 | 70 | //$ident = $spotter_array[0]['ident']; |
67 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
68 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
71 | + if (isset($spotter_array[0]['latitude'])) { |
|
72 | + $latitude = $spotter_array[0]['latitude']; |
|
73 | + } |
|
74 | + if (isset($spotter_array[0]['longitude'])) { |
|
75 | + $longitude = $spotter_array[0]['longitude']; |
|
76 | + } |
|
69 | 77 | require_once('header.php'); |
70 | 78 | /* |
71 | 79 | if (isset($globalArchive) && $globalArchive) { |
@@ -120,9 +128,14 @@ discard block |
||
120 | 128 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
121 | 129 | //print '<div><span class="label">'._("Owner").'</span>'.$spotter_array[0]['aircraft_owner'].'</div>'; |
122 | 130 | $Stats = new Stats(); |
123 | - if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner); |
|
124 | - else $flights = 0; |
|
125 | - if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter); |
|
131 | + if ($year == '' && $month == '') { |
|
132 | + $flights = $Stats->getStatsOwner($owner); |
|
133 | + } else { |
|
134 | + $flights = 0; |
|
135 | + } |
|
136 | + if ($flights == 0) { |
|
137 | + $flights = $Spotter->countFlightsByOwner($owner,$filter); |
|
138 | + } |
|
126 | 139 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
127 | 140 | $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter)); |
128 | 141 | print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>'; |
@@ -133,7 +146,9 @@ discard block |
||
133 | 146 | $airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter)); |
134 | 147 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
135 | 148 | $duration = $Spotter->getFlightDurationByOwner($owner,$filter); |
136 | - if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
|
149 | + if ($duration != '0') { |
|
150 | + print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
|
151 | + } |
|
137 | 152 | print '</div>'; |
138 | 153 | |
139 | 154 | include('owner-sub-menu.php'); |