@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if (isset($this->all_tracked[$key]['id'])) { |
48 | 48 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
49 | 49 | $Tracker = new Tracker($this->db); |
50 | - $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
50 | + $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
59 | 59 | foreach ($this->all_tracked as $key => $flight) { |
60 | 60 | if (isset($flight['lastupdate'])) { |
61 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
61 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
62 | 62 | if (isset($this->all_tracked[$key]['id'])) { |
63 | 63 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
64 | 64 | /* |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | //$real_arrival = $this->arrival($key); |
70 | 70 | $Tracker = new Tracker($this->db); |
71 | 71 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
72 | - $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
|
72 | + $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed']); |
|
73 | 73 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
74 | 74 | } |
75 | 75 | // Put in archive |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $send = false; |
90 | 90 | |
91 | 91 | // SBS format is CSV format |
92 | - if(is_array($line) && isset($line['ident'])) { |
|
92 | + if (is_array($line) && isset($line['ident'])) { |
|
93 | 93 | //print_r($line); |
94 | 94 | if (isset($line['ident'])) { |
95 | 95 | |
@@ -113,33 +113,33 @@ discard block |
||
113 | 113 | |
114 | 114 | if (!isset($this->all_tracked[$id])) { |
115 | 115 | $this->all_tracked[$id] = array(); |
116 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
117 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
118 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
116 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedTracker' => 0)); |
|
117 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '')); |
|
118 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
119 | 119 | if (!isset($line['id'])) { |
120 | 120 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
121 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
122 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
121 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
122 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); |
|
123 | 123 | if ($globalAllTracked !== FALSE) $dataFound = true; |
124 | 124 | } |
125 | 125 | |
126 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
126 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
127 | 127 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
128 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
128 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
129 | 129 | } else { |
130 | 130 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
131 | 131 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
132 | 132 | return ''; |
133 | 133 | } |
134 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
134 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
135 | 135 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
136 | 136 | return ''; |
137 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
137 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
138 | 138 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
139 | 139 | return ''; |
140 | 140 | } elseif (!isset($line['datetime'])) { |
141 | 141 | date_default_timezone_set('UTC'); |
142 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
142 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
143 | 143 | } else { |
144 | 144 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
145 | 145 | return ''; |
@@ -147,38 +147,38 @@ discard block |
||
147 | 147 | |
148 | 148 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
149 | 149 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
150 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
150 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
151 | 151 | if ($this->all_tracked[$id]['addedTracker'] == 1) { |
152 | 152 | $timeelapsed = microtime(true); |
153 | 153 | $Tracker = new Tracker($this->db); |
154 | 154 | $fromsource = NULL; |
155 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
155 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
156 | 156 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
157 | 157 | $Tracker->db = null; |
158 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
158 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
159 | 159 | } |
160 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
160 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | if (isset($line['speed']) && $line['speed'] != '') { |
164 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
164 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed']))); |
|
165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
166 | 166 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
167 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
167 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
168 | 168 | if ($distance > 100 && $distance < 10000) { |
169 | 169 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
170 | 170 | $speed = $speed*3.6; |
171 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
171 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed))); |
|
172 | 172 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | 176 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
177 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
178 | 178 | else unset($timediff); |
179 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
179 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) { |
|
180 | 180 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
181 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
|
181 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'], 0.08)) { |
|
182 | 182 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
183 | 183 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
184 | 184 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
187 | 187 | $timeelapsed = microtime(true); |
188 | 188 | $Tracker = new Tracker($this->db); |
189 | - $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
189 | + $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
190 | 190 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
191 | 191 | $Tracker->db = null; |
192 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
192 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
193 | 193 | $this->tmd = 0; |
194 | 194 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
195 | 195 | } |
@@ -197,75 +197,75 @@ discard block |
||
197 | 197 | |
198 | 198 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
199 | 199 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
200 | - if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
200 | + if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
201 | 201 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
202 | 202 | $dataFound = true; |
203 | 203 | $this->all_tracked[$id]['time_last_coord'] = time(); |
204 | 204 | } |
205 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
205 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
206 | 206 | } |
207 | 207 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
208 | 208 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
209 | 209 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
210 | - if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
210 | + if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
211 | 211 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
212 | 212 | $dataFound = true; |
213 | 213 | $this->all_tracked[$id]['time_last_coord'] = time(); |
214 | 214 | } |
215 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
215 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | } else if ($globalDebug && $timediff > 20) { |
219 | 219 | $this->tmd = $this->tmd + 1; |
220 | 220 | if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) { |
221 | 221 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
222 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
223 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
222 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
223 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
224 | 224 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
225 | 225 | } |
226 | 226 | } |
227 | 227 | } |
228 | 228 | if (isset($line['last_update']) && $line['last_update'] != '') { |
229 | 229 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
230 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
230 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
231 | 231 | } |
232 | 232 | if (isset($line['format_source']) && $line['format_source'] != '') { |
233 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
233 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
234 | 234 | } |
235 | 235 | if (isset($line['source_name']) && $line['source_name'] != '') { |
236 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
236 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
237 | 237 | } |
238 | 238 | if (isset($line['comment']) && $line['comment'] != '') { |
239 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
239 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('comment' => $line['comment'])); |
|
240 | 240 | //$dataFound = true; |
241 | 241 | } |
242 | 242 | if (isset($line['type']) && $line['type'] != '') { |
243 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
243 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
244 | 244 | //$dataFound = true; |
245 | 245 | } |
246 | 246 | |
247 | 247 | if (isset($line['altitude']) && $line['altitude'] != '') { |
248 | 248 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
249 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
|
251 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
|
249 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude' => $line['altitude'])); |
|
251 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude_real' => $line['altitude'])); |
|
252 | 252 | //$dataFound = true; |
253 | 253 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
254 | 254 | } |
255 | 255 | |
256 | 256 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
257 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
257 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | if (isset($line['heading']) && $line['heading'] != '') { |
261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
263 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
261 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
263 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
264 | 264 | //$dataFound = true; |
265 | 265 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
266 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
267 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
266 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
267 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); |
|
268 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | 269 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
270 | 270 | } |
271 | 271 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -273,54 +273,54 @@ discard block |
||
273 | 273 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
274 | 274 | $this->all_tracked[$id]['lastupdate'] = time(); |
275 | 275 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
276 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
276 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
277 | 277 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
278 | 278 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
279 | 279 | $timeelapsed = microtime(true); |
280 | 280 | $TrackerLive = new TrackerLive($this->db); |
281 | 281 | if (isset($line['id'])) { |
282 | 282 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
283 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
284 | 284 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
285 | 285 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
286 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
287 | 287 | } else $recent_ident = ''; |
288 | - $TrackerLive->db=null; |
|
288 | + $TrackerLive->db = null; |
|
289 | 289 | |
290 | 290 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
291 | 291 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
292 | 292 | } else { |
293 | 293 | $recent_ident = ''; |
294 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
294 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
295 | 295 | } |
296 | 296 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
297 | - if($recent_ident == "") |
|
297 | + if ($recent_ident == "") |
|
298 | 298 | { |
299 | 299 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
300 | 300 | //adds the spotter data for the archive |
301 | 301 | $highlight = ''; |
302 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
302 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
303 | 303 | $timeelapsed = microtime(true); |
304 | 304 | $Tracker = new Tracker($this->db); |
305 | - $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
305 | + $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']); |
|
306 | 306 | $Tracker->db = null; |
307 | 307 | if ($globalDebug && isset($result)) echo $result."\n"; |
308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
308 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
309 | 309 | |
310 | 310 | |
311 | 311 | // Add source stat in DB |
312 | 312 | $Stats = new Stats($this->db); |
313 | 313 | if (!empty($this->stats)) { |
314 | 314 | if ($globalDebug) echo 'Add source stats : '; |
315 | - foreach($this->stats as $date => $data) { |
|
316 | - foreach($data as $source => $sourced) { |
|
315 | + foreach ($this->stats as $date => $data) { |
|
316 | + foreach ($data as $source => $sourced) { |
|
317 | 317 | //print_r($sourced); |
318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
318 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_tracker', $date); |
|
319 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_tracker', $date); |
|
320 | 320 | if (isset($sourced['msg'])) { |
321 | 321 | if (time() - $sourced['msg']['date'] > 10) { |
322 | 322 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
323 | - echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
323 | + echo $Stats->addStatSource($nbmsg, $source, 'msg_tracker', $date); |
|
324 | 324 | unset($this->stats[$date][$source]['msg']); |
325 | 325 | } |
326 | 326 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
344 | 344 | $TrackerLive = new TrackerLive($this->db); |
345 | 345 | $TrackerLive->deleteLiveTrackerData(); |
346 | - $TrackerLive->db=null; |
|
346 | + $TrackerLive->db = null; |
|
347 | 347 | if ($globalDebug) echo " Done\n"; |
348 | 348 | $this->last_delete = time(); |
349 | 349 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $this->all_tracked[$id]['addedTracker'] = 1; |
353 | 353 | if (isset($globalDaemon) && !$globalDaemon) { |
354 | 354 | $Tracker = new Tracker($this->db); |
355 | - $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['altitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
|
355 | + $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']); |
|
356 | 356 | $Tracker->db = null; |
357 | 357 | } |
358 | 358 | |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | $ignoreImport = false; |
367 | 367 | |
368 | 368 | if (!$ignoreImport) { |
369 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
369 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
370 | 370 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
371 | 371 | $timeelapsed = microtime(true); |
372 | 372 | $TrackerLive = new TrackerLive($this->db); |
373 | - $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
373 | + $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
374 | 374 | $TrackerLive->db = null; |
375 | 375 | $this->all_tracked[$id]['putinarchive'] = false; |
376 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
376 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
377 | 377 | |
378 | 378 | // Put statistics in $this->stats variable |
379 | 379 | |
@@ -390,19 +390,19 @@ discard block |
||
390 | 390 | $latitude = $globalCenterLatitude; |
391 | 391 | $longitude = $globalCenterLongitude; |
392 | 392 | } |
393 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
393 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
394 | 394 | } else { |
395 | 395 | $latitude = $this->source_location[$source]['latitude']; |
396 | 396 | $longitude = $this->source_location[$source]['longitude']; |
397 | 397 | } |
398 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
398 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
399 | 399 | //$stats_heading = $stats_heading%22.5; |
400 | 400 | $stats_heading = round($stats_heading/22.5); |
401 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
401 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
402 | 402 | $current_date = date('Y-m-d'); |
403 | 403 | if ($stats_heading == 16) $stats_heading = 0; |
404 | 404 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
405 | - for ($i=0;$i<=15;$i++) { |
|
405 | + for ($i = 0; $i <= 15; $i++) { |
|
406 | 406 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
407 | 407 | } |
408 | 408 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
418 | 418 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
419 | 419 | end($this->stats[$current_date][$source]['hist']); |
420 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
420 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
421 | 421 | } else $mini = 0; |
422 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
422 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
423 | 423 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
424 | 424 | } |
425 | 425 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | $this->all_tracked[$id]['lastupdate'] = time(); |
432 | 432 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
433 | 433 | if ($globalDebug) echo $result."\n"; |
434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
434 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
435 | 435 | //$this->del(); |
436 | 436 | |
437 | 437 |
@@ -14,33 +14,33 @@ discard block |
||
14 | 14 | * @param Array $filter the filter |
15 | 15 | * @return Array the SQL part |
16 | 16 | */ |
17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
23 | 23 | } else { |
24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | if (isset($filter[0]['source'])) { |
28 | - $filters = array_merge($filters,$filter); |
|
28 | + $filters = array_merge($filters, $filter); |
|
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
31 | 31 | $filter_query_join = ''; |
32 | 32 | $filter_query_where = ''; |
33 | - foreach($filters as $flt) { |
|
33 | + foreach ($filters as $flt) { |
|
34 | 34 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
35 | 35 | if (isset($flt['source'])) { |
36 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
36 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
37 | 37 | } else { |
38 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
38 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | if (isset($filter['source']) && !empty($filter['source'])) { |
43 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
43 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
44 | 44 | } |
45 | 45 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
46 | 46 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -68,38 +68,38 @@ discard block |
||
68 | 68 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_archive_output.date) = '".$filter['day']."'"; |
69 | 69 | } |
70 | 70 | } |
71 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
71 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
72 | 72 | } |
73 | 73 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
74 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
74 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
75 | 75 | } |
76 | 76 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
77 | 77 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
78 | 78 | if ($filter_query_where != '') { |
79 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
79 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
80 | 80 | } |
81 | 81 | $filter_query = $filter_query_join.$filter_query_where; |
82 | 82 | return $filter_query; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // tracker_archive |
86 | - public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') { |
|
86 | + public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') { |
|
87 | 87 | require_once(dirname(__FILE__).'/class.Tracker.php'); |
88 | 88 | if ($over_country == '') { |
89 | 89 | $Tracker = new Tracker($this->db); |
90 | - $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
90 | + $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
91 | 91 | if (!empty($data_country)) $country = $data_country['iso2']; |
92 | 92 | else $country = ''; |
93 | 93 | } else $country = $over_country; |
94 | 94 | // Route is not added in tracker_archive |
95 | - $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
95 | + $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
96 | 96 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
97 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $country,':comment' => $comment,':type' => $type); |
|
97 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $country, ':comment' => $comment, ':type' => $type); |
|
98 | 98 | try { |
99 | 99 | $sth = $this->db->prepare($query); |
100 | 100 | $sth->execute($query_values); |
101 | 101 | $sth->closeCursor(); |
102 | - } catch(PDOException $e) { |
|
102 | + } catch (PDOException $e) { |
|
103 | 103 | return "error : ".$e->getMessage(); |
104 | 104 | } |
105 | 105 | return "success"; |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | |
120 | 120 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
121 | 121 | //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
122 | - $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
122 | + $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
123 | 123 | |
124 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
124 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident)); |
|
125 | 125 | |
126 | 126 | return $spotter_array; |
127 | 127 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
141 | 141 | //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
142 | 142 | //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
143 | - $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
143 | + $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
144 | 144 | |
145 | 145 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
146 | 146 | /* |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
155 | 155 | */ |
156 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
156 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id)); |
|
157 | 157 | |
158 | 158 | return $spotter_array; |
159 | 159 | } |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | * @return Array the spotter information |
165 | 165 | * |
166 | 166 | */ |
167 | - public function getAllArchiveTrackerDataById($id,$date = '') |
|
167 | + public function getAllArchiveTrackerDataById($id, $date = '') |
|
168 | 168 | { |
169 | 169 | date_default_timezone_set('UTC'); |
170 | 170 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
171 | - if ($date == '') $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
172 | - else $query = $this->global_query." WHERE tracker_archive.famtrackid = :id AND date < '".date('c',$date)."' ORDER BY date"; |
|
171 | + if ($date == '') $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
172 | + else $query = $this->global_query." WHERE tracker_archive.famtrackid = :id AND date < '".date('c', $date)."' ORDER BY date"; |
|
173 | 173 | |
174 | 174 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
175 | 175 | |
176 | 176 | try { |
177 | 177 | $sth = $this->db->prepare($query); |
178 | 178 | $sth->execute(array(':id' => $id)); |
179 | - } catch(PDOException $e) { |
|
179 | + } catch (PDOException $e) { |
|
180 | 180 | echo $e->getMessage(); |
181 | 181 | die; |
182 | 182 | } |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | { |
196 | 196 | date_default_timezone_set('UTC'); |
197 | 197 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
198 | - $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
198 | + $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
199 | 199 | |
200 | 200 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
201 | 201 | |
202 | 202 | try { |
203 | 203 | $sth = $this->db->prepare($query); |
204 | 204 | $sth->execute(array(':id' => $id)); |
205 | - } catch(PDOException $e) { |
|
205 | + } catch (PDOException $e) { |
|
206 | 206 | echo $e->getMessage(); |
207 | 207 | die; |
208 | 208 | } |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | date_default_timezone_set('UTC'); |
225 | 225 | |
226 | 226 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
227 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
227 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
228 | 228 | |
229 | 229 | try { |
230 | 230 | $sth = $this->db->prepare($query); |
231 | 231 | $sth->execute(array(':ident' => $ident)); |
232 | - } catch(PDOException $e) { |
|
232 | + } catch (PDOException $e) { |
|
233 | 233 | echo $e->getMessage(); |
234 | 234 | die; |
235 | 235 | } |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | date_default_timezone_set('UTC'); |
251 | 251 | |
252 | 252 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
253 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
253 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
254 | 254 | |
255 | 255 | try { |
256 | 256 | $sth = $this->db->prepare($query); |
257 | 257 | $sth->execute(array(':id' => $id)); |
258 | - } catch(PDOException $e) { |
|
258 | + } catch (PDOException $e) { |
|
259 | 259 | echo $e->getMessage(); |
260 | 260 | die; |
261 | 261 | } |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | date_default_timezone_set('UTC'); |
277 | 277 | |
278 | 278 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
279 | - $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
279 | + $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
280 | 280 | |
281 | 281 | try { |
282 | 282 | $sth = $this->db->prepare($query); |
283 | 283 | $sth->execute(array(':id' => $id)); |
284 | - } catch(PDOException $e) { |
|
284 | + } catch (PDOException $e) { |
|
285 | 285 | echo $e->getMessage(); |
286 | 286 | die; |
287 | 287 | } |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | date_default_timezone_set('UTC'); |
304 | 304 | |
305 | 305 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
306 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
306 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
307 | 307 | // $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident"; |
308 | 308 | |
309 | 309 | try { |
310 | 310 | $sth = $this->db->prepare($query); |
311 | 311 | $sth->execute(array(':ident' => $ident)); |
312 | - } catch(PDOException $e) { |
|
312 | + } catch (PDOException $e) { |
|
313 | 313 | echo $e->getMessage(); |
314 | 314 | die; |
315 | 315 | } |
@@ -326,13 +326,13 @@ discard block |
||
326 | 326 | * @return Array the spotter information |
327 | 327 | * |
328 | 328 | */ |
329 | - public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
329 | + public function getTrackerArchiveData($ident, $famtrackid, $date) |
|
330 | 330 | { |
331 | 331 | $Tracker = new Tracker($this->db); |
332 | 332 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
333 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
333 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
334 | 334 | |
335 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
335 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':famtrackid' => $famtrackid, ':date' => $date.'%')); |
|
336 | 336 | |
337 | 337 | return $spotter_array; |
338 | 338 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | try { |
349 | 349 | $sth = $this->db->prepare($query); |
350 | 350 | $sth->execute(); |
351 | - } catch(PDOException $e) { |
|
351 | + } catch (PDOException $e) { |
|
352 | 352 | echo $e->getMessage(); |
353 | 353 | die; |
354 | 354 | } |
@@ -360,24 +360,24 @@ discard block |
||
360 | 360 | * @return Array the spotter information |
361 | 361 | * |
362 | 362 | */ |
363 | - public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
363 | + public function getMinLiveTrackerData($begindate, $enddate, $filter = array()) |
|
364 | 364 | { |
365 | 365 | global $globalDBdriver, $globalLiveInterval; |
366 | 366 | date_default_timezone_set('UTC'); |
367 | 367 | |
368 | 368 | $filter_query = ''; |
369 | 369 | if (isset($filter['source']) && !empty($filter['source'])) { |
370 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
370 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
371 | 371 | } |
372 | 372 | // Use spotter_output also ? |
373 | 373 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
374 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
374 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
375 | 375 | } |
376 | 376 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
377 | 377 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
378 | 378 | } |
379 | 379 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
380 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
380 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid |
397 | 397 | AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
398 | 398 | */ |
399 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
399 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
400 | 400 | FROM tracker_archive |
401 | 401 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
402 | 402 | WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
403 | 403 | '.$filter_query.' ORDER BY famtrackid'; |
404 | 404 | } else { |
405 | 405 | //$query = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao'; |
406 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
406 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
407 | 407 | FROM tracker_archive |
408 | 408 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
409 | 409 | WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".' |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | try { |
414 | 414 | $sth = $this->db->prepare($query); |
415 | 415 | $sth->execute(); |
416 | - } catch(PDOException $e) { |
|
416 | + } catch (PDOException $e) { |
|
417 | 417 | echo $e->getMessage(); |
418 | 418 | die; |
419 | 419 | } |
@@ -428,24 +428,24 @@ discard block |
||
428 | 428 | * @return Array the spotter information |
429 | 429 | * |
430 | 430 | */ |
431 | - public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
431 | + public function getMinLiveTrackerDataPlayback($begindate, $enddate, $filter = array()) |
|
432 | 432 | { |
433 | 433 | global $globalDBdriver, $globalLiveInterval; |
434 | 434 | date_default_timezone_set('UTC'); |
435 | 435 | |
436 | 436 | $filter_query = ''; |
437 | 437 | if (isset($filter['source']) && !empty($filter['source'])) { |
438 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
438 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
439 | 439 | } |
440 | 440 | // Should use spotter_output also ? |
441 | 441 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
442 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
442 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
443 | 443 | } |
444 | 444 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
445 | 445 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
446 | 446 | } |
447 | 447 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
448 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
448 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | FROM tracker_archive |
456 | 456 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
457 | 457 | */ |
458 | - $query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk |
|
458 | + $query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk |
|
459 | 459 | FROM tracker_archive_output |
460 | 460 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive_output.aircraft_icao = a.icao |
461 | 461 | WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
471 | 471 | '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow'; |
472 | 472 | */ |
473 | - $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
473 | + $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
474 | 474 | FROM tracker_archive_output |
475 | 475 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
476 | 476 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | try { |
483 | 483 | $sth = $this->db->prepare($query); |
484 | 484 | $sth->execute(); |
485 | - } catch(PDOException $e) { |
|
485 | + } catch (PDOException $e) { |
|
486 | 486 | echo $e->getMessage(); |
487 | 487 | die; |
488 | 488 | } |
@@ -497,23 +497,23 @@ discard block |
||
497 | 497 | * @return Array the spotter information |
498 | 498 | * |
499 | 499 | */ |
500 | - public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
500 | + public function getLiveTrackerCount($begindate, $enddate, $filter = array()) |
|
501 | 501 | { |
502 | 502 | global $globalDBdriver, $globalLiveInterval; |
503 | 503 | date_default_timezone_set('UTC'); |
504 | 504 | |
505 | 505 | $filter_query = ''; |
506 | 506 | if (isset($filter['source']) && !empty($filter['source'])) { |
507 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
507 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
508 | 508 | } |
509 | 509 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
510 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
510 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
511 | 511 | } |
512 | 512 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
513 | 513 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
514 | 514 | } |
515 | 515 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
516 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
516 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | try { |
529 | 529 | $sth = $this->db->prepare($query); |
530 | 530 | $sth->execute(); |
531 | - } catch(PDOException $e) { |
|
531 | + } catch (PDOException $e) { |
|
532 | 532 | echo $e->getMessage(); |
533 | 533 | die; |
534 | 534 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @return Array the spotter information |
549 | 549 | * |
550 | 550 | */ |
551 | - public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
551 | + public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
552 | 552 | { |
553 | 553 | global $globalTimezone, $globalDBdriver; |
554 | 554 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | |
571 | 571 | $q_array = explode(" ", $q); |
572 | 572 | |
573 | - foreach ($q_array as $q_item){ |
|
573 | + foreach ($q_array as $q_item) { |
|
574 | 574 | $additional_query .= " AND ("; |
575 | 575 | $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
576 | 576 | $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | |
603 | 603 | if ($registration != "") |
604 | 604 | { |
605 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
605 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
606 | 606 | if (!is_string($registration)) |
607 | 607 | { |
608 | 608 | return false; |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | |
614 | 614 | if ($aircraft_icao != "") |
615 | 615 | { |
616 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
616 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
617 | 617 | if (!is_string($aircraft_icao)) |
618 | 618 | { |
619 | 619 | return false; |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | |
625 | 625 | if ($aircraft_manufacturer != "") |
626 | 626 | { |
627 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
627 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
628 | 628 | if (!is_string($aircraft_manufacturer)) |
629 | 629 | { |
630 | 630 | return false; |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | |
646 | 646 | if ($airline_icao != "") |
647 | 647 | { |
648 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
648 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
649 | 649 | if (!is_string($airline_icao)) |
650 | 650 | { |
651 | 651 | return false; |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | |
657 | 657 | if ($airline_country != "") |
658 | 658 | { |
659 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
659 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
660 | 660 | if (!is_string($airline_country)) |
661 | 661 | { |
662 | 662 | return false; |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | |
668 | 668 | if ($airline_type != "") |
669 | 669 | { |
670 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
670 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
671 | 671 | if (!is_string($airline_type)) |
672 | 672 | { |
673 | 673 | return false; |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | |
690 | 690 | if ($airport != "") |
691 | 691 | { |
692 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
692 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
693 | 693 | if (!is_string($airport)) |
694 | 694 | { |
695 | 695 | return false; |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | |
701 | 701 | if ($airport_country != "") |
702 | 702 | { |
703 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
703 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
704 | 704 | if (!is_string($airport_country)) |
705 | 705 | { |
706 | 706 | return false; |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | |
712 | 712 | if ($callsign != "") |
713 | 713 | { |
714 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
714 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
715 | 715 | if (!is_string($callsign)) |
716 | 716 | { |
717 | 717 | return false; |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | $translate = $Translation->ident2icao($callsign); |
720 | 720 | if ($translate != $callsign) { |
721 | 721 | $additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)"; |
722 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
722 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
723 | 723 | } else { |
724 | 724 | $additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')"; |
725 | 725 | } |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | |
729 | 729 | if ($owner != "") |
730 | 730 | { |
731 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
731 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
732 | 732 | if (!is_string($owner)) |
733 | 733 | { |
734 | 734 | return false; |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | |
740 | 740 | if ($pilot_name != "") |
741 | 741 | { |
742 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
742 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
743 | 743 | if (!is_string($pilot_name)) |
744 | 744 | { |
745 | 745 | return false; |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | |
751 | 751 | if ($pilot_id != "") |
752 | 752 | { |
753 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
753 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
754 | 754 | if (!is_string($pilot_id)) |
755 | 755 | { |
756 | 756 | return false; |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | |
762 | 762 | if ($departure_airport_route != "") |
763 | 763 | { |
764 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
764 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
765 | 765 | if (!is_string($departure_airport_route)) |
766 | 766 | { |
767 | 767 | return false; |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | |
773 | 773 | if ($arrival_airport_route != "") |
774 | 774 | { |
775 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
775 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
776 | 776 | if (!is_string($arrival_airport_route)) |
777 | 777 | { |
778 | 778 | return false; |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | { |
786 | 786 | $altitude_array = explode(",", $altitude); |
787 | 787 | |
788 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
789 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
788 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
789 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
790 | 790 | |
791 | 791 | |
792 | 792 | if ($altitude_array[1] != "") |
@@ -804,8 +804,8 @@ discard block |
||
804 | 804 | { |
805 | 805 | $date_array = explode(",", $date_posted); |
806 | 806 | |
807 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
808 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
807 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
808 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
809 | 809 | |
810 | 810 | if ($globalTimezone != '') { |
811 | 811 | date_default_timezone_set($globalTimezone); |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | { |
838 | 838 | $limit_array = explode(",", $limit); |
839 | 839 | |
840 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
841 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
840 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
841 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
842 | 842 | |
843 | 843 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
844 | 844 | { |
@@ -849,8 +849,8 @@ discard block |
||
849 | 849 | |
850 | 850 | |
851 | 851 | if ($origLat != "" && $origLon != "" && $dist != "") { |
852 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
853 | - $query="SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
852 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
853 | + $query = "SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
854 | 854 | FROM tracker_archive_output, tracker_archive WHERE spotter_output_archive.famtrackid = tracker_archive.famtrackid AND spotter_output.ident <> '' ".$additional_query."AND CAST(tracker_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(tracker_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
855 | 855 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
856 | 856 | } else { |
@@ -867,12 +867,12 @@ discard block |
||
867 | 867 | $additional_query .= " AND (tracker_archive_output.waypoints <> '')"; |
868 | 868 | } |
869 | 869 | |
870 | - $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
870 | + $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
871 | 871 | WHERE tracker_archive_output.ident <> '' |
872 | 872 | ".$additional_query." |
873 | 873 | ".$filter_query.$orderby_query; |
874 | 874 | } |
875 | - $spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query); |
|
875 | + $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
|
876 | 876 | |
877 | 877 | return $spotter_array; |
878 | 878 | } |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | try { |
890 | 890 | $sth = $this->db->prepare($query); |
891 | 891 | $sth->execute(); |
892 | - } catch(PDOException $e) { |
|
892 | + } catch (PDOException $e) { |
|
893 | 893 | return "error"; |
894 | 894 | } |
895 | 895 | } |
@@ -926,8 +926,8 @@ discard block |
||
926 | 926 | { |
927 | 927 | $limit_array = explode(",", $limit); |
928 | 928 | |
929 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
930 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
929 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
930 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
931 | 931 | |
932 | 932 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
933 | 933 | { |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | $query_values = array(); |
969 | 969 | $limit_query = ''; |
970 | 970 | $additional_query = ''; |
971 | - $filter_query = $this->getFilter($filter,true,true); |
|
971 | + $filter_query = $this->getFilter($filter, true, true); |
|
972 | 972 | |
973 | 973 | if ($owner != "") |
974 | 974 | { |
@@ -985,8 +985,8 @@ discard block |
||
985 | 985 | { |
986 | 986 | $limit_array = explode(",", $limit); |
987 | 987 | |
988 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
989 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
988 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
989 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
990 | 990 | |
991 | 991 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
992 | 992 | { |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | $query_values = array(); |
1027 | 1027 | $limit_query = ''; |
1028 | 1028 | $additional_query = ''; |
1029 | - $filter_query = $this->getFilter($filter,true,true); |
|
1029 | + $filter_query = $this->getFilter($filter, true, true); |
|
1030 | 1030 | |
1031 | 1031 | if ($pilot != "") |
1032 | 1032 | { |
@@ -1038,8 +1038,8 @@ discard block |
||
1038 | 1038 | { |
1039 | 1039 | $limit_array = explode(",", $limit); |
1040 | 1040 | |
1041 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1042 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1041 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1042 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1043 | 1043 | |
1044 | 1044 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1045 | 1045 | { |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | * @return Array the airline country list |
1070 | 1070 | * |
1071 | 1071 | */ |
1072 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1072 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1073 | 1073 | { |
1074 | 1074 | global $globalDBdriver; |
1075 | 1075 | /* |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | $flight_array = array(); |
1099 | 1099 | $temp_array = array(); |
1100 | 1100 | |
1101 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1101 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1102 | 1102 | { |
1103 | 1103 | $temp_array['flight_count'] = $row['nb']; |
1104 | 1104 | $temp_array['flight_country'] = $row['name']; |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | * @return Array the airline country list |
1116 | 1116 | * |
1117 | 1117 | */ |
1118 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1118 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1119 | 1119 | { |
1120 | 1120 | global $globalDBdriver; |
1121 | 1121 | /* |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | $flight_array = array(); |
1145 | 1145 | $temp_array = array(); |
1146 | 1146 | |
1147 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1147 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1148 | 1148 | { |
1149 | 1149 | $temp_array['airline_icao'] = $row['airline_icao']; |
1150 | 1150 | $temp_array['flight_count'] = $row['nb']; |
@@ -1162,14 +1162,14 @@ discard block |
||
1162 | 1162 | * @return Array the spotter information |
1163 | 1163 | * |
1164 | 1164 | */ |
1165 | - public function getDateArchiveTrackerDataById($id,$date) |
|
1165 | + public function getDateArchiveTrackerDataById($id, $date) |
|
1166 | 1166 | { |
1167 | 1167 | $Tracker = new Tracker($this->db); |
1168 | 1168 | date_default_timezone_set('UTC'); |
1169 | 1169 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1170 | - $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1171 | - $date = date('c',$date); |
|
1172 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1170 | + $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1171 | + $date = date('c', $date); |
|
1172 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1173 | 1173 | return $spotter_array; |
1174 | 1174 | } |
1175 | 1175 | |
@@ -1179,14 +1179,14 @@ discard block |
||
1179 | 1179 | * @return Array the spotter information |
1180 | 1180 | * |
1181 | 1181 | */ |
1182 | - public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
1182 | + public function getDateArchiveTrackerDataByIdent($ident, $date) |
|
1183 | 1183 | { |
1184 | 1184 | $Tracker = new Tracker($this->db); |
1185 | 1185 | date_default_timezone_set('UTC'); |
1186 | 1186 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1187 | - $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1188 | - $date = date('c',$date); |
|
1189 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1187 | + $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1188 | + $date = date('c', $date); |
|
1189 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1190 | 1190 | return $spotter_array; |
1191 | 1191 | } |
1192 | 1192 | |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | * @return Array the spotter information |
1197 | 1197 | * |
1198 | 1198 | */ |
1199 | - public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1199 | + public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1200 | 1200 | { |
1201 | 1201 | global $global_query; |
1202 | 1202 | $Tracker = new Tracker($this->db); |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | $query_values = array(); |
1205 | 1205 | $limit_query = ''; |
1206 | 1206 | $additional_query = ''; |
1207 | - $filter_query = $this->getFilter($filters,true,true); |
|
1207 | + $filter_query = $this->getFilter($filters, true, true); |
|
1208 | 1208 | |
1209 | 1209 | if ($airport != "") |
1210 | 1210 | { |
@@ -1221,8 +1221,8 @@ discard block |
||
1221 | 1221 | { |
1222 | 1222 | $limit_array = explode(",", $limit); |
1223 | 1223 | |
1224 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1225 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1224 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1225 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1226 | 1226 | |
1227 | 1227 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1228 | 1228 | { |
@@ -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 | - $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 | + $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 | } |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
73 | 73 | } |
74 | 74 | } |
75 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
75 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
76 | 76 | } |
77 | 77 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
78 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
78 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
79 | 79 | } |
80 | 80 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
81 | 81 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
82 | 82 | if ($filter_query_where != '') { |
83 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
83 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
84 | 84 | } |
85 | 85 | $filter_query = $filter_query_join.$filter_query_where; |
86 | 86 | return $filter_query; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | if ($limit != '') |
104 | 104 | { |
105 | 105 | $limit_array = explode(',', $limit); |
106 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
107 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
106 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
107 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
108 | 108 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
109 | 109 | { |
110 | 110 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } else { |
128 | 128 | $query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query; |
129 | 129 | } |
130 | - $spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true); |
|
130 | + $spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true); |
|
131 | 131 | |
132 | 132 | return $spotter_array; |
133 | 133 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | global $globalDBdriver, $globalLiveInterval; |
144 | 144 | date_default_timezone_set('UTC'); |
145 | 145 | |
146 | - $filter_query = $this->getFilter($filter,true,true); |
|
146 | + $filter_query = $this->getFilter($filter, true, true); |
|
147 | 147 | |
148 | 148 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
149 | 149 | if ($globalDBdriver == 'mysql') { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | try { |
162 | 162 | $sth = $this->db->prepare($query); |
163 | 163 | $sth->execute(); |
164 | - } catch(PDOException $e) { |
|
164 | + } catch (PDOException $e) { |
|
165 | 165 | echo $e->getMessage(); |
166 | 166 | die; |
167 | 167 | } |
@@ -176,25 +176,25 @@ discard block |
||
176 | 176 | * @return Array the spotter information |
177 | 177 | * |
178 | 178 | */ |
179 | - public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false) |
|
179 | + public function getMinLastLiveTrackerData($coord, $filter = array(), $limit = false) |
|
180 | 180 | { |
181 | 181 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit; |
182 | 182 | date_default_timezone_set('UTC'); |
183 | 183 | $usecoord = false; |
184 | 184 | if (is_array($coord) && !empty($coord)) { |
185 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
186 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
187 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
188 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
185 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
186 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
187 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
188 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
189 | 189 | $usecoord = true; |
190 | 190 | } |
191 | - $filter_query = $this->getFilter($filter,true,true); |
|
191 | + $filter_query = $this->getFilter($filter, true, true); |
|
192 | 192 | |
193 | 193 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
194 | 194 | if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300'; |
195 | 195 | if ($globalDBdriver == 'mysql') { |
196 | 196 | if (isset($globalArchive) && $globalArchive) { |
197 | - $query = "SELECT * FROM ( |
|
197 | + $query = "SELECT * FROM ( |
|
198 | 198 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
199 | 199 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
200 | 200 | if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | } else { |
218 | 218 | if (isset($globalArchive) && $globalArchive) { |
219 | - $query = "SELECT * FROM ( |
|
219 | + $query = "SELECT * FROM ( |
|
220 | 220 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
221 | 221 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
222 | 222 | if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | try { |
241 | 241 | $sth = $this->db->prepare($query); |
242 | 242 | $sth->execute(); |
243 | - } catch(PDOException $e) { |
|
243 | + } catch (PDOException $e) { |
|
244 | 244 | echo $e->getMessage(); |
245 | 245 | die; |
246 | 246 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | public function getLiveTrackerCount($filter = array()) |
258 | 258 | { |
259 | 259 | global $globalDBdriver, $globalLiveInterval; |
260 | - $filter_query = $this->getFilter($filter,true,true); |
|
260 | + $filter_query = $this->getFilter($filter, true, true); |
|
261 | 261 | |
262 | 262 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
263 | 263 | if ($globalDBdriver == 'mysql') { |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | try { |
269 | 269 | $sth = $this->db->prepare($query); |
270 | 270 | $sth->execute(); |
271 | - } catch(PDOException $e) { |
|
271 | + } catch (PDOException $e) { |
|
272 | 272 | echo $e->getMessage(); |
273 | 273 | die; |
274 | 274 | } |
@@ -291,10 +291,10 @@ discard block |
||
291 | 291 | $filter_query = $this->getFilter($filter); |
292 | 292 | |
293 | 293 | if (is_array($coord)) { |
294 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
295 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
296 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
297 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
294 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
295 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
296 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
297 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
298 | 298 | } else return array(); |
299 | 299 | if ($globalDBdriver == 'mysql') { |
300 | 300 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
@@ -316,13 +316,13 @@ discard block |
||
316 | 316 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
317 | 317 | $Tracker = new Tracker($this->db); |
318 | 318 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
319 | - $filter_query = $this->getFilter($filter,true,true); |
|
319 | + $filter_query = $this->getFilter($filter, true, true); |
|
320 | 320 | |
321 | 321 | if (is_array($coord)) { |
322 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
323 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
324 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
325 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
322 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
323 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
324 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
325 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
326 | 326 | } else return array(); |
327 | 327 | /* |
328 | 328 | if ($globalDBdriver == 'mysql') { |
@@ -336,13 +336,13 @@ discard block |
||
336 | 336 | */ |
337 | 337 | if ($globalDBdriver == 'mysql') { |
338 | 338 | if (isset($globalArchive) && $globalArchive === TRUE) { |
339 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
339 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
340 | 340 | FROM tracker_live |
341 | 341 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= tracker_live.date |
342 | 342 | AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
343 | 343 | AND tracker_live.latitude <> 0 AND tracker_live.longitude <> 0'; |
344 | 344 | } else { |
345 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
345 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
346 | 346 | FROM tracker_live |
347 | 347 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate |
348 | 348 | FROM tracker_live l |
@@ -354,14 +354,14 @@ discard block |
||
354 | 354 | } |
355 | 355 | } else { |
356 | 356 | if (isset($globalArchive) && $globalArchive === TRUE) { |
357 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
357 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
358 | 358 | FROM tracker_live |
359 | 359 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date |
360 | 360 | AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
361 | 361 | AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
362 | 362 | AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0'"; |
363 | 363 | } else { |
364 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
364 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
365 | 365 | FROM tracker_live |
366 | 366 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate |
367 | 367 | FROM tracker_live l |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | if ($interval == '1m') |
419 | 419 | { |
420 | 420 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
421 | - } else if ($interval == '15m'){ |
|
421 | + } else if ($interval == '15m') { |
|
422 | 422 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
423 | 423 | } |
424 | 424 | } |
@@ -426,14 +426,14 @@ discard block |
||
426 | 426 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
427 | 427 | } |
428 | 428 | |
429 | - $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
429 | + $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
430 | 430 | WHERE tracker_live.latitude <> '' |
431 | 431 | AND tracker_live.longitude <> '' |
432 | 432 | ".$additional_query." |
433 | 433 | HAVING distance < :radius |
434 | 434 | ORDER BY distance"; |
435 | 435 | |
436 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
436 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
437 | 437 | |
438 | 438 | return $spotter_array; |
439 | 439 | } |
@@ -451,9 +451,9 @@ discard block |
||
451 | 451 | date_default_timezone_set('UTC'); |
452 | 452 | |
453 | 453 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
454 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
454 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
455 | 455 | |
456 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
456 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
457 | 457 | |
458 | 458 | return $spotter_array; |
459 | 459 | } |
@@ -464,16 +464,16 @@ discard block |
||
464 | 464 | * @return Array the spotter information |
465 | 465 | * |
466 | 466 | */ |
467 | - public function getDateLiveTrackerDataByIdent($ident,$date) |
|
467 | + public function getDateLiveTrackerDataByIdent($ident, $date) |
|
468 | 468 | { |
469 | 469 | $Tracker = new Tracker($this->db); |
470 | 470 | date_default_timezone_set('UTC'); |
471 | 471 | |
472 | 472 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
473 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
473 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
474 | 474 | |
475 | - $date = date('c',$date); |
|
476 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
475 | + $date = date('c', $date); |
|
476 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
477 | 477 | |
478 | 478 | return $spotter_array; |
479 | 479 | } |
@@ -490,9 +490,9 @@ discard block |
||
490 | 490 | date_default_timezone_set('UTC'); |
491 | 491 | |
492 | 492 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
493 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
493 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
494 | 494 | |
495 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
|
495 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true); |
|
496 | 496 | |
497 | 497 | return $spotter_array; |
498 | 498 | } |
@@ -503,15 +503,15 @@ discard block |
||
503 | 503 | * @return Array the spotter information |
504 | 504 | * |
505 | 505 | */ |
506 | - public function getDateLiveTrackerDataById($id,$date) |
|
506 | + public function getDateLiveTrackerDataById($id, $date) |
|
507 | 507 | { |
508 | 508 | $Tracker = new Tracker($this->db); |
509 | 509 | date_default_timezone_set('UTC'); |
510 | 510 | |
511 | 511 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
512 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
513 | - $date = date('c',$date); |
|
514 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
512 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
513 | + $date = date('c', $date); |
|
514 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
515 | 515 | |
516 | 516 | return $spotter_array; |
517 | 517 | } |
@@ -528,13 +528,13 @@ discard block |
||
528 | 528 | date_default_timezone_set('UTC'); |
529 | 529 | |
530 | 530 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
531 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
531 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
532 | 532 | |
533 | 533 | try { |
534 | 534 | |
535 | 535 | $sth = $this->db->prepare($query); |
536 | 536 | $sth->execute(array(':ident' => $ident)); |
537 | - } catch(PDOException $e) { |
|
537 | + } catch (PDOException $e) { |
|
538 | 538 | echo $e->getMessage(); |
539 | 539 | die; |
540 | 540 | } |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | * @return Array the spotter information |
550 | 550 | * |
551 | 551 | */ |
552 | - public function getAllLiveTrackerDataById($id,$liveinterval = false) |
|
552 | + public function getAllLiveTrackerDataById($id, $liveinterval = false) |
|
553 | 553 | { |
554 | 554 | global $globalDBdriver, $globalLiveInterval; |
555 | 555 | date_default_timezone_set('UTC'); |
@@ -558,19 +558,19 @@ discard block |
||
558 | 558 | if ($globalDBdriver == 'mysql') { |
559 | 559 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
560 | 560 | if ($liveinterval === true) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
561 | - elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
561 | + elseif ($liveinterval !== false) $query .= " AND date <= '".date('c', $liveinterval)."'"; |
|
562 | 562 | $query .= ' ORDER BY date'; |
563 | 563 | } else { |
564 | 564 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
565 | 565 | if ($liveinterval === true) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
566 | - elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'"; |
|
566 | + elseif ($liveinterval !== false) $query .= " AND date <= '".date('c', $liveinterval)."'"; |
|
567 | 567 | $query .= ' ORDER BY date'; |
568 | 568 | } |
569 | 569 | |
570 | 570 | try { |
571 | 571 | $sth = $this->db->prepare($query); |
572 | 572 | $sth->execute(array(':id' => $id)); |
573 | - } catch(PDOException $e) { |
|
573 | + } catch (PDOException $e) { |
|
574 | 574 | echo $e->getMessage(); |
575 | 575 | die; |
576 | 576 | } |
@@ -588,12 +588,12 @@ discard block |
||
588 | 588 | { |
589 | 589 | date_default_timezone_set('UTC'); |
590 | 590 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
591 | - $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
591 | + $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
592 | 592 | try { |
593 | 593 | |
594 | 594 | $sth = $this->db->prepare($query); |
595 | 595 | $sth->execute(array(':ident' => $ident)); |
596 | - } catch(PDOException $e) { |
|
596 | + } catch (PDOException $e) { |
|
597 | 597 | echo $e->getMessage(); |
598 | 598 | die; |
599 | 599 | } |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | |
624 | 624 | $sth = $this->db->prepare($query); |
625 | 625 | $sth->execute(); |
626 | - } catch(PDOException $e) { |
|
626 | + } catch (PDOException $e) { |
|
627 | 627 | return "error"; |
628 | 628 | } |
629 | 629 | |
@@ -646,14 +646,14 @@ discard block |
||
646 | 646 | |
647 | 647 | $sth = $this->db->prepare($query); |
648 | 648 | $sth->execute(); |
649 | - } catch(PDOException $e) { |
|
649 | + } catch (PDOException $e) { |
|
650 | 650 | return "error"; |
651 | 651 | } |
652 | 652 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
653 | 653 | $i = 0; |
654 | - $j =0; |
|
654 | + $j = 0; |
|
655 | 655 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
656 | - foreach($all as $row) |
|
656 | + foreach ($all as $row) |
|
657 | 657 | { |
658 | 658 | $i++; |
659 | 659 | $j++; |
@@ -661,9 +661,9 @@ discard block |
||
661 | 661 | if ($globalDebug) echo "."; |
662 | 662 | try { |
663 | 663 | |
664 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
664 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
665 | 665 | $sth->execute(); |
666 | - } catch(PDOException $e) { |
|
666 | + } catch (PDOException $e) { |
|
667 | 667 | return "error"; |
668 | 668 | } |
669 | 669 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
@@ -674,9 +674,9 @@ discard block |
||
674 | 674 | if ($i > 0) { |
675 | 675 | try { |
676 | 676 | |
677 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
677 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
678 | 678 | $sth->execute(); |
679 | - } catch(PDOException $e) { |
|
679 | + } catch (PDOException $e) { |
|
680 | 680 | return "error"; |
681 | 681 | } |
682 | 682 | } |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | |
690 | 690 | $sth = $this->db->prepare($query); |
691 | 691 | $sth->execute(); |
692 | - } catch(PDOException $e) { |
|
692 | + } catch (PDOException $e) { |
|
693 | 693 | return "error"; |
694 | 694 | } |
695 | 695 | /* $query_delete = "DELETE FROM tracker_live WHERE famtrackid IN ("; |
@@ -737,13 +737,13 @@ discard block |
||
737 | 737 | public function deleteLiveTrackerDataByIdent($ident) |
738 | 738 | { |
739 | 739 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
740 | - $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
740 | + $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
741 | 741 | |
742 | 742 | try { |
743 | 743 | |
744 | 744 | $sth = $this->db->prepare($query); |
745 | 745 | $sth->execute(array(':ident' => $ident)); |
746 | - } catch(PDOException $e) { |
|
746 | + } catch (PDOException $e) { |
|
747 | 747 | return "error"; |
748 | 748 | } |
749 | 749 | |
@@ -759,13 +759,13 @@ discard block |
||
759 | 759 | public function deleteLiveTrackerDataById($id) |
760 | 760 | { |
761 | 761 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
762 | - $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
762 | + $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
763 | 763 | |
764 | 764 | try { |
765 | 765 | |
766 | 766 | $sth = $this->db->prepare($query); |
767 | 767 | $sth->execute(array(':id' => $id)); |
768 | - } catch(PDOException $e) { |
|
768 | + } catch (PDOException $e) { |
|
769 | 769 | return "error"; |
770 | 770 | } |
771 | 771 | |
@@ -783,13 +783,13 @@ discard block |
||
783 | 783 | { |
784 | 784 | global $globalDBdriver, $globalTimezone; |
785 | 785 | if ($globalDBdriver == 'mysql') { |
786 | - $query = 'SELECT tracker_live.ident FROM tracker_live |
|
786 | + $query = 'SELECT tracker_live.ident FROM tracker_live |
|
787 | 787 | WHERE tracker_live.ident = :ident |
788 | 788 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
789 | 789 | AND tracker_live.date < UTC_TIMESTAMP()'; |
790 | 790 | $query_data = array(':ident' => $ident); |
791 | 791 | } else { |
792 | - $query = "SELECT tracker_live.ident FROM tracker_live |
|
792 | + $query = "SELECT tracker_live.ident FROM tracker_live |
|
793 | 793 | WHERE tracker_live.ident = :ident |
794 | 794 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
795 | 795 | AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -798,8 +798,8 @@ discard block |
||
798 | 798 | |
799 | 799 | $sth = $this->db->prepare($query); |
800 | 800 | $sth->execute($query_data); |
801 | - $ident_result=''; |
|
802 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
801 | + $ident_result = ''; |
|
802 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
803 | 803 | { |
804 | 804 | $ident_result = $row['ident']; |
805 | 805 | } |
@@ -816,13 +816,13 @@ discard block |
||
816 | 816 | { |
817 | 817 | global $globalDBdriver, $globalTimezone; |
818 | 818 | if ($globalDBdriver == 'mysql') { |
819 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
819 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
820 | 820 | WHERE tracker_live.ident = :ident |
821 | 821 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
822 | 822 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
823 | 823 | $query_data = array(':ident' => $ident); |
824 | 824 | } else { |
825 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
825 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
826 | 826 | WHERE tracker_live.ident = :ident |
827 | 827 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
828 | 828 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -831,8 +831,8 @@ discard block |
||
831 | 831 | |
832 | 832 | $sth = $this->db->prepare($query); |
833 | 833 | $sth->execute($query_data); |
834 | - $ident_result=''; |
|
835 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
834 | + $ident_result = ''; |
|
835 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
836 | 836 | { |
837 | 837 | $ident_result = $row['famtrackid']; |
838 | 838 | } |
@@ -849,13 +849,13 @@ discard block |
||
849 | 849 | { |
850 | 850 | global $globalDBdriver, $globalTimezone; |
851 | 851 | if ($globalDBdriver == 'mysql') { |
852 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
852 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
853 | 853 | WHERE tracker_live.famtrackid = :id |
854 | 854 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
855 | 855 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
856 | 856 | $query_data = array(':id' => $id); |
857 | 857 | } else { |
858 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
858 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
859 | 859 | WHERE tracker_live.famtrackid = :id |
860 | 860 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
861 | 861 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -864,8 +864,8 @@ discard block |
||
864 | 864 | |
865 | 865 | $sth = $this->db->prepare($query); |
866 | 866 | $sth->execute($query_data); |
867 | - $ident_result=''; |
|
868 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
867 | + $ident_result = ''; |
|
868 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
869 | 869 | { |
870 | 870 | $ident_result = $row['famtrackid']; |
871 | 871 | } |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | * @return String success or false |
884 | 884 | * |
885 | 885 | */ |
886 | - public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
886 | + public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
887 | 887 | { |
888 | 888 | global $globalURL, $globalArchive, $globalDebug; |
889 | 889 | $Common = new Common(); |
@@ -942,21 +942,21 @@ discard block |
||
942 | 942 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
943 | 943 | |
944 | 944 | |
945 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
946 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
947 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
948 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
949 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
950 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
951 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
952 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
953 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
954 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
955 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
956 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
957 | - |
|
958 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
959 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
945 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
946 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
947 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
948 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
949 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
950 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
951 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
952 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
953 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
954 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
955 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
956 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
957 | + |
|
958 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
959 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
960 | 960 | |
961 | 961 | $query = ''; |
962 | 962 | if ($globalArchive) { |
@@ -966,12 +966,12 @@ discard block |
||
966 | 966 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
967 | 967 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
968 | 968 | |
969 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type); |
|
969 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type); |
|
970 | 970 | try { |
971 | 971 | $sth = $this->db->prepare($query); |
972 | 972 | $sth->execute($query_values); |
973 | 973 | $sth->closeCursor(); |
974 | - } catch(PDOException $e) { |
|
974 | + } catch (PDOException $e) { |
|
975 | 975 | return "error : ".$e->getMessage(); |
976 | 976 | } |
977 | 977 | /* |
@@ -981,7 +981,7 @@ discard block |
||
981 | 981 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
982 | 982 | if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
983 | 983 | $TrackerArchive = new TrackerArchive($this->db); |
984 | - $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
984 | + $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country); |
|
985 | 985 | if ($globalDebug) echo $result.')'; |
986 | 986 | } |
987 | 987 | |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | |
992 | 992 | public function getOrderBy() |
993 | 993 | { |
994 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
994 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
995 | 995 | return $orderby; |
996 | 996 | } |
997 | 997 |
@@ -63,17 +63,17 @@ discard block |
||
63 | 63 | $min = true; |
64 | 64 | $allhistory = false; |
65 | 65 | $filter['source'] = array(); |
66 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
69 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
71 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
72 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
66 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
69 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
71 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
72 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
73 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
74 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
75 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
76 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
77 | 77 | |
78 | 78 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
79 | 79 | $min = true; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $spotter_array = array(); |
83 | 83 | |
84 | 84 | if (isset($_GET['ident'])) { |
85 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
85 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
86 | 86 | if ($tracker) { |
87 | 87 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
88 | 88 | } elseif ($marine) { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | $allhistory = true; |
98 | 98 | } elseif (isset($_GET['flightaware_id'])) { |
99 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
99 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
100 | 100 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
101 | 101 | if (empty($spotter_array)) { |
102 | 102 | $from_archive = true; |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | } |
105 | 105 | $allhistory = true; |
106 | 106 | } elseif (isset($_GET['famtrack_id'])) { |
107 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
107 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
108 | 108 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
109 | 109 | $allhistory = true; |
110 | 110 | } elseif (isset($_GET['fammarine_id'])) { |
111 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
111 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
112 | 112 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
113 | 113 | $allhistory = true; |
114 | 114 | /* |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | */ |
129 | 129 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
130 | 130 | $usecoord = true; |
131 | - $coord = explode(',',$_GET['coord']); |
|
132 | - 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) |
|
131 | + $coord = explode(',', $_GET['coord']); |
|
132 | + 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) |
|
133 | 133 | && $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 | 134 | if ($tracker) { |
135 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
135 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
136 | 136 | } elseif ($marine) { |
137 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
137 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
138 | 138 | } else { |
139 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
139 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
140 | 140 | } |
141 | 141 | } else { |
142 | 142 | if ($tracker) { |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | $from_archive = true; |
152 | 152 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
153 | 153 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
154 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
155 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
156 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
157 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
158 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
159 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
154 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
155 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
156 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
157 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
158 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
159 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
160 | 160 | } elseif ($min) { |
161 | 161 | if ($tracker) { |
162 | 162 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -168,17 +168,17 @@ discard block |
||
168 | 168 | # $min = true; |
169 | 169 | } else { |
170 | 170 | if ($tracker) { |
171 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
171 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
172 | 172 | } elseif ($marine) { |
173 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
173 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
174 | 174 | } else { |
175 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
175 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | 179 | if ($usecoord) { |
180 | 180 | if (isset($_GET['archive'])) { |
181 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
181 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
182 | 182 | } else { |
183 | 183 | if ($tracker) { |
184 | 184 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | if ($flightcnt == '') $flightcnt = 0; |
192 | 192 | } else $flightcnt = 0; |
193 | 193 | |
194 | -$sqltime = round(microtime(true)-$begintime,2); |
|
194 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
195 | 195 | |
196 | -$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
196 | +$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
197 | 197 | if ($currenttime != '') $currenttime = round($currenttime/1000); |
198 | 198 | |
199 | 199 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | if (!empty($spotter_array) && is_array($spotter_array)) |
213 | 213 | { |
214 | 214 | $output .= '"features": ['; |
215 | - foreach($spotter_array as $spotter_item) |
|
215 | + foreach ($spotter_array as $spotter_item) |
|
216 | 216 | { |
217 | 217 | $j++; |
218 | 218 | unset($idistance); |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | */ |
270 | 270 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
271 | 271 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
272 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
273 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
272 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
273 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
274 | 274 | //" |
275 | 275 | } else { |
276 | 276 | if ($compress) $output .= '"c": "NA",'; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
280 | 280 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
281 | 281 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
282 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
282 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
283 | 283 | } elseif (isset($spotter_item['aircraft_type'])) { |
284 | 284 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
285 | 285 | } elseif (!$min) { |
@@ -422,15 +422,15 @@ discard block |
||
422 | 422 | if (isset($archivespeed) || $usenextlatlon) { |
423 | 423 | if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
424 | 424 | if (isset($spotter_item['arrival_airport_latitude'])) { |
425 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
426 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
425 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
426 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
427 | 427 | $farr_lat = $spotter_item['arrival_airport_latitude']; |
428 | 428 | $farr_lon = $spotter_item['arrival_airport_longitude']; |
429 | 429 | } else { |
430 | 430 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
431 | 431 | if (isset($aairport[0]['latitude'])) { |
432 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
433 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
432 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
433 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
434 | 434 | $farr_lat = $aairport[0]['latitude']; |
435 | 435 | $farr_lon = $aairport[0]['longitude']; |
436 | 436 | } |
@@ -443,59 +443,59 @@ discard block |
||
443 | 443 | if ($currenttime != '') { |
444 | 444 | if (strtotime($spotter_item['date']) < $currenttime) { |
445 | 445 | if (isset($archivespeed)) { |
446 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
447 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
446 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
447 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
448 | 448 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
449 | 449 | else { |
450 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
451 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
450 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
451 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
452 | 452 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
453 | 453 | else { |
454 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
454 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
455 | 455 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
456 | 456 | } |
457 | 457 | } |
458 | 458 | } elseif ($usenextlatlon) { |
459 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
460 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
459 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
460 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
461 | 461 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
462 | 462 | else { |
463 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
464 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
463 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
464 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
465 | 465 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
466 | 466 | else { |
467 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
467 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
468 | 468 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
469 | 469 | } |
470 | 470 | } |
471 | 471 | } |
472 | 472 | } else { |
473 | 473 | if (isset($archivespeed)) { |
474 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
474 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
475 | 475 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
476 | 476 | } elseif ($usenextlatlon) { |
477 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
477 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
478 | 478 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
479 | 479 | } |
480 | 480 | } |
481 | 481 | } else { |
482 | 482 | if (isset($archivespeed)) { |
483 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
484 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
483 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
484 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
485 | 485 | if (!isset($idistance) || $fdistance < $idistance) { |
486 | 486 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
487 | 487 | } else { |
488 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed); |
|
488 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed); |
|
489 | 489 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
490 | 490 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
491 | 491 | } |
492 | 492 | } elseif ($usenextlatlon) { |
493 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
494 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
493 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
494 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
495 | 495 | if (!isset($idistance) || $fdistance < $idistance) { |
496 | 496 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
497 | 497 | } else { |
498 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading); |
|
498 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading); |
|
499 | 499 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
500 | 500 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
501 | 501 | } |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | |
505 | 505 | if (!$min) $output .= '"image": "'.$image.'",'; |
506 | 506 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
507 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
507 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
508 | 508 | } |
509 | 509 | if (isset($spotter_item['image_source_website'])) { |
510 | 510 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
527 | 527 | } |
528 | 528 | if (isset($spotter_item['acars'])) { |
529 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
529 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
530 | 530 | } |
531 | 531 | // type when not aircraft ? |
532 | 532 | if (isset($spotter_item['type'])) { |
@@ -546,12 +546,12 @@ discard block |
||
546 | 546 | if ($currenttime != '') { |
547 | 547 | if (strtotime($spotter_item['date']) < $currenttime) { |
548 | 548 | if (!isset($archivespeed)) $archivespeed = 1; |
549 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
550 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
549 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
550 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
551 | 551 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
552 | 552 | else { |
553 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
554 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
553 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
554 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
555 | 555 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
556 | 556 | else { |
557 | 557 | $output .= $spotter_item['longitude'].', '; |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | |
631 | 631 | } |
632 | 632 | */ |
633 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
633 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
634 | 634 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
635 | 635 | |
636 | 636 | if ( |
@@ -638,16 +638,16 @@ discard block |
||
638 | 638 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
639 | 639 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
640 | 640 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
641 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
641 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
642 | 642 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
643 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
643 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
644 | 644 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
645 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
645 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
646 | 646 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
647 | 647 | ) { |
648 | 648 | if ($tracker) { |
649 | 649 | if ($from_archive || $globalArchive) { |
650 | - $spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid'],strtotime($spotter_item['date_iso_8601'])); |
|
650 | + $spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid'], strtotime($spotter_item['date_iso_8601'])); |
|
651 | 651 | } else { |
652 | 652 | $spotter_history_array = $TrackerLive->getAllLiveTrackerDataById($spotter_item['famtrackid']); |
653 | 653 | } |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | ) { |
671 | 671 | require(dirname(__FILE__).'/require/class.MapMatching.php'); |
672 | 672 | $MapMatching = new MapMatching(); |
673 | - $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']))))); |
|
673 | + $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']))))); |
|
674 | 674 | $spotter_history_array = $MapMatching->match($spotter_history_array_mm); |
675 | 675 | } |
676 | 676 | } elseif ($marine) { |
@@ -701,9 +701,9 @@ discard block |
||
701 | 701 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
702 | 702 | } |
703 | 703 | $output_history .= '['; |
704 | - $output_history .= $spotter_history['longitude'].', '; |
|
705 | - $output_history .= $spotter_history['latitude'].', '; |
|
706 | - $output_history .= $spotter_history['altitude']*30.48; |
|
704 | + $output_history .= $spotter_history['longitude'].', '; |
|
705 | + $output_history .= $spotter_history['latitude'].', '; |
|
706 | + $output_history .= $spotter_history['altitude']*30.48; |
|
707 | 707 | $output_history .= '],'; |
708 | 708 | /* |
709 | 709 | if ($from_archive === false) { |
@@ -726,8 +726,8 @@ discard block |
||
726 | 726 | $d = true; |
727 | 727 | } |
728 | 728 | $output_history .= '['; |
729 | - $output_history .= $spotter_history['longitude'].', '; |
|
730 | - $output_history .= $spotter_history['latitude']; |
|
729 | + $output_history .= $spotter_history['longitude'].', '; |
|
730 | + $output_history .= $spotter_history['latitude']; |
|
731 | 731 | $output_history .= '],'; |
732 | 732 | /* |
733 | 733 | if ($from_archive === false) { |
@@ -743,9 +743,9 @@ discard block |
||
743 | 743 | //echo $output_history; |
744 | 744 | if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) { |
745 | 745 | $output_historyd = '['; |
746 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
747 | - $output_historyd .= $spotter_item['latitude']; |
|
748 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
746 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
747 | + $output_historyd .= $spotter_item['latitude']; |
|
748 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
749 | 749 | $output_historyd .= '],'; |
750 | 750 | //$output_history = $output_historyd.$output_history; |
751 | 751 | $output_history = $output_history.$output_historyd; |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $last = array_pop($spotter_history_array); |
754 | 754 | $latitude = $last['latitude']; |
755 | 755 | $longitude = $last['longitude']; |
756 | - $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output); |
|
756 | + $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | $output_history = substr($output_history, 0, -1); |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | } |
765 | 765 | } |
766 | 766 | |
767 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
767 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
768 | 768 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
769 | 769 | && (isset($spotter_item['departure_airport']) |
770 | 770 | && $spotter_item['departure_airport'] != 'NA' |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | |
799 | 799 | //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))))) { |
800 | 800 | //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))))) { |
801 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
801 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
802 | 802 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
803 | 803 | && (isset($spotter_item['arrival_airport']) |
804 | 804 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | $output = substr($output, 0, -1); |
830 | 830 | $output .= ']'; |
831 | 831 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
832 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
832 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
833 | 833 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
834 | 834 | $output .= '"fc": "'.$j.'"'; |
835 | 835 | } else { |
@@ -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 |