@@ -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 | { |
@@ -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 |
@@ -14,35 +14,35 @@ discard block |
||
14 | 14 | if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline'; |
15 | 15 | |
16 | 16 | if (isset($_GET['3d'])) { |
17 | - setcookie('MapFormat','3d'); |
|
17 | + setcookie('MapFormat', '3d'); |
|
18 | 18 | } else if (isset($_GET['2d'])) { |
19 | - setcookie('MapFormat','2d'); |
|
19 | + setcookie('MapFormat', '2d'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
23 | - $tsk = filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); |
|
23 | + $tsk = filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | if (isset($_POST['archive'])) { |
27 | - setcookie('archive','true'); |
|
28 | - setcookie('archive_begin',strtotime($_POST['start_date'])); |
|
29 | - setcookie('archive_end',strtotime($_POST['end_date'])); |
|
30 | - setcookie('archive_speed',$_POST['archivespeed']); |
|
27 | + setcookie('archive', 'true'); |
|
28 | + setcookie('archive_begin', strtotime($_POST['start_date'])); |
|
29 | + setcookie('archive_end', strtotime($_POST['end_date'])); |
|
30 | + setcookie('archive_speed', $_POST['archivespeed']); |
|
31 | 31 | } |
32 | 32 | if (isset($_POST['noarchive'])) { |
33 | - setcookie('archive','false',-1); |
|
34 | - setcookie('archive_begin','',-1); |
|
35 | - setcookie('archive_end','',-1); |
|
36 | - setcookie('archive_speed','',-1); |
|
33 | + setcookie('archive', 'false', -1); |
|
34 | + setcookie('archive_begin', '', -1); |
|
35 | + setcookie('archive_end', '', -1); |
|
36 | + setcookie('archive_speed', '', -1); |
|
37 | 37 | } |
38 | 38 | // When button "Remove all filters" is clicked |
39 | 39 | if (isset($_POST['removefilters'])) { |
40 | - $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
|
41 | - return strpos($key,'filter_') === 0; |
|
40 | + $allfilters = array_filter(array_keys($_COOKIE), function($key) { |
|
41 | + return strpos($key, 'filter_') === 0; |
|
42 | 42 | }); |
43 | 43 | foreach ($allfilters as $filt) { |
44 | 44 | unset($_COOKIE[$filt]); |
45 | - setcookie($filt,null,-1); |
|
45 | + setcookie($filt, null, -1); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | ?> |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
265 | 265 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
266 | 266 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
267 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
267 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
268 | 268 | <?php |
269 | 269 | if (!isset($type) || $type == 'aircraft') { |
270 | 270 | ?> |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
338 | 338 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
339 | 339 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
340 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
340 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
341 | 341 | <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
342 | 342 | <?php |
343 | 343 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -742,8 +742,8 @@ discard block |
||
742 | 742 | ?> |
743 | 743 | <div class="search"> |
744 | 744 | <form action="<?php print $globalURL; ?>/search" method="get"> |
745 | - <!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>--> |
|
746 | - <input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != ""){ print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
745 | + <!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>--> |
|
746 | + <input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != "") { print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
747 | 747 | </form> |
748 | 748 | </div> |
749 | 749 | <div class="social"> |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | print '</div>'; |
762 | 762 | } |
763 | 763 | |
764 | -if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
764 | +if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
765 | 765 | ?> |
766 | 766 | <div class="top-header clear" role="main"> |
767 | 767 | <?php |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | </div> |
775 | 775 | <?php |
776 | 776 | } |
777 | -if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
|
777 | +if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false)) |
|
778 | 778 | { |
779 | 779 | ?> |
780 | 780 | <div class="top-header clear" role="main"> |
@@ -787,15 +787,15 @@ discard block |
||
787 | 787 | var zoom = 13; |
788 | 788 | //create the map |
789 | 789 | <?php |
790 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
790 | + if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
791 | 791 | ?> |
792 | 792 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
793 | 793 | <?php |
794 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
794 | + } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) { |
|
795 | 795 | ?> |
796 | 796 | map = L.map('map', { zoomControl:true }); |
797 | 797 | <?php |
798 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
798 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
799 | 799 | ?> |
800 | 800 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
801 | 801 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
804 | 804 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
805 | 805 | <?php |
806 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
806 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
807 | 807 | ?> |
808 | 808 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
809 | 809 | <?php |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | $gpx .= '<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpsies="http://www.gpsies.com/GPX/1/0" creator="GPSies http://www.gpsies.com - Sendl.-O&apos;sch-heim" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.gpsies.com/GPX/1/0 http://www.gpsies.com/gpsies.xsd">'; |
45 | 45 | $gpx .= '<trk>'; |
46 | 46 | $gpx .= '<trkseg>'; |
47 | - foreach($spotter_history_array as $spotter_data) { |
|
48 | - $gpx .= '<trkpt lat="'.sprintf("%.8f",$spotter_data['latitude']).'" lon="'.sprintf("%.8f",$spotter_data['longitude']).'">'; |
|
49 | - if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>'; |
|
50 | - $gpx .= '<time>'.date("Y-m-d\TH:i:s\Z",strtotime($spotter_data['date'])).'</time>'; |
|
47 | + foreach ($spotter_history_array as $spotter_data) { |
|
48 | + $gpx .= '<trkpt lat="'.sprintf("%.8f", $spotter_data['latitude']).'" lon="'.sprintf("%.8f", $spotter_data['longitude']).'">'; |
|
49 | + if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f", $spotter_data['altitude']).'</ele>'; |
|
50 | + $gpx .= '<time>'.date("Y-m-d\TH:i:s\Z", strtotime($spotter_data['date'])).'</time>'; |
|
51 | 51 | $gpx .= '</trkpt>'; |
52 | 52 | } |
53 | 53 | $gpx .= '</trkseg>'; |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | global $globalMapMatchingMaxPts, $globalTrackMatchingAppKey, $globalTrackMatchingAppId; |
85 | 85 | if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100; |
86 | 86 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
87 | - if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
87 | + if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
88 | 88 | $data = $this->create_gpx($spotter_history_array); |
89 | 89 | $url = 'https://test.roadmatching.com/rest/mapmatch/?app_id='.$globalTrackMatchingAppId.'&app_key='.$globalTrackMatchingAppKey.'&output.waypoints=true'; |
90 | 90 | $Common = new Common(); |
91 | - $matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml','Accept: application/json')); |
|
92 | - $matching = json_decode($matching,true); |
|
91 | + $matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml', 'Accept: application/json')); |
|
92 | + $matching = json_decode($matching, true); |
|
93 | 93 | if (isset($matching['diary']['entries'][0]['route']['links'])) { |
94 | 94 | $spotter_history_array = array(); |
95 | 95 | foreach ($matching['diary']['entries'][0]['route']['links'] as $match) { |
96 | 96 | if (isset($match['wpts'])) { |
97 | 97 | foreach ($match['wpts'] as $coord) { |
98 | - $spotter_history_array[] = array('longitude' => $coord['x'],'latitude' => $coord['y']); |
|
98 | + $spotter_history_array[] = array('longitude' => $coord['x'], 'latitude' => $coord['y']); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
@@ -115,22 +115,22 @@ discard block |
||
115 | 115 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
116 | 116 | $spotter_history_initial_array = array(); |
117 | 117 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
118 | - $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
119 | - $spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts); |
|
118 | + $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
119 | + $spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts); |
|
120 | 120 | } |
121 | 121 | $data = $this->create_gpx($spotter_history_array); |
122 | 122 | $url = 'https://graphhopper.com/api/1/match?vehicle=car&points_encoded=0&instructions=false&key='.$globalGraphHopperKey; |
123 | 123 | $Common = new Common(); |
124 | - $matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml')); |
|
125 | - $matching = json_decode($matching,true); |
|
124 | + $matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml')); |
|
125 | + $matching = json_decode($matching, true); |
|
126 | 126 | if (isset($matching['paths'][0]['points']['coordinates'])) { |
127 | 127 | $spotter_history_array = array(); |
128 | 128 | foreach ($matching['paths'][0]['points']['coordinates'] as $match) { |
129 | 129 | $coord = $match; |
130 | - $spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]); |
|
130 | + $spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]); |
|
131 | 131 | } |
132 | 132 | } |
133 | - $spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array); |
|
133 | + $spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array); |
|
134 | 134 | $spotter_history_array[0]['mapmatching_engine'] = 'graphhopper'; |
135 | 135 | return $spotter_history_array; |
136 | 136 | } |
@@ -146,23 +146,23 @@ discard block |
||
146 | 146 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
147 | 147 | $spotter_history_initial_array = array(); |
148 | 148 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
149 | - $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
150 | - $spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts); |
|
149 | + $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
150 | + $spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts); |
|
151 | 151 | } |
152 | 152 | $data = $this->create_gpx($spotter_history_array); |
153 | 153 | $url = 'https://mapmatching.flightairmap.com/api/1/match?vehicle=car&points_encoded=0&instructions=false'; |
154 | 154 | //$url = 'https://mapmatching.flightairmap.com/api/1/match?vehicle=car&points_encoded=0'; |
155 | 155 | $Common = new Common(); |
156 | - $matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml')); |
|
157 | - $matching = json_decode($matching,true); |
|
156 | + $matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml')); |
|
157 | + $matching = json_decode($matching, true); |
|
158 | 158 | if (isset($matching['paths'][0]['points']['coordinates'])) { |
159 | 159 | $spotter_history_array = array(); |
160 | 160 | foreach ($matching['paths'][0]['points']['coordinates'] as $match) { |
161 | 161 | $coord = $match; |
162 | - $spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]); |
|
162 | + $spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]); |
|
163 | 163 | } |
164 | 164 | } |
165 | - $spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array); |
|
165 | + $spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array); |
|
166 | 166 | $spotter_history_array[0]['mapmatching_engine'] = 'fam'; |
167 | 167 | return $spotter_history_array; |
168 | 168 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
179 | 179 | $spotter_history_initial_array = array(); |
180 | 180 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
181 | - $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
182 | - $spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts); |
|
181 | + $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
182 | + $spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts); |
|
183 | 183 | } |
184 | 184 | $coord = ''; |
185 | 185 | $ts = ''; |
@@ -195,15 +195,15 @@ discard block |
||
195 | 195 | $url = 'https://router.project-osrm.org/match/v1/driving/'.$coord.'?timestamps='.$ts.'&overview=full&geometries=geojson&tidy=true&gaps=ignore'; |
196 | 196 | $Common = new Common(); |
197 | 197 | $matching = $Common->getData($url); |
198 | - $matching = json_decode($matching,true); |
|
198 | + $matching = json_decode($matching, true); |
|
199 | 199 | if (isset($matching['matchings'][0]['geometry']['coordinates'])) { |
200 | 200 | $spotter_history_array = array(); |
201 | 201 | foreach ($matching['matchings'][0]['geometry']['coordinates'] as $match) { |
202 | 202 | $coord = $match; |
203 | - $spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]); |
|
203 | + $spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]); |
|
204 | 204 | } |
205 | 205 | } |
206 | - $spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array); |
|
206 | + $spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array); |
|
207 | 207 | $spotter_history_array[0]['mapmatching_engine'] = 'osmr'; |
208 | 208 | return $spotter_history_array; |
209 | 209 | } |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
220 | 220 | $spotter_history_initial_array = array(); |
221 | 221 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
222 | - $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
223 | - $spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts); |
|
222 | + $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
223 | + $spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts); |
|
224 | 224 | } |
225 | 225 | $coord = ''; |
226 | 226 | $ts = ''; |
@@ -237,15 +237,15 @@ discard block |
||
237 | 237 | $url = 'https://api.mapbox.com/matching/v5/mapbox/driving/'.$coord.'?access_token='.$globalMapboxToken.'×tamps='.$ts.'&overview=full&tidy=true&geometries=geojson'; |
238 | 238 | $Common = new Common(); |
239 | 239 | $matching = $Common->getData($url); |
240 | - $matching = json_decode($matching,true); |
|
240 | + $matching = json_decode($matching, true); |
|
241 | 241 | if (isset($matching['matchings'][0]['geometry']['coordinates'])) { |
242 | 242 | $spotter_history_array = array(); |
243 | 243 | foreach ($matching['matchings'][0]['geometry']['coordinates'] as $match) { |
244 | 244 | $coord = $match; |
245 | - $spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]); |
|
245 | + $spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]); |
|
246 | 246 | } |
247 | 247 | } |
248 | - $spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array); |
|
248 | + $spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array); |
|
249 | 249 | $spotter_history_array[0]['mapmatching_engine'] = 'mapbox'; |
250 | 250 | return $spotter_history_array; |
251 | 251 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | require_once(dirname(__FILE__).'/class.create_db.php'); |
23 | 23 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
24 | 24 | require_once(dirname(__FILE__).'/class.settings.php'); |
25 | -$title="Install"; |
|
25 | +$title = "Install"; |
|
26 | 26 | require(dirname(__FILE__).'/../require/settings.php'); |
27 | 27 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
28 | 28 | require(dirname(__FILE__).'/header.php'); |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | if (!extension_loaded('curl')) { |
96 | 96 | $error[] = "Curl is not loaded."; |
97 | 97 | } |
98 | - if(function_exists('apache_get_modules') ){ |
|
99 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
98 | + if (function_exists('apache_get_modules')) { |
|
99 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
100 | 100 | $error[] = "mod_rewrite is not available."; |
101 | 101 | } |
102 | 102 | /* |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
114 | 114 | if (function_exists('get_headers')) { |
115 | 115 | //$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
116 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'live/geojson?test',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
117 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
116 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'live/geojson?test', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
117 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
118 | 118 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
119 | 119 | } else { |
120 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
121 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
120 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'search', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
121 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
122 | 122 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
123 | 123 | } |
124 | 124 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
199 | 199 | if (isset($_SERVER['REQUEST_URI'])) { |
200 | 200 | $URL = $_SERVER['REQUEST_URI']; |
201 | - $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
|
201 | + $globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL))); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | ?> |
@@ -521,13 +521,13 @@ discard block |
||
521 | 521 | ?> |
522 | 522 | <tr> |
523 | 523 | <?php |
524 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
524 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
525 | 525 | ?> |
526 | 526 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
527 | 527 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
528 | 528 | <?php |
529 | 529 | } else { |
530 | - $hostport = explode(':',$source['host']); |
|
530 | + $hostport = explode(':', $source['host']); |
|
531 | 531 | if (isset($hostport[1])) { |
532 | 532 | $host = $hostport[0]; |
533 | 533 | $port = $hostport[1]; |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | <select name="timezones[]" id="timezones"> |
577 | 577 | <?php |
578 | 578 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
579 | - foreach($timezonelist as $timezones){ |
|
579 | + foreach ($timezonelist as $timezones) { |
|
580 | 580 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
581 | 581 | print '<option selected>'.$timezones.'</option>'; |
582 | 582 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | <select name="timezones[]" id="timezones"> |
631 | 631 | <?php |
632 | 632 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
633 | - foreach($timezonelist as $timezones){ |
|
633 | + foreach ($timezonelist as $timezones) { |
|
634 | 634 | if ($timezones == 'UTC') { |
635 | 635 | print '<option selected>'.$timezones.'</option>'; |
636 | 636 | } else print '<option>'.$timezones.'</option>'; |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | <br /> |
1085 | 1085 | <p> |
1086 | 1086 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1087 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1087 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
1088 | 1088 | </p> |
1089 | 1089 | <br /> |
1090 | 1090 | <p> |
@@ -1146,14 +1146,14 @@ discard block |
||
1146 | 1146 | $error = ''; |
1147 | 1147 | |
1148 | 1148 | if (isset($_POST['dbtype'])) { |
1149 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
1150 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
1151 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
1152 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
1153 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
1154 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
1155 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
1156 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
1149 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
1150 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
1151 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
1152 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
1153 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
1154 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
1155 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
1156 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
1157 | 1157 | |
1158 | 1158 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
1159 | 1159 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -1173,49 +1173,49 @@ discard block |
||
1173 | 1173 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
1174 | 1174 | */ |
1175 | 1175 | |
1176 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
1176 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
1177 | 1177 | |
1178 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
1179 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
1180 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
1181 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
1182 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
1178 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
1179 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
1180 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
1181 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
1182 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
1183 | 1183 | |
1184 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
1185 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
1186 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
1187 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
1188 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
1189 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
1190 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
1191 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
1192 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
1193 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1184 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
1185 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
1186 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
1187 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
1188 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
1189 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
1190 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
1191 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
1192 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
1193 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1194 | 1194 | |
1195 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
1196 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
1197 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
1198 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
1199 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
1200 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
1195 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
1196 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
1197 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
1198 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
1199 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
1200 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
1201 | 1201 | |
1202 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
1203 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
1202 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
1203 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
1204 | 1204 | |
1205 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
1206 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
1207 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
1205 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
1206 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
1207 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
1208 | 1208 | |
1209 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
1209 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
1210 | 1210 | if ($acars == 'acars') { |
1211 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
1211 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
1212 | 1212 | } else { |
1213 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
1213 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1214 | 1214 | } |
1215 | 1215 | |
1216 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1217 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1218 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1216 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1217 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1218 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1219 | 1219 | |
1220 | 1220 | $source_name = $_POST['source_name']; |
1221 | 1221 | $source_latitude = $_POST['source_latitude']; |
@@ -1229,8 +1229,8 @@ discard block |
||
1229 | 1229 | |
1230 | 1230 | $sources = array(); |
1231 | 1231 | foreach ($source_name as $keys => $name) { |
1232 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1233 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1232 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
1233 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
1234 | 1234 | } |
1235 | 1235 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1236 | 1236 | |
@@ -1239,16 +1239,16 @@ discard block |
||
1239 | 1239 | $newstype = $_POST['newstype']; |
1240 | 1240 | |
1241 | 1241 | $newsfeeds = array(); |
1242 | - foreach($newsurl as $newskey => $url) { |
|
1242 | + foreach ($newsurl as $newskey => $url) { |
|
1243 | 1243 | if ($url != '') { |
1244 | 1244 | $type = $newstype[$newskey]; |
1245 | 1245 | $lng = $newslng[$newskey]; |
1246 | 1246 | if (isset($newsfeeds[$type][$lng])) { |
1247 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1247 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url)); |
|
1248 | 1248 | } else $newsfeeds[$type][$lng] = array($url); |
1249 | 1249 | } |
1250 | 1250 | } |
1251 | - $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
|
1251 | + $settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds)); |
|
1252 | 1252 | |
1253 | 1253 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
1254 | 1254 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1259,27 +1259,27 @@ discard block |
||
1259 | 1259 | $sbsurl = $_POST['sbsurl']; |
1260 | 1260 | */ |
1261 | 1261 | |
1262 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1263 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1264 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1265 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1266 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1267 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1268 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1269 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1262 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1263 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1264 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1265 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1266 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1267 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1268 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1269 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1270 | 1270 | |
1271 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1272 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1273 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1274 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1275 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1276 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1277 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1278 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1279 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1280 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1281 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1282 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1271 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1272 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1273 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1274 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1275 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1276 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1277 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1278 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1279 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1280 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1281 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1282 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1283 | 1283 | |
1284 | 1284 | /* |
1285 | 1285 | $globalSBS1Hosts = array(); |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | } |
1296 | 1296 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1297 | 1297 | */ |
1298 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1298 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1299 | 1299 | $host = $_POST['host']; |
1300 | 1300 | $port = $_POST['port']; |
1301 | 1301 | $name = $_POST['name']; |
@@ -1312,115 +1312,115 @@ discard block |
||
1312 | 1312 | else $cov = 'FALSE'; |
1313 | 1313 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1314 | 1314 | else $arch = 'FALSE'; |
1315 | - if (strpos($format[$key],'_callback')) { |
|
1316 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1315 | + if (strpos($format[$key], '_callback')) { |
|
1316 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1317 | 1317 | } elseif ($h != '' || $name[$key] != '') { |
1318 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1318 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1319 | 1319 | } |
1320 | 1320 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1321 | 1321 | } |
1322 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1322 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1323 | 1323 | |
1324 | 1324 | /* |
1325 | 1325 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1326 | 1326 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1327 | 1327 | */ |
1328 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1329 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1330 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1328 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1329 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1330 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1331 | 1331 | |
1332 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1333 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1332 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1333 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1334 | 1334 | |
1335 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1336 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1335 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1336 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1337 | 1337 | |
1338 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
1339 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
1338 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
1339 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
1340 | 1340 | |
1341 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1342 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1343 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1344 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1341 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1342 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1343 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1344 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1345 | 1345 | |
1346 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1347 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1348 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1346 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1347 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1348 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1349 | 1349 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1350 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1351 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1350 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1351 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1352 | 1352 | |
1353 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1354 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1355 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1356 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1357 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1358 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1359 | - $minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT); |
|
1360 | - $settings = array_merge($settings,array('globalMinFetch' => $minfetch)); |
|
1361 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1362 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1353 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1354 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1355 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1356 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1357 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1358 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1359 | + $minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT); |
|
1360 | + $settings = array_merge($settings, array('globalMinFetch' => $minfetch)); |
|
1361 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1362 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1363 | 1363 | |
1364 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1365 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1364 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1365 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1366 | 1366 | |
1367 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1368 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1367 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1368 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1369 | 1369 | |
1370 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1370 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1371 | 1371 | if ($archiveyear == "archiveyear") { |
1372 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1372 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1373 | 1373 | } else { |
1374 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1374 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1375 | 1375 | } |
1376 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1377 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1378 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1379 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1376 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1377 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1378 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1379 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1380 | 1380 | |
1381 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1382 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1383 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1384 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1381 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1382 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1383 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1384 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1385 | 1385 | |
1386 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1387 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1388 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1386 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1387 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1388 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1389 | 1389 | |
1390 | 1390 | // Create in settings.php keys not yet configurable if not already here |
1391 | 1391 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1392 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1392 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1393 | 1393 | |
1394 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1394 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1395 | 1395 | if ($resetyearstats == 'resetyearstats') { |
1396 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1396 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1397 | 1397 | } else { |
1398 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1398 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1399 | 1399 | } |
1400 | 1400 | |
1401 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1401 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1402 | 1402 | if ($archive == 'archive') { |
1403 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1403 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1404 | 1404 | } else { |
1405 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1405 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1406 | 1406 | } |
1407 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
1407 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
1408 | 1408 | if ($archiveresults == 'archiveresults') { |
1409 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
1409 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
1410 | 1410 | } else { |
1411 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
1411 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
1412 | 1412 | } |
1413 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1413 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1414 | 1414 | if ($daemon == 'daemon') { |
1415 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1415 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1416 | 1416 | } else { |
1417 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1417 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1418 | 1418 | } |
1419 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1419 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1420 | 1420 | if ($schedules == 'schedules') { |
1421 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1421 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1422 | 1422 | } else { |
1423 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1423 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1424 | 1424 | } |
1425 | 1425 | |
1426 | 1426 | /* |
@@ -1431,274 +1431,274 @@ discard block |
||
1431 | 1431 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1432 | 1432 | } |
1433 | 1433 | */ |
1434 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1435 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1436 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1437 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1438 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1434 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1435 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1436 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1437 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1438 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1439 | 1439 | $va = false; |
1440 | 1440 | if ($globalivao == 'ivao') { |
1441 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1441 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1442 | 1442 | $va = true; |
1443 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1443 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1444 | 1444 | if ($globalvatsim == 'vatsim') { |
1445 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1445 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1446 | 1446 | $va = true; |
1447 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1447 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1448 | 1448 | if ($globalphpvms == 'phpvms') { |
1449 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1449 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1450 | 1450 | $va = true; |
1451 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1451 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1452 | 1452 | if ($globalvam == 'vam') { |
1453 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1453 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1454 | 1454 | $va = true; |
1455 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1455 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1456 | 1456 | if ($va) { |
1457 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1458 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1457 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1458 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1459 | 1459 | if ($globalva == 'va' || $va) { |
1460 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1461 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1460 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1461 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1462 | 1462 | } else { |
1463 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1464 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1465 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1463 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1464 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1465 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1466 | 1466 | } |
1467 | 1467 | |
1468 | 1468 | |
1469 | - $mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING); |
|
1469 | + $mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING); |
|
1470 | 1470 | if ($mapoffline == 'mapoffline') { |
1471 | - $settings = array_merge($settings,array('globalMapOffline' => 'TRUE')); |
|
1471 | + $settings = array_merge($settings, array('globalMapOffline' => 'TRUE')); |
|
1472 | 1472 | } else { |
1473 | - $settings = array_merge($settings,array('globalMapOffline' => 'FALSE')); |
|
1473 | + $settings = array_merge($settings, array('globalMapOffline' => 'FALSE')); |
|
1474 | 1474 | } |
1475 | - $globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING); |
|
1475 | + $globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING); |
|
1476 | 1476 | if ($globaloffline == 'globaloffline') { |
1477 | - $settings = array_merge($settings,array('globalOffline' => 'TRUE')); |
|
1477 | + $settings = array_merge($settings, array('globalOffline' => 'TRUE')); |
|
1478 | 1478 | } else { |
1479 | - $settings = array_merge($settings,array('globalOffline' => 'FALSE')); |
|
1479 | + $settings = array_merge($settings, array('globalOffline' => 'FALSE')); |
|
1480 | 1480 | } |
1481 | 1481 | |
1482 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1482 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1483 | 1483 | if ($notam == 'notam') { |
1484 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1484 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1485 | 1485 | } else { |
1486 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1486 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1487 | 1487 | } |
1488 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1488 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1489 | 1489 | if ($owner == 'owner') { |
1490 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1490 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1491 | 1491 | } else { |
1492 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1492 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1493 | 1493 | } |
1494 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1494 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1495 | 1495 | if ($map3d == 'map3d') { |
1496 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1496 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1497 | 1497 | } else { |
1498 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1498 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1499 | 1499 | } |
1500 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1500 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1501 | 1501 | if ($crash == 'crash') { |
1502 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1502 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1503 | 1503 | } else { |
1504 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1504 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1505 | 1505 | } |
1506 | - $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING); |
|
1506 | + $fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING); |
|
1507 | 1507 | if ($fires == 'fires') { |
1508 | - $settings = array_merge($settings,array('globalMapFires' => 'TRUE')); |
|
1508 | + $settings = array_merge($settings, array('globalMapFires' => 'TRUE')); |
|
1509 | 1509 | } else { |
1510 | - $settings = array_merge($settings,array('globalMapFires' => 'FALSE')); |
|
1510 | + $settings = array_merge($settings, array('globalMapFires' => 'FALSE')); |
|
1511 | 1511 | } |
1512 | - $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING); |
|
1512 | + $firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING); |
|
1513 | 1513 | if ($firessupport == 'firessupport') { |
1514 | - $settings = array_merge($settings,array('globalFires' => 'TRUE')); |
|
1514 | + $settings = array_merge($settings, array('globalFires' => 'TRUE')); |
|
1515 | 1515 | } else { |
1516 | - $settings = array_merge($settings,array('globalFires' => 'FALSE')); |
|
1516 | + $settings = array_merge($settings, array('globalFires' => 'FALSE')); |
|
1517 | 1517 | } |
1518 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1518 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1519 | 1519 | if ($mapsatellites == 'mapsatellites') { |
1520 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1520 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1521 | 1521 | } else { |
1522 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1522 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1523 | 1523 | } |
1524 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1524 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1525 | 1525 | if ($map3ddefault == 'map3ddefault') { |
1526 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1526 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1527 | 1527 | } else { |
1528 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1528 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1529 | 1529 | } |
1530 | - $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING); |
|
1530 | + $map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING); |
|
1531 | 1531 | if ($map3dliveries == 'map3dliveries') { |
1532 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE')); |
|
1532 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE')); |
|
1533 | 1533 | } else { |
1534 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE')); |
|
1534 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE')); |
|
1535 | 1535 | } |
1536 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1536 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1537 | 1537 | if ($translate == 'translate') { |
1538 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1538 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1539 | 1539 | } else { |
1540 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1540 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1541 | 1541 | } |
1542 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1542 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1543 | 1543 | if ($realairlines == 'realairlines') { |
1544 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1544 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1545 | 1545 | } else { |
1546 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1546 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1547 | 1547 | } |
1548 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1548 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1549 | 1549 | if ($estimation == 'estimation') { |
1550 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1550 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1551 | 1551 | } else { |
1552 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1552 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1553 | 1553 | } |
1554 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1554 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1555 | 1555 | if ($metar == 'metar') { |
1556 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1556 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1557 | 1557 | } else { |
1558 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1558 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1559 | 1559 | } |
1560 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1560 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1561 | 1561 | if ($metarcycle == 'metarcycle') { |
1562 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1562 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1563 | 1563 | } else { |
1564 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1564 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1565 | 1565 | } |
1566 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1566 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1567 | 1567 | if ($fork == 'fork') { |
1568 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1568 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1569 | 1569 | } else { |
1570 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1570 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1571 | 1571 | } |
1572 | 1572 | |
1573 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1573 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1574 | 1574 | if ($colormap == 'colormap') { |
1575 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1575 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1576 | 1576 | } else { |
1577 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1577 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1578 | 1578 | } |
1579 | 1579 | |
1580 | 1580 | if (isset($_POST['aircrafticoncolor'])) { |
1581 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1582 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1581 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1582 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1583 | 1583 | } |
1584 | 1584 | |
1585 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1586 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1585 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1586 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1587 | 1587 | |
1588 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1589 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1590 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1591 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1592 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1593 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1588 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1589 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1590 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1591 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1592 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1593 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1594 | 1594 | |
1595 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1595 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1596 | 1596 | if ($mappopup == 'mappopup') { |
1597 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1597 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1598 | 1598 | } else { |
1599 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1599 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1600 | 1600 | } |
1601 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1601 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1602 | 1602 | if ($airportpopup == 'airportpopup') { |
1603 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1603 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1604 | 1604 | } else { |
1605 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1605 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1606 | 1606 | } |
1607 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1607 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1608 | 1608 | if ($maphistory == 'maphistory') { |
1609 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1609 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1610 | 1610 | } else { |
1611 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1611 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1612 | 1612 | } |
1613 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1613 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1614 | 1614 | if ($maptooltip == 'maptooltip') { |
1615 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1615 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1616 | 1616 | } else { |
1617 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1617 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1618 | 1618 | } |
1619 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1619 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1620 | 1620 | if ($flightroute == 'flightroute') { |
1621 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1621 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1622 | 1622 | } else { |
1623 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1623 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1624 | 1624 | } |
1625 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1625 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1626 | 1626 | if ($flightremainingroute == 'flightremainingroute') { |
1627 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1627 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1628 | 1628 | } else { |
1629 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1629 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1630 | 1630 | } |
1631 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1631 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1632 | 1632 | if ($allflights == 'allflights') { |
1633 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1633 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1634 | 1634 | } else { |
1635 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1635 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1636 | 1636 | } |
1637 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1637 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1638 | 1638 | if ($bbox == 'bbox') { |
1639 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1639 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1640 | 1640 | } else { |
1641 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1641 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1642 | 1642 | } |
1643 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1643 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1644 | 1644 | if ($groundaltitude == 'groundaltitude') { |
1645 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1645 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1646 | 1646 | } else { |
1647 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1647 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1648 | 1648 | } |
1649 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1649 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1650 | 1650 | if ($waypoints == 'waypoints') { |
1651 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1651 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1652 | 1652 | } else { |
1653 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1653 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1654 | 1654 | } |
1655 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1655 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1656 | 1656 | if ($geoid == 'geoid') { |
1657 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1657 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1658 | 1658 | } else { |
1659 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1659 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1660 | 1660 | } |
1661 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1662 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1661 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1662 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1663 | 1663 | |
1664 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1664 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1665 | 1665 | if ($noairlines == 'noairlines') { |
1666 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1666 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1667 | 1667 | } else { |
1668 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1668 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1669 | 1669 | } |
1670 | 1670 | |
1671 | - $tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING); |
|
1671 | + $tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING); |
|
1672 | 1672 | if ($tsk == 'tsk') { |
1673 | - $settings = array_merge($settings,array('globalTSK' => 'TRUE')); |
|
1673 | + $settings = array_merge($settings, array('globalTSK' => 'TRUE')); |
|
1674 | 1674 | } else { |
1675 | - $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
|
1675 | + $settings = array_merge($settings, array('globalTSK' => 'FALSE')); |
|
1676 | 1676 | } |
1677 | - $mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING); |
|
1677 | + $mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING); |
|
1678 | 1678 | if ($mapmatching == 'mapmatching') { |
1679 | - $settings = array_merge($settings,array('globalMapMatching' => 'TRUE')); |
|
1679 | + $settings = array_merge($settings, array('globalMapMatching' => 'TRUE')); |
|
1680 | 1680 | } else { |
1681 | - $settings = array_merge($settings,array('globalMapMatching' => 'FALSE')); |
|
1681 | + $settings = array_merge($settings, array('globalMapMatching' => 'FALSE')); |
|
1682 | 1682 | } |
1683 | - $mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING); |
|
1684 | - $settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1685 | - $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
|
1686 | - $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
|
1683 | + $mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING); |
|
1684 | + $settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1685 | + $graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING); |
|
1686 | + $settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper)); |
|
1687 | 1687 | |
1688 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1688 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1689 | 1689 | |
1690 | 1690 | // Set some defaults values... |
1691 | 1691 | if (!isset($globalAircraftImageSources)) { |
1692 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1693 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1692 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1693 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | if (!isset($globalSchedulesSources)) { |
1697 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1698 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1697 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1698 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1699 | 1699 | } |
1700 | 1700 | |
1701 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1701 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1702 | 1702 | |
1703 | 1703 | if ($error == '') settings::modify_settings($settings); |
1704 | 1704 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | |
12 | 12 | $from_archive = false; |
13 | 13 | if (isset($_GET['ident'])) { |
14 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
14 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
15 | 15 | if (isset($_GET['currenttime'])) { |
16 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
16 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
17 | 17 | $currenttime = round($currenttime/1000); |
18 | - $spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime); |
|
18 | + $spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime); |
|
19 | 19 | if (empty($spotter_array)) { |
20 | 20 | $from_archive = true; |
21 | - $spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime); |
|
21 | + $spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime); |
|
22 | 22 | } |
23 | 23 | } else { |
24 | 24 | $spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident); |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | } |
30 | 30 | } |
31 | 31 | if (isset($_GET['flightaware_id'])) { |
32 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
32 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
33 | 33 | if (isset($_GET['currenttime'])) { |
34 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
34 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
35 | 35 | $currenttime = round($currenttime/1000); |
36 | - $spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime); |
|
36 | + $spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime); |
|
37 | 37 | if (empty($spotter_array)) { |
38 | 38 | $from_archive = true; |
39 | 39 | // $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
40 | - $spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime); |
|
40 | + $spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime); |
|
41 | 41 | } |
42 | 42 | } else { |
43 | 43 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
58 | 58 | { |
59 | 59 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
60 | - $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
60 | + $image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
61 | 61 | } else $image = $spotter_item['image_thumbnail']; |
62 | 62 | } |
63 | 63 | /* else { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
81 | 81 | if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
82 | 82 | if ($spotter_item['departure_airport_time'] > 2460) { |
83 | - print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>'; |
|
83 | + print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>'; |
|
84 | 84 | } else { |
85 | 85 | print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>'; |
86 | 86 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country']; |
90 | 90 | if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
91 | 91 | if ($spotter_item['arrival_airport_time'] > 2460) { |
92 | - print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>'; |
|
92 | + print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>'; |
|
93 | 93 | } else { |
94 | 94 | print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>'; |
95 | 95 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | print '<span>'._("Aircraft").'</span>'; |
109 | 109 | if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
110 | 110 | if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') { |
111 | - $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
|
111 | + $aircraft_names = explode('/', $spotter_item['aircraft_name']); |
|
112 | 112 | if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
113 | 113 | else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
114 | 114 | } elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | print '<div id ="altitude"><span>'._("Altitude").'</span>'; |
119 | 119 | if (isset($globalGroundAltitude) && $globalGroundAltitude) { |
120 | 120 | try { |
121 | - $groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']); |
|
122 | - } catch(Exception $e) { |
|
121 | + $groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']); |
|
122 | + } catch (Exception $e) { |
|
123 | 123 | // If catched not exist |
124 | 124 | } |
125 | 125 | } |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | if (isset($globalCam) && $globalCam) { |
159 | 159 | require_once(dirname(__FILE__).'/require/class.Common.php'); |
160 | 160 | $Common = new Common(); |
161 | - $azimuth = round($Common->azimuth($globalCenterLatitude,$globalCenterLongitude,$spotter_item['latitude'],$spotter_item['longitude'])); |
|
162 | - $distance = $Common->distance($globalCenterLatitude,$globalCenterLongitude,$spotter_item['latitude'],$spotter_item['longitude'],'m'); |
|
163 | - $plunge = round($Common->plunge($globalCenterAltitude,$spotter_item['real_altitude'],$distance)); |
|
161 | + $azimuth = round($Common->azimuth($globalCenterLatitude, $globalCenterLongitude, $spotter_item['latitude'], $spotter_item['longitude'])); |
|
162 | + $distance = $Common->distance($globalCenterLatitude, $globalCenterLongitude, $spotter_item['latitude'], $spotter_item['longitude'], 'm'); |
|
163 | + $plunge = round($Common->plunge($globalCenterAltitude, $spotter_item['real_altitude'], $distance)); |
|
164 | 164 | print '<div id="camcoordinates"><span>'._("Cam Coordinates").'</span>'; |
165 | 165 | print 'azimuth: '.$azimuth; |
166 | 166 | print ' / '; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | print '</div>'; |
171 | 171 | //echo $Common->getData('http://127.0.0.1/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true); |
172 | 172 | //echo $Common->getData('file://'.dirname(__FILE__).'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true); |
173 | - echo $Common->getData('http://'.$_SERVER['SERVER_NAME'].'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true); |
|
173 | + echo $Common->getData('http://'.$_SERVER['SERVER_NAME'].'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge, 'get', '', '', '', '', '', '', false, true); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>'; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | print '</div>'; |
206 | 206 | if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
207 | 207 | if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
208 | - if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
208 | + if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>'; |
|
209 | 209 | if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
210 | 210 | print '</div>'; |
211 | 211 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | require_once(dirname(__FILE__).'/require/class.Common.php'); |
6 | 6 | $Common = new Common(); |
7 | -$showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop'); |
|
8 | -$showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
|
7 | +$showRouteStop = $Common->multiKeyExists($spotter_array, 'route_stop'); |
|
8 | +$showDuration = $Common->multiKeyExists($spotter_array, 'duration'); |
|
9 | 9 | |
10 | 10 | if (!isset($type)) $type = 'aircraft'; |
11 | 11 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | print '<th class="more"></th>'; |
141 | 141 | print '</thead>'; |
142 | -} else if (strtolower($current_page) == "upcoming"){ |
|
142 | +} else if (strtolower($current_page) == "upcoming") { |
|
143 | 143 | print '<thead>'; |
144 | 144 | if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
145 | 145 | if ($_GET['sort'] == "airline_name_asc") |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | */ |
195 | 195 | print '</thead>'; |
196 | -} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){ |
|
196 | +} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
|
197 | 197 | print '<thead>'; |
198 | 198 | print '<th class="aircraft_thumbnail"></th>'; |
199 | 199 | print '<th class="logo">'._("Airline").'</th>'; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | print '</thead>'; |
231 | 231 | } else { |
232 | 232 | |
233 | - if ($hide_th_links === true){ |
|
233 | + if ($hide_th_links === true) { |
|
234 | 234 | print '<thead>'; |
235 | 235 | print '<th class="aircraft_thumbnail"></th>'; |
236 | 236 | if ($type == 'aircraft') { |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | } |
488 | 488 | |
489 | 489 | print '<tbody>'."\n"; |
490 | -foreach($spotter_array as $spotter_item) |
|
490 | +foreach ($spotter_array as $spotter_item) |
|
491 | 491 | { |
492 | 492 | if (isset($globalTimezone)) |
493 | 493 | { |
@@ -522,13 +522,13 @@ discard block |
||
522 | 522 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
523 | 523 | } |
524 | 524 | if (isset($spotter_item['airline_name'])) { |
525 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
525 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
526 | 526 | } else { |
527 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
527 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
528 | 528 | } |
529 | 529 | } else { |
530 | 530 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
531 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
531 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
532 | 532 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
533 | 533 | if (isset($spotter_item['airline_name'])) { |
534 | 534 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | { |
548 | 548 | print '<td class="aircraft_thumbnail">'."\n"; |
549 | 549 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
550 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
550 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
551 | 551 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
552 | 552 | if (isset($spotter_item['airline_name'])) { |
553 | 553 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | { |
566 | 566 | print '<td class="aircraft_thumbnail">'."\n"; |
567 | 567 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
568 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
568 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
569 | 569 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
570 | 570 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
571 | 571 | print '</td>'."\n"; |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | print '</td>'."\n"; |
610 | 610 | } |
611 | 611 | } |
612 | - } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){ |
|
612 | + } elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") { |
|
613 | 613 | if ($type == 'aircraft') { |
614 | 614 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
615 | 615 | $spotter_item['squawk'] = '-'; |
@@ -626,17 +626,17 @@ discard block |
||
626 | 626 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
627 | 627 | } |
628 | 628 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
629 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
629 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
630 | 630 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
631 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
631 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
632 | 632 | } elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) { |
633 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
633 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
634 | 634 | } else { |
635 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
635 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
636 | 636 | } |
637 | 637 | } else { |
638 | 638 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
639 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
639 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
640 | 640 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
641 | 641 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
642 | 642 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | { |
670 | 670 | print '<td class="aircraft_thumbnail">'."\n"; |
671 | 671 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
672 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
672 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
673 | 673 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
674 | 674 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
675 | 675 | print '</td>'."\n"; |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | { |
684 | 684 | print '<td class="aircraft_thumbnail">'."\n"; |
685 | 685 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
686 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
686 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
687 | 687 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
688 | 688 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
689 | 689 | print '</td>'."\n"; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | print '</td>'."\n"; |
793 | 793 | } |
794 | 794 | // Aircraft type |
795 | - if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){ |
|
795 | + if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") { |
|
796 | 796 | print '<td class="type">'."\n"; |
797 | 797 | if ($type == 'aircraft') { |
798 | 798 | if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) { |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | //print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'._("Not available").'</a></span>'."\n"; |
802 | 802 | print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a></span>'."\n"; |
803 | 803 | } else { |
804 | - $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
|
804 | + $aircraft_names = explode('/', $spotter_item['aircraft_name']); |
|
805 | 805 | if (count($aircraft_names) == 1) print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a></span>'."\n"; |
806 | 806 | else print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].'</a></span>'."\n"; |
807 | 807 | } |
@@ -845,22 +845,22 @@ discard block |
||
845 | 845 | } |
846 | 846 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
847 | 847 | if ($spotter_item['departure_airport_time'] > 2460) { |
848 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
849 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
848 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
849 | + } else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
850 | 850 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
851 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
851 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
852 | 852 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
853 | 853 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
854 | 854 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
855 | 855 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
856 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
856 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
857 | 857 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
858 | 858 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
859 | 859 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
860 | 860 | if ($spotter_item['departure_airport_time'] > 2460) { |
861 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
861 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
862 | 862 | } else { |
863 | - $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
863 | + $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
864 | 864 | } |
865 | 865 | print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n"; |
866 | 866 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | $latitude = $spotter_item['latitude']; |
876 | 876 | $longitude = $spotter_item['longitude']; |
877 | 877 | } |
878 | - $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
|
878 | + $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude); |
|
879 | 879 | } else $distance = ''; |
880 | 880 | if ($distance != '') { |
881 | 881 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -918,20 +918,20 @@ discard block |
||
918 | 918 | } |
919 | 919 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
920 | 920 | if ($spotter_item['arrival_airport_time'] > 2460) { |
921 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
921 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
922 | 922 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
923 | 923 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
924 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
924 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
925 | 925 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
926 | 926 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
927 | 927 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
928 | 928 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
929 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
929 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
930 | 930 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
931 | 931 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
932 | 932 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
933 | 933 | if ($spotter_item['arrival_airport_time'] > 2460) { |
934 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
934 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
935 | 935 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
936 | 936 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
937 | 937 | } |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | $latitude = $spotter_item['latitude']; |
945 | 945 | $longitude = $spotter_item['longitude']; |
946 | 946 | } |
947 | - $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
|
947 | + $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude); |
|
948 | 948 | } else $distance = ''; |
949 | 949 | if ($distance != '') { |
950 | 950 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -987,19 +987,19 @@ discard block |
||
987 | 987 | print '<span class="mobile">-</span>'."\n"; |
988 | 988 | } else { |
989 | 989 | if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
990 | - print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n"; |
|
991 | - print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n"; |
|
990 | + print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n"; |
|
991 | + print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n"; |
|
992 | 992 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
993 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n"; |
|
994 | - print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n"; |
|
993 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n"; |
|
994 | + print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n"; |
|
995 | 995 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
996 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n"; |
|
997 | - print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n"; |
|
996 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n"; |
|
997 | + print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n"; |
|
998 | 998 | } |
999 | 999 | } |
1000 | 1000 | print '</td>'."\n"; |
1001 | 1001 | } |
1002 | - if(strtolower($current_page) != "upcoming"){ |
|
1002 | + if (strtolower($current_page) != "upcoming") { |
|
1003 | 1003 | if ($type == 'aircraft') { |
1004 | 1004 | //if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
1005 | 1005 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | |
1043 | 1043 | if ($showRouteStop) { |
1044 | 1044 | // Route stop |
1045 | - if(strtolower($current_page) != "upcoming"){ |
|
1045 | + if (strtolower($current_page) != "upcoming") { |
|
1046 | 1046 | print '<td class="route_stop">'."\n"; |
1047 | 1047 | if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') { |
1048 | 1048 | print '<span class="nomobile">-</span>'."\n"; |
@@ -1061,11 +1061,11 @@ discard block |
||
1061 | 1061 | } |
1062 | 1062 | if ($showDuration) { |
1063 | 1063 | // Duration |
1064 | - if(strtolower($current_page) != "upcoming"){ |
|
1064 | + if (strtolower($current_page) != "upcoming") { |
|
1065 | 1065 | print '<td class="duration">'."\n"; |
1066 | 1066 | if (isset($spotter_item['duration'])) { |
1067 | - print '<span class="nomobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n"; |
|
1068 | - print '<span class="mobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n"; |
|
1067 | + print '<span class="nomobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n"; |
|
1068 | + print '<span class="mobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n"; |
|
1069 | 1069 | } else { |
1070 | 1070 | print '<span class="nomobile">-</span>'."\n"; |
1071 | 1071 | print '<span class="mobile">-</span>'."\n"; |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
1079 | 1079 | if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') { |
1080 | 1080 | print '<td class="message"><p>'."\n"; |
1081 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
1081 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
1082 | 1082 | print '</p><p class="decode">'; |
1083 | 1083 | $decode_array = json_decode($spotter_item['decode']); |
1084 | 1084 | foreach ($decode_array as $key => $value) { |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | print '</td>'."\n"; |
1089 | 1089 | } else { |
1090 | 1090 | print '<td class="message">'."\n"; |
1091 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
1091 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
1092 | 1092 | print '</td>'."\n"; |
1093 | 1093 | } |
1094 | 1094 | } |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | } |
1114 | 1114 | print '</td>'."\n"; |
1115 | 1115 | print '<td class="message">'."\n"; |
1116 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
1116 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
1117 | 1117 | print '</td>'."\n"; |
1118 | 1118 | } |
1119 | 1119 | if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") { |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | print '</td>'."\n"; |
1140 | 1140 | */ |
1141 | 1141 | print '<td class="message">'."\n"; |
1142 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
1142 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
1143 | 1143 | print '</td>'."\n"; |
1144 | 1144 | } |
1145 | 1145 |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | try { |
989 | 989 | $sth = $this->db->prepare($query); |
990 | 990 | $sth->execute($query_values); |
991 | - } catch(PDOException $e) { |
|
991 | + } catch (PDOException $e) { |
|
992 | 992 | echo "error : ".$e->getMessage(); |
993 | 993 | } |
994 | 994 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1005,19 +1005,19 @@ discard block |
||
1005 | 1005 | try { |
1006 | 1006 | $sth = $this->db->prepare($query); |
1007 | 1007 | $sth->execute($query_values); |
1008 | - } catch(PDOException $e) { |
|
1008 | + } catch (PDOException $e) { |
|
1009 | 1009 | echo "error : ".$e->getMessage(); |
1010 | 1010 | } |
1011 | 1011 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1012 | 1012 | return $all; |
1013 | 1013 | } |
1014 | 1014 | public function getAllNOTAMtext() { |
1015 | - $query = 'SELECT full_notam FROM notam'; |
|
1015 | + $query = 'SELECT full_notam FROM notam'; |
|
1016 | 1016 | $query_values = array(); |
1017 | 1017 | try { |
1018 | 1018 | $sth = $this->db->prepare($query); |
1019 | 1019 | $sth->execute($query_values); |
1020 | - } catch(PDOException $e) { |
|
1020 | + } catch (PDOException $e) { |
|
1021 | 1021 | echo "error : ".$e->getMessage(); |
1022 | 1022 | } |
1023 | 1023 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1026,12 +1026,12 @@ discard block |
||
1026 | 1026 | public function createNOTAMtextFile($filename) { |
1027 | 1027 | $allnotam_result = $this->getAllNOTAMtext(); |
1028 | 1028 | $notamtext = ''; |
1029 | - foreach($allnotam_result as $notam) { |
|
1029 | + foreach ($allnotam_result as $notam) { |
|
1030 | 1030 | $notamtext .= '%%'."\n"; |
1031 | 1031 | $notamtext .= $notam['full_notam']; |
1032 | 1032 | $notamtext .= "\n".'%%'."\n"; |
1033 | 1033 | } |
1034 | - file_put_contents($filename,$notamtext); |
|
1034 | + file_put_contents($filename, $notamtext); |
|
1035 | 1035 | } |
1036 | 1036 | public function parseNOTAMtextFile($filename) { |
1037 | 1037 | $data = file_get_contents($filename); |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | try { |
1051 | 1051 | $sth = $this->db->prepare($query); |
1052 | 1052 | $sth->execute($query_values); |
1053 | - } catch(PDOException $e) { |
|
1053 | + } catch (PDOException $e) { |
|
1054 | 1054 | echo "error : ".$e->getMessage(); |
1055 | 1055 | } |
1056 | 1056 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1059,10 +1059,10 @@ discard block |
||
1059 | 1059 | public function getAllNOTAMbyCoord($coord) { |
1060 | 1060 | global $globalDBdriver; |
1061 | 1061 | if (is_array($coord)) { |
1062 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1063 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1064 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1065 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1062 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1063 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1064 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1065 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1066 | 1066 | if ($minlat > $maxlat) { |
1067 | 1067 | $tmplat = $minlat; |
1068 | 1068 | $minlat = $maxlat; |
@@ -1083,19 +1083,19 @@ discard block |
||
1083 | 1083 | try { |
1084 | 1084 | $sth = $this->db->prepare($query); |
1085 | 1085 | $sth->execute($query_values); |
1086 | - } catch(PDOException $e) { |
|
1086 | + } catch (PDOException $e) { |
|
1087 | 1087 | echo "error : ".$e->getMessage(); |
1088 | 1088 | } |
1089 | 1089 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1090 | 1090 | return $all; |
1091 | 1091 | } |
1092 | - public function getAllNOTAMbyCoordScope($coord,$scope) { |
|
1092 | + public function getAllNOTAMbyCoordScope($coord, $scope) { |
|
1093 | 1093 | global $globalDBdriver; |
1094 | 1094 | if (is_array($coord)) { |
1095 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1096 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1097 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1098 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1095 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1096 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1097 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1098 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1099 | 1099 | } else return array(); |
1100 | 1100 | if ($globalDBdriver == 'mysql') { |
1101 | 1101 | $query = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope'; |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | try { |
1107 | 1107 | $sth = $this->db->prepare($query); |
1108 | 1108 | $sth->execute($query_values); |
1109 | - } catch(PDOException $e) { |
|
1109 | + } catch (PDOException $e) { |
|
1110 | 1110 | echo "error : ".$e->getMessage(); |
1111 | 1111 | } |
1112 | 1112 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | try { |
1119 | 1119 | $sth = $this->db->prepare($query); |
1120 | 1120 | $sth->execute($query_values); |
1121 | - } catch(PDOException $e) { |
|
1121 | + } catch (PDOException $e) { |
|
1122 | 1122 | return "error : ".$e->getMessage(); |
1123 | 1123 | } |
1124 | 1124 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1126,13 +1126,13 @@ discard block |
||
1126 | 1126 | else return array(); |
1127 | 1127 | } |
1128 | 1128 | |
1129 | - public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) { |
|
1129 | + public function addNOTAM($ref, $title, $type, $fir, $code, $rules, $scope, $lower_limit, $upper_limit, $center_latitude, $center_longitude, $radius, $date_begin, $date_end, $permanent, $text, $full_notam) { |
|
1130 | 1130 | $query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)"; |
1131 | - $query_values = array(':ref' => $ref,':title' => $title,':type' => $type,':fir' => $fir,':code' => $code,':rules' => $rules,':scope' => $scope,':lower_limit' => $lower_limit,':upper_limit' => $upper_limit,':center_latitude' => $center_latitude,':center_longitude' => $center_longitude,':radius' => $radius,':date_begin' => $date_begin,':date_end' => $date_end,':permanent' => $permanent,':text' => $text,':full_notam' => $full_notam); |
|
1131 | + $query_values = array(':ref' => $ref, ':title' => $title, ':type' => $type, ':fir' => $fir, ':code' => $code, ':rules' => $rules, ':scope' => $scope, ':lower_limit' => $lower_limit, ':upper_limit' => $upper_limit, ':center_latitude' => $center_latitude, ':center_longitude' => $center_longitude, ':radius' => $radius, ':date_begin' => $date_begin, ':date_end' => $date_end, ':permanent' => $permanent, ':text' => $text, ':full_notam' => $full_notam); |
|
1132 | 1132 | try { |
1133 | 1133 | $sth = $this->db->prepare($query); |
1134 | 1134 | $sth->execute($query_values); |
1135 | - } catch(PDOException $e) { |
|
1135 | + } catch (PDOException $e) { |
|
1136 | 1136 | return "error : ".$e->getMessage(); |
1137 | 1137 | } |
1138 | 1138 | } |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | try { |
1144 | 1144 | $sth = $this->db->prepare($query); |
1145 | 1145 | $sth->execute($query_values); |
1146 | - } catch(PDOException $e) { |
|
1146 | + } catch (PDOException $e) { |
|
1147 | 1147 | return "error : ".$e->getMessage(); |
1148 | 1148 | } |
1149 | 1149 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | try { |
1159 | 1159 | $sth = $this->db->prepare($query); |
1160 | 1160 | $sth->execute($query_values); |
1161 | - } catch(PDOException $e) { |
|
1161 | + } catch (PDOException $e) { |
|
1162 | 1162 | return "error : ".$e->getMessage(); |
1163 | 1163 | } |
1164 | 1164 | } |
@@ -1168,7 +1168,7 @@ discard block |
||
1168 | 1168 | try { |
1169 | 1169 | $sth = $this->db->prepare($query); |
1170 | 1170 | $sth->execute($query_values); |
1171 | - } catch(PDOException $e) { |
|
1171 | + } catch (PDOException $e) { |
|
1172 | 1172 | return "error : ".$e->getMessage(); |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1177,7 +1177,7 @@ discard block |
||
1177 | 1177 | try { |
1178 | 1178 | $sth = $this->db->prepare($query); |
1179 | 1179 | $sth->execute(); |
1180 | - } catch(PDOException $e) { |
|
1180 | + } catch (PDOException $e) { |
|
1181 | 1181 | return "error : ".$e->getMessage(); |
1182 | 1182 | } |
1183 | 1183 | } |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | try { |
1187 | 1187 | $sth = $this->db->prepare($query); |
1188 | 1188 | $sth->execute(); |
1189 | - } catch(PDOException $e) { |
|
1189 | + } catch (PDOException $e) { |
|
1190 | 1190 | return "error : ".$e->getMessage(); |
1191 | 1191 | } |
1192 | 1192 | } |
@@ -1194,14 +1194,14 @@ discard block |
||
1194 | 1194 | public function updateNOTAM() { |
1195 | 1195 | global $globalNOTAMAirports; |
1196 | 1196 | if (isset($globalNOTAMAirports) && is_array($globalNOTAMAirports) && count($globalNOTAMAirports) > 0) { |
1197 | - foreach (array_chunk($globalNOTAMAirports,10) as $airport) { |
|
1198 | - $airport_icao = implode(',',$airport); |
|
1197 | + foreach (array_chunk($globalNOTAMAirports, 10) as $airport) { |
|
1198 | + $airport_icao = implode(',', $airport); |
|
1199 | 1199 | $alldata = $this->downloadNOTAM($airport_icao); |
1200 | 1200 | if (count($alldata) > 0) { |
1201 | 1201 | foreach ($alldata as $initial_data) { |
1202 | 1202 | $data = $this->parse($initial_data); |
1203 | 1203 | $notamref = $this->getNOTAMbyRef($data['ref']); |
1204 | - if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
1204 | + if (count($notamref) == 0) $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
1205 | 1205 | } |
1206 | 1206 | } |
1207 | 1207 | } |
@@ -1218,8 +1218,8 @@ discard block |
||
1218 | 1218 | $j++; |
1219 | 1219 | $data = $this->parse($initial_data); |
1220 | 1220 | $notamref = $this->getNOTAMbyRef($data['ref']); |
1221 | - if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
1222 | - if ($globalTransaction && $j % 1000 == 0) { |
|
1221 | + if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
1222 | + if ($globalTransaction && $j%1000 == 0) { |
|
1223 | 1223 | $this->db->commit(); |
1224 | 1224 | if ($globalDebug) echo '.'; |
1225 | 1225 | $this->db->beginTransaction(); |
@@ -1233,12 +1233,12 @@ discard block |
||
1233 | 1233 | global $globalTransaction; |
1234 | 1234 | $Spotter = new Spotter($this->db); |
1235 | 1235 | $allairports = $Spotter->getAllAirportInfo(); |
1236 | - foreach (array_chunk($allairports,20) as $airport) { |
|
1236 | + foreach (array_chunk($allairports, 20) as $airport) { |
|
1237 | 1237 | $airports_icao = array(); |
1238 | - foreach($airport as $icao) { |
|
1238 | + foreach ($airport as $icao) { |
|
1239 | 1239 | if (isset($icao['icao'])) $airports_icao[] = $icao['icao']; |
1240 | 1240 | } |
1241 | - $airport_icao = implode(',',$airports_icao); |
|
1241 | + $airport_icao = implode(',', $airports_icao); |
|
1242 | 1242 | $alldata = $this->downloadNOTAM($airport_icao); |
1243 | 1243 | if ($globalTransaction) $this->db->beginTransaction(); |
1244 | 1244 | if (count($alldata) > 0) { |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | if (count($notamref) == 0) { |
1252 | 1252 | if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']); |
1253 | 1253 | if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']); |
1254 | - elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
1254 | + elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'], '', '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
1255 | 1255 | } |
1256 | 1256 | } |
1257 | 1257 | } |
@@ -1265,7 +1265,7 @@ discard block |
||
1265 | 1265 | date_default_timezone_set("UTC"); |
1266 | 1266 | $Common = new Common(); |
1267 | 1267 | //$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=DOMESTIC&retrieveLocId={icao}&actionType=notamRetrievalByICAOs'); |
1268 | - $url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs'); |
|
1268 | + $url = str_replace('{icao}', $icao, 'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs'); |
|
1269 | 1269 | $data = $Common->getData($url); |
1270 | 1270 | preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches); |
1271 | 1271 | //print_r($matches); |
@@ -1282,8 +1282,8 @@ discard block |
||
1282 | 1282 | $result['permanent'] = ''; |
1283 | 1283 | $result['date_begin'] = NULL; |
1284 | 1284 | $result['date_end'] = NULL; |
1285 | - $data = str_ireplace(array("\r","\n",'\r','\n'),' ',$data); |
|
1286 | - $data = preg_split('#\s(?=([A-Z]\)\s))#',$data); |
|
1285 | + $data = str_ireplace(array("\r", "\n", '\r', '\n'), ' ', $data); |
|
1286 | + $data = preg_split('#\s(?=([A-Z]\)\s))#', $data); |
|
1287 | 1287 | $q = false; |
1288 | 1288 | $a = false; |
1289 | 1289 | $b = false; |
@@ -1291,9 +1291,9 @@ discard block |
||
1291 | 1291 | $e = false; |
1292 | 1292 | foreach ($data as $line) { |
1293 | 1293 | $line = trim($line); |
1294 | - if (preg_match('#(^|\s)Q\) (.*)#',$line,$matches) && $q === false) { |
|
1295 | - $line = str_replace(' ','',$line); |
|
1296 | - if (preg_match('#Q\)([A-Z]{3,4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3}|)#',$line,$matches)) { |
|
1294 | + if (preg_match('#(^|\s)Q\) (.*)#', $line, $matches) && $q === false) { |
|
1295 | + $line = str_replace(' ', '', $line); |
|
1296 | + if (preg_match('#Q\)([A-Z]{3,4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3}|)#', $line, $matches)) { |
|
1297 | 1297 | //if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#',$line,$matches)) { |
1298 | 1298 | $result['fir'] = $matches[1]; |
1299 | 1299 | $result['code'] = $matches[2]; |
@@ -1338,9 +1338,9 @@ discard block |
||
1338 | 1338 | elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning'; |
1339 | 1339 | $result['lower_limit'] = $matches[6]; |
1340 | 1340 | $result['upper_limit'] = $matches[7]; |
1341 | - $latitude = $Common->convertDec($matches[8],'latitude'); |
|
1341 | + $latitude = $Common->convertDec($matches[8], 'latitude'); |
|
1342 | 1342 | if ($matches[9] == 'S') $latitude = -$latitude; |
1343 | - $longitude = $Common->convertDec($matches[10],'longitude'); |
|
1343 | + $longitude = $Common->convertDec($matches[10], 'longitude'); |
|
1344 | 1344 | if ($matches[11] == 'W') $longitude = -$longitude; |
1345 | 1345 | $result['latitude'] = $latitude; |
1346 | 1346 | $result['longitude'] = $longitude; |
@@ -1352,24 +1352,24 @@ discard block |
||
1352 | 1352 | echo "Can't parse : ".$line."\n"; |
1353 | 1353 | } |
1354 | 1354 | } |
1355 | - elseif (preg_match('#(^|\s)A\) (.*)#',$line,$matches) && $a === false) { |
|
1355 | + elseif (preg_match('#(^|\s)A\) (.*)#', $line, $matches) && $a === false) { |
|
1356 | 1356 | $result['icao'] = $matches[2]; |
1357 | 1357 | $a = true; |
1358 | 1358 | } |
1359 | - elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches) && $b === false) { |
|
1359 | + elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#', $line, $matches) && $b === false) { |
|
1360 | 1360 | if ($matches[1] > 50) $year = '19'.$matches[2]; |
1361 | 1361 | else $year = '20'.$matches[2]; |
1362 | 1362 | $result['date_begin'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6]; |
1363 | 1363 | $b = true; |
1364 | 1364 | } |
1365 | - elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches) && $c === false) { |
|
1365 | + elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#', $line, $matches) && $c === false) { |
|
1366 | 1366 | if ($matches[2] > 50) $year = '19'.$matches[2]; |
1367 | 1367 | else $year = '20'.$matches[2]; |
1368 | 1368 | $result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6]; |
1369 | 1369 | $result['permanent'] = 0; |
1370 | 1370 | $c = true; |
1371 | 1371 | } |
1372 | - elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches) && $c === false) { |
|
1372 | + elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#', $line, $matches) && $c === false) { |
|
1373 | 1373 | if ($matches[2] > 50) $year = '19'.$matches[2]; |
1374 | 1374 | else $year = '20'.$matches[2]; |
1375 | 1375 | $result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6]; |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | else $result['permanent'] = 0; |
1380 | 1380 | $c = true; |
1381 | 1381 | } |
1382 | - elseif (preg_match('#(^|\s)C\) (EST|PERM)$#',$line,$matches) && $c === false) { |
|
1382 | + elseif (preg_match('#(^|\s)C\) (EST|PERM)$#', $line, $matches) && $c === false) { |
|
1383 | 1383 | $result['date_end'] = '2030/12/20 12:00'; |
1384 | 1384 | if ($matches[2] == 'EST') $result['estimated'] = 1; |
1385 | 1385 | else $result['estimated'] = 0; |
@@ -1387,20 +1387,20 @@ discard block |
||
1387 | 1387 | else $result['permanent'] = 0; |
1388 | 1388 | $c = true; |
1389 | 1389 | } |
1390 | - elseif (preg_match('#(^|\s)E\) (.*)#',$line,$matches) && $e === false) { |
|
1390 | + elseif (preg_match('#(^|\s)E\) (.*)#', $line, $matches) && $e === false) { |
|
1391 | 1391 | $rtext = array(); |
1392 | - $text = explode(' ',$matches[2]); |
|
1392 | + $text = explode(' ', $matches[2]); |
|
1393 | 1393 | foreach ($text as $word) { |
1394 | 1394 | if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]); |
1395 | - elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3); |
|
1395 | + elseif (ctype_digit(strval(substr($word, 3))) && isset($this->abbr[substr($word, 0, 3)])) $rtext[] = strtoupper($this->abbr[substr($word, 0, 3)]).' '.substr($word, 3); |
|
1396 | 1396 | else $rtext[] = $word; |
1397 | 1397 | } |
1398 | - $result['text'] = implode(' ',$rtext); |
|
1398 | + $result['text'] = implode(' ', $rtext); |
|
1399 | 1399 | $e = true; |
1400 | 1400 | //} elseif (preg_match('#F\) (.*)#',$line,$matches)) { |
1401 | 1401 | //} elseif (preg_match('#G\) (.*)#',$line,$matches)) { |
1402 | - } elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) { |
|
1403 | - $text = explode(' ',$line); |
|
1402 | + } elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#', $line, $matches)) { |
|
1403 | + $text = explode(' ', $line); |
|
1404 | 1404 | $result['ref'] = $text[0]; |
1405 | 1405 | if ($matches[1] == 'NOTAMN') $result['type'] = 'new'; |
1406 | 1406 | if ($matches[1] == 'NOTAMC') { |