@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | die; |
60 | 60 | } |
61 | 61 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
62 | - $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
|
62 | + $globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | -$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver','enable-aircraft','disable-aircraft','enable-tracker','disable-tracker','enable-marine','disable-marine')); |
|
66 | +$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::', 'aprsserverhost::', 'aprsserverport::', 'format::', 'noaprsserver', 'enable-aircraft', 'disable-aircraft', 'enable-tracker', 'disable-tracker', 'enable-marine', 'disable-marine')); |
|
67 | 67 | //if (isset($options['s'])) $hosts = array($options['s']); |
68 | 68 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
69 | 69 | if (isset($options['s'])) { |
70 | 70 | $globalSources = array(); |
71 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
71 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['s'], 'format' => $options['format']); |
|
72 | 72 | else $globalSources[] = array('host' => $options['s']); |
73 | 73 | } elseif (isset($options['source'])) { |
74 | 74 | $globalSources = array(); |
75 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
75 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['source'], 'format' => $options['format']); |
|
76 | 76 | else $globalSources[] = array('host' => $options['source']); |
77 | 77 | } |
78 | 78 | if (isset($options['aprsserverhost'])) { |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | else $id_source = 1; |
114 | 114 | if (isset($globalServer) && $globalServer) { |
115 | 115 | if ($globalDebug) echo "Using Server Mode\n"; |
116 | - $SI=new SpotterServer(); |
|
116 | + $SI = new SpotterServer(); |
|
117 | 117 | /* |
118 | 118 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
119 | 119 | $SI = new adsb2aprs(); |
120 | 120 | $SI->connect(); |
121 | 121 | */ |
122 | -} else $SI=new SpotterImport($Connection->db); |
|
122 | +} else $SI = new SpotterImport($Connection->db); |
|
123 | 123 | |
124 | 124 | if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
125 | 125 | if (isset($globalMarine) && $globalMarine) { |
@@ -133,17 +133,17 @@ discard block |
||
133 | 133 | $MI = new MarineImport($Connection->db); |
134 | 134 | } |
135 | 135 | //$APRS=new APRS($Connection->db); |
136 | -$SBS=new SBS(); |
|
136 | +$SBS = new SBS(); |
|
137 | 137 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
138 | - $ACARS=new ACARS($Connection->db,true); |
|
139 | - $Source=new Source($Connection->db); |
|
138 | + $ACARS = new ACARS($Connection->db, true); |
|
139 | + $Source = new Source($Connection->db); |
|
140 | 140 | } |
141 | -$Common=new Common(); |
|
141 | +$Common = new Common(); |
|
142 | 142 | date_default_timezone_set('UTC'); |
143 | 143 | //$servertz = system('date +%Z'); |
144 | 144 | // signal handler - playing nice with sockets and dump1090 |
145 | 145 | if (function_exists('pcntl_fork')) { |
146 | - pcntl_signal(SIGINT, function() { |
|
146 | + pcntl_signal(SIGINT, function() { |
|
147 | 147 | global $sockets; |
148 | 148 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
149 | 149 | die("Bye!\n"); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | function connect_all($hosts) { |
161 | 161 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
162 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
162 | + global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context; |
|
163 | 163 | $reset++; |
164 | 164 | if ($globalDebug) echo 'Connect to all...'."\n"; |
165 | 165 | foreach ($hosts as $id => $value) { |
@@ -167,33 +167,33 @@ discard block |
||
167 | 167 | $udp = false; |
168 | 168 | $globalSources[$id]['last_exec'] = 0; |
169 | 169 | // Here we check type of source(s) |
170 | - if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
171 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
170 | + if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
171 | + if (preg_match('/deltadb.txt$/i', $host)) { |
|
172 | 172 | //$formats[$id] = 'deltadbtxt'; |
173 | 173 | $globalSources[$id]['format'] = 'deltadbtxt'; |
174 | 174 | //$last_exec['deltadbtxt'] = 0; |
175 | 175 | if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
176 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
176 | + } else if (preg_match('/vatsim-data.txt$/i', $host)) { |
|
177 | 177 | //$formats[$id] = 'vatsimtxt'; |
178 | 178 | $globalSources[$id]['format'] = 'vatsimtxt'; |
179 | 179 | //$last_exec['vatsimtxt'] = 0; |
180 | 180 | if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
181 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
181 | + } else if (preg_match('/aircraftlist.json$/i', $host)) { |
|
182 | 182 | //$formats[$id] = 'aircraftlistjson'; |
183 | 183 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
184 | 184 | //$last_exec['aircraftlistjson'] = 0; |
185 | 185 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
186 | - } else if (preg_match('/aircraft.json$/i',$host)) { |
|
186 | + } else if (preg_match('/aircraft.json$/i', $host)) { |
|
187 | 187 | //$formats[$id] = 'aircraftjson'; |
188 | 188 | $globalSources[$id]['format'] = 'aircraftjson'; |
189 | 189 | //$last_exec['aircraftlistjson'] = 0; |
190 | 190 | if ($globalDebug) echo "Connect to aircraft.json source (".$host.")...\n"; |
191 | - } else if (preg_match('/aircraft$/i',$host)) { |
|
191 | + } else if (preg_match('/aircraft$/i', $host)) { |
|
192 | 192 | //$formats[$id] = 'planefinderclient'; |
193 | 193 | $globalSources[$id]['format'] = 'planefinderclient'; |
194 | 194 | //$last_exec['aircraftlistjson'] = 0; |
195 | 195 | if ($globalDebug) echo "Connect to planefinderclient source (".$host.")...\n"; |
196 | - } else if (preg_match('/opensky/i',$host)) { |
|
196 | + } else if (preg_match('/opensky/i', $host)) { |
|
197 | 197 | //$formats[$id] = 'aircraftlistjson'; |
198 | 198 | $globalSources[$id]['format'] = 'opensky'; |
199 | 199 | //$last_exec['aircraftlistjson'] = 0; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | exit(0); |
211 | 211 | } |
212 | 212 | */ |
213 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
213 | + } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { |
|
214 | 214 | //$formats[$id] = 'planeupdatefaa'; |
215 | 215 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
216 | 216 | //$last_exec['planeupdatefaa'] = 0; |
@@ -219,37 +219,37 @@ discard block |
||
219 | 219 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
220 | 220 | exit(0); |
221 | 221 | } |
222 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
222 | + } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { |
|
223 | 223 | //$formats[$id] = 'phpvmacars'; |
224 | 224 | $globalSources[$id]['format'] = 'phpvmacars'; |
225 | 225 | //$last_exec['phpvmacars'] = 0; |
226 | 226 | if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
227 | - } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) { |
|
227 | + } else if (preg_match('/\/api\/v1\/acars\/data$/i', $host)) { |
|
228 | 228 | //$formats[$id] = 'phpvmacars'; |
229 | 229 | $globalSources[$id]['format'] = 'vaos'; |
230 | 230 | //$last_exec['phpvmacars'] = 0; |
231 | 231 | if ($globalDebug) echo "Connect to vaos source (".$host.")...\n"; |
232 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
232 | + } else if (preg_match('/VAM-json.php$/i', $host)) { |
|
233 | 233 | //$formats[$id] = 'phpvmacars'; |
234 | 234 | $globalSources[$id]['format'] = 'vam'; |
235 | 235 | if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
236 | - } else if (preg_match('/whazzup/i',$host)) { |
|
236 | + } else if (preg_match('/whazzup/i', $host)) { |
|
237 | 237 | //$formats[$id] = 'whazzup'; |
238 | 238 | $globalSources[$id]['format'] = 'whazzup'; |
239 | 239 | //$last_exec['whazzup'] = 0; |
240 | 240 | if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
241 | - } else if (preg_match('/blitzortung/i',$host)) { |
|
241 | + } else if (preg_match('/blitzortung/i', $host)) { |
|
242 | 242 | $globalSources[$id]['format'] = 'blitzortung'; |
243 | 243 | if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
244 | - } else if (preg_match('/airwhere/i',$host)) { |
|
244 | + } else if (preg_match('/airwhere/i', $host)) { |
|
245 | 245 | $globalSources[$id]['format'] = 'airwhere'; |
246 | 246 | if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
247 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
247 | + } else if (preg_match('/recentpireps/i', $host)) { |
|
248 | 248 | //$formats[$id] = 'pirepsjson'; |
249 | 249 | $globalSources[$id]['format'] = 'pirepsjson'; |
250 | 250 | //$last_exec['pirepsjson'] = 0; |
251 | 251 | if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
252 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
252 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { |
|
253 | 253 | //$formats[$id] = 'fr24json'; |
254 | 254 | $globalSources[$id]['format'] = 'fr24json'; |
255 | 255 | //$last_exec['fr24json'] = 0; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
259 | 259 | exit(0); |
260 | 260 | } |
261 | - } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
261 | + } else if (preg_match(':myshiptracking.com/:i', $host)) { |
|
262 | 262 | //$formats[$id] = 'fr24json'; |
263 | 263 | $globalSources[$id]['format'] = 'myshiptracking'; |
264 | 264 | //$last_exec['fr24json'] = 0; |
@@ -268,14 +268,14 @@ discard block |
||
268 | 268 | exit(0); |
269 | 269 | } |
270 | 270 | //} else if (preg_match('/10001/',$host)) { |
271 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
271 | + } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
272 | 272 | //$formats[$id] = 'tsv'; |
273 | 273 | $globalSources[$id]['format'] = 'tsv'; |
274 | 274 | if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
275 | 275 | } |
276 | - } elseif (filter_var($host,FILTER_VALIDATE_URL) || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailaway') || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailawayfull') || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'acarsjson')) { |
|
276 | + } elseif (filter_var($host, FILTER_VALIDATE_URL) || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailaway') || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailawayfull') || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'acarsjson')) { |
|
277 | 277 | if ($globalSources[$id]['format'] == 'aisnmeahttp' || $globalSources[$id]['format'] == 'acarsjson') { |
278 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
278 | + $idf = fopen($globalSources[$id]['host'], 'r', false, $context); |
|
279 | 279 | if ($idf !== false) { |
280 | 280 | $httpfeeds[$id] = $idf; |
281 | 281 | if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | } elseif ($globalDebug && isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailaway') echo "Connect to ".$globalSources[$id]['format']." source (sailaway)...\n"; |
284 | 284 | elseif ($globalDebug && isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailawayfull') echo "Connect to ".$globalSources[$id]['format']." source (sailawayfull)...\n"; |
285 | 285 | elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
286 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
287 | - $hostport = explode(':',$host); |
|
286 | + } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { |
|
287 | + $hostport = explode(':', $host); |
|
288 | 288 | if (isset($hostport[1])) { |
289 | 289 | $port = $hostport[1]; |
290 | 290 | $hostn = $hostport[0]; |
@@ -294,20 +294,20 @@ discard block |
||
294 | 294 | } |
295 | 295 | $Common = new Common(); |
296 | 296 | if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acarsjsonudp' && $globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
297 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
297 | + $s = $Common->create_socket($hostn, $port, $errno, $errstr); |
|
298 | 298 | } else { |
299 | 299 | $udp = true; |
300 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
300 | + $s = $Common->create_socket_udp($hostn, $port, $errno, $errstr); |
|
301 | 301 | } |
302 | 302 | if ($s) { |
303 | 303 | $sockets[$id] = $s; |
304 | 304 | if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
305 | - if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
305 | + if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') { |
|
306 | 306 | //$formats[$id] = 'aprs'; |
307 | 307 | $globalSources[$id]['format'] = 'aprs'; |
308 | 308 | //$aprs_connect = 0; |
309 | 309 | //$use_aprs = true; |
310 | - } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
310 | + } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
311 | 311 | $globalSources[$id]['format'] = 'vrstcp'; |
312 | 312 | } elseif ($port == '10001') { |
313 | 313 | //$formats[$id] = 'tsv'; |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
350 | 350 | else $timeout = 20; |
351 | 351 | $errno = ''; |
352 | -$errstr=''; |
|
352 | +$errstr = ''; |
|
353 | 353 | |
354 | 354 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
355 | 355 | /* Initiate connections to all the hosts simultaneously */ |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | //connect_all($globalSources); |
358 | 358 | |
359 | 359 | if (isset($globalProxy) && $globalProxy) { |
360 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
360 | + $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true))); |
|
361 | 361 | } else { |
362 | 362 | $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
363 | 363 | } |
@@ -387,16 +387,16 @@ discard block |
||
387 | 387 | |
388 | 388 | if ($use_aprs) { |
389 | 389 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
390 | - $APRS=new APRS(); |
|
390 | + $APRS = new APRS(); |
|
391 | 391 | $aprs_connect = 0; |
392 | 392 | $aprs_keep = 120; |
393 | 393 | $aprs_last_tx = time(); |
394 | 394 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
395 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
395 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
396 | 396 | if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
397 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
397 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
398 | 398 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
399 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
399 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
400 | 400 | if ($aprs_full) $aprs_filter = ''; |
401 | 401 | if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
402 | 402 | else $aprs_pass = '-1'; |
@@ -410,12 +410,12 @@ discard block |
||
410 | 410 | sleep(1); |
411 | 411 | if ($globalDebug) echo "SCAN MODE \n\n"; |
412 | 412 | if (!isset($globalCronEnd)) $globalCronEnd = 60; |
413 | -$endtime = time()+$globalCronEnd; |
|
413 | +$endtime = time() + $globalCronEnd; |
|
414 | 414 | $i = 1; |
415 | 415 | $tt = array(); |
416 | 416 | // Delete all ATC |
417 | 417 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
418 | - $ATC=new ATC($Connection->db); |
|
418 | + $ATC = new ATC($Connection->db); |
|
419 | 419 | } |
420 | 420 | if (!$globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
421 | 421 | $ATC->deleteAll(); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | while ($i > 0) { |
426 | 426 | if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
427 | 427 | |
428 | - if (!$globalDaemon) $i = $endtime-time(); |
|
428 | + if (!$globalDaemon) $i = $endtime - time(); |
|
429 | 429 | // Delete old ATC |
430 | 430 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
431 | 431 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | } |
440 | 440 | if ($max < $globalMinFetch) { |
441 | 441 | if ($globalDebug) echo 'Sleeping...'."\n"; |
442 | - sleep($globalMinFetch-$max+2); |
|
442 | + sleep($globalMinFetch - $max + 2); |
|
443 | 443 | } |
444 | 444 | } |
445 | 445 | |
@@ -494,10 +494,10 @@ discard block |
||
494 | 494 | //$buffer = $Common->getData($hosts[$id]); |
495 | 495 | $buffer = $Common->getData($value['host']); |
496 | 496 | if ($buffer != '') { |
497 | - $all_data = json_decode($buffer,true); |
|
497 | + $all_data = json_decode($buffer, true); |
|
498 | 498 | foreach ($all_data as $line) { |
499 | 499 | $data = array(); |
500 | - $data['datetime'] = date('Y-m-d H:i:s',$line['uti']); |
|
500 | + $data['datetime'] = date('Y-m-d H:i:s', $line['uti']); |
|
501 | 501 | $data['hex'] = $line['hex']; // hex |
502 | 502 | $data['ident'] = $line['fli']; // ident |
503 | 503 | $data['altitude'] = $line['alt']; // altitude |
@@ -532,11 +532,11 @@ discard block |
||
532 | 532 | ) |
533 | 533 | ) { |
534 | 534 | date_default_timezone_set('CET'); |
535 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
535 | + $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host'])); |
|
536 | 536 | date_default_timezone_set('UTC'); |
537 | 537 | if ($buffer != '') $reset = 0; |
538 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
539 | - $buffer = explode('\n',$buffer); |
|
538 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
539 | + $buffer = explode('\n', $buffer); |
|
540 | 540 | foreach ($buffer as $line) { |
541 | 541 | if ($line != '') { |
542 | 542 | //echo "'".$line."'\n"; |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | $ais_data = $AIS->parse_line(trim($line)); |
545 | 545 | $data = array(); |
546 | 546 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
547 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
547 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
548 | 548 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
549 | 549 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
550 | 550 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
557 | 557 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
558 | 558 | if (isset($ais_data['timestamp'])) { |
559 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
559 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
560 | 560 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
561 | 561 | $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
562 | 562 | $add = true; |
@@ -579,21 +579,21 @@ discard block |
||
579 | 579 | $w = $e = null; |
580 | 580 | |
581 | 581 | if (isset($arr[$id])) { |
582 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
582 | + $nn = stream_select($arr, $w, $e, $timeout); |
|
583 | 583 | if ($nn > 0) { |
584 | 584 | foreach ($httpfeeds as $feed) { |
585 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
585 | + $buffer = stream_get_line($feed, 2000, "\n"); |
|
586 | 586 | if ($buffer === FALSE) { |
587 | 587 | connect_all($globalSources); |
588 | 588 | } |
589 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
590 | - $buffer = explode('\n',$buffer); |
|
589 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
590 | + $buffer = explode('\n', $buffer); |
|
591 | 591 | foreach ($buffer as $line) { |
592 | 592 | if ($line != '') { |
593 | 593 | $ais_data = $AIS->parse_line(trim($line)); |
594 | 594 | $data = array(); |
595 | 595 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
596 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
596 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
597 | 597 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
598 | 598 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
599 | 599 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -605,9 +605,9 @@ discard block |
||
605 | 605 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
606 | 606 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
607 | 607 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
608 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
608 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
609 | 609 | if (isset($ais_data['timestamp'])) { |
610 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
610 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
611 | 611 | } else { |
612 | 612 | $data['datetime'] = date('Y-m-d H:i:s'); |
613 | 613 | } |
@@ -639,10 +639,10 @@ discard block |
||
639 | 639 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
640 | 640 | ) |
641 | 641 | ) { |
642 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
642 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
643 | 643 | if ($buffer != '') { |
644 | 644 | //echo $buffer; |
645 | - $all_data = json_decode($buffer,true); |
|
645 | + $all_data = json_decode($buffer, true); |
|
646 | 646 | //print_r($all_data); |
647 | 647 | if (isset($all_data[0]['DATA'])) { |
648 | 648 | foreach ($all_data[0]['DATA'] as $line) { |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | $data['ident'] = $line['NAME']; |
652 | 652 | $data['mmsi'] = $line['MMSI']; |
653 | 653 | if (strlen($data['mmsi']) > 9) { |
654 | - $data['mmsi'] = substr($data['mmsi'],-9); |
|
654 | + $data['mmsi'] = substr($data['mmsi'], -9); |
|
655 | 655 | } |
656 | 656 | $data['speed'] = $line['SOG']; |
657 | 657 | $data['heading'] = $line['COG']; |
@@ -661,8 +661,8 @@ discard block |
||
661 | 661 | //$data['type_id'] = $line['TYPE']; |
662 | 662 | $data['imo'] = $line['IMO']; |
663 | 663 | if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST']; |
664 | - if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
665 | - $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
664 | + if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s', strtotime($line['ARV'])); |
|
665 | + $data['datetime'] = date('Y-m-d H:i:s', $line['T']); |
|
666 | 666 | $data['format_source'] = 'myshiptracking'; |
667 | 667 | $data['id_source'] = $id_source; |
668 | 668 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -679,16 +679,16 @@ discard block |
||
679 | 679 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
680 | 680 | ) |
681 | 681 | ) { |
682 | - $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
682 | + $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host'])); |
|
683 | 683 | if ($buffer != '') { |
684 | - $all_data = json_decode($buffer,true); |
|
684 | + $all_data = json_decode($buffer, true); |
|
685 | 685 | if (isset($all_data[0]['mmsi'])) { |
686 | 686 | foreach ($all_data as $line) { |
687 | 687 | if ($line != '') { |
688 | 688 | $data = array(); |
689 | 689 | $data['ident'] = $line['shipname']; |
690 | 690 | $data['callsign'] = $line['callsign']; |
691 | - $data['mmsi'] = substr($line['mmsi'],-9); |
|
691 | + $data['mmsi'] = substr($line['mmsi'], -9); |
|
692 | 692 | $data['speed'] = $line['sog']; |
693 | 693 | if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
694 | 694 | $data['latitude'] = $line['latitude']; |
@@ -715,14 +715,14 @@ discard block |
||
715 | 715 | ) { |
716 | 716 | $buffer = $Common->getData($value['host']); |
717 | 717 | if ($buffer != '') { |
718 | - $all_data = json_decode($buffer,true); |
|
718 | + $all_data = json_decode($buffer, true); |
|
719 | 719 | if (isset($all_data['features'][0]['id'])) { |
720 | 720 | foreach ($all_data['features'] as $line) { |
721 | 721 | print_r($line); |
722 | 722 | $data = array(); |
723 | 723 | if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
724 | 724 | if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
725 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
725 | + if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'], -9); |
|
726 | 726 | if (isset($line['properties']['imo'])) $data['imo'] = $line['properties']['imo']; |
727 | 727 | if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
728 | 728 | if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) $data['heading'] = $line['properties']['heading']; |
@@ -749,31 +749,31 @@ discard block |
||
749 | 749 | ) |
750 | 750 | ) { |
751 | 751 | if ($globalDebug) echo 'download...'; |
752 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
752 | + $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter'); |
|
753 | 753 | if ($globalDebug) echo 'done !'."\n"; |
754 | 754 | // FIXME: Need more work |
755 | 755 | if ($buffer != '') $reset = 0; |
756 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
757 | - $buffer = explode('\n',$buffer); |
|
756 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
757 | + $buffer = explode('\n', $buffer); |
|
758 | 758 | foreach ($buffer as $line) { |
759 | 759 | if ($line != '') { |
760 | 760 | $data = array(); |
761 | 761 | //echo $line."\n"; |
762 | - $data['mmsi'] = (int)substr($line,0,9); |
|
763 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
764 | - $data['status_id'] = substr($line,21,2); |
|
765 | - $data['type_id'] = substr($line,24,3); |
|
766 | - $data['latitude'] = substr($line,29,9); |
|
767 | - $data['longitude'] = substr($line,41,9); |
|
768 | - $data['speed'] = round(substr($line,51,5)); |
|
762 | + $data['mmsi'] = (int) substr($line, 0, 9); |
|
763 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10)); |
|
764 | + $data['status_id'] = substr($line, 21, 2); |
|
765 | + $data['type_id'] = substr($line, 24, 3); |
|
766 | + $data['latitude'] = substr($line, 29, 9); |
|
767 | + $data['longitude'] = substr($line, 41, 9); |
|
768 | + $data['speed'] = round(substr($line, 51, 5)); |
|
769 | 769 | //$data['course'] = substr($line,57,5); |
770 | - $data['heading'] = round(substr($line,63,3)); |
|
770 | + $data['heading'] = round(substr($line, 63, 3)); |
|
771 | 771 | //$data['draft'] = substr($line,67,4); |
772 | 772 | //$data['length'] = substr($line,72,3); |
773 | 773 | //$data['beam'] = substr($line,76,2); |
774 | - $data['ident'] = trim(utf8_encode(substr($line,78,20))); |
|
774 | + $data['ident'] = trim(utf8_encode(substr($line, 78, 20))); |
|
775 | 775 | //$data['callsign'] = trim(substr($line,100,7); |
776 | - $data['arrival_code'] = substr($line,108,20); |
|
776 | + $data['arrival_code'] = substr($line, 108, 20); |
|
777 | 777 | //$data['etaDate'] = substr($line,129,5); |
778 | 778 | //$data['etaTime'] = substr($line,135,5); |
779 | 779 | $data['format_source'] = 'shipplotter'; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | ) |
793 | 793 | ) { |
794 | 794 | if (isset($globalSailaway['email']) && $globalSailaway['email'] != '' && isset($globalSailaway['password']) && $globalSailaway['password'] != '') { |
795 | - $authsailaway = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/weblogin.pl','post',array('submitlogin' => 'Login','email' => $globalSailaway['email'],'pwd' => $globalSailaway['password'], 'page' => 'http://sailaway.world/cgi-bin/sailaway/missions.pl'),'','','','','',false,false,true); |
|
795 | + $authsailaway = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/weblogin.pl', 'post', array('submitlogin' => 'Login', 'email' => $globalSailaway['email'], 'pwd' => $globalSailaway['password'], 'page' => 'http://sailaway.world/cgi-bin/sailaway/missions.pl'), '', '', '', '', '', false, false, true); |
|
796 | 796 | //echo $authsailaway; |
797 | 797 | preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $authsailaway, $setcookie); |
798 | 798 | if (isset($setcookie[1][0])) { |
@@ -801,19 +801,19 @@ discard block |
||
801 | 801 | } |
802 | 802 | |
803 | 803 | if ($globalDebug) echo '! Download... '; |
804 | - for ($i =0; $i <= 1; $i++) { |
|
804 | + for ($i = 0; $i <= 1; $i++) { |
|
805 | 805 | if ($globalDebug) echo 'Racetype: '.$i.' '; |
806 | 806 | $buffer = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/GetMissions.pl?race=1&tutorial=0&hist=1&racetype='.$i); |
807 | 807 | if ($globalDebug) echo 'done'."\n"; |
808 | 808 | if ($buffer != '') { |
809 | - $all_data = json_decode($buffer,true); |
|
809 | + $all_data = json_decode($buffer, true); |
|
810 | 810 | if (isset($all_data['missions'])) { |
811 | 811 | foreach ($all_data['missions'] as $mission) { |
812 | 812 | $mission_user = $mission['usrname']; |
813 | - $mission_name = preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',$Common->remove_accents($mission['mistitle'])); |
|
814 | - if (!isset($globalFilter['sailway']['race']) || (isset($globalFilter['sailway']['race']) && in_array($mission['misnr'],$globalFilter['sailway']['race']))) { |
|
813 | + $mission_name = preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $Common->remove_accents($mission['mistitle'])); |
|
814 | + if (!isset($globalFilter['sailway']['race']) || (isset($globalFilter['sailway']['race']) && in_array($mission['misnr'], $globalFilter['sailway']['race']))) { |
|
815 | 815 | if (isset($sailaway_authcookie) && $sailaway_authcookie != '') { |
816 | - $racebuffer = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/GetMission.pl?misnr='.$mission['misnr'],'get','','',$sailaway_authcookie); |
|
816 | + $racebuffer = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/GetMission.pl?misnr='.$mission['misnr'], 'get', '', '', $sailaway_authcookie); |
|
817 | 817 | sleep(30); |
818 | 818 | } else $racebuffer = ''; |
819 | 819 | $bufferm = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/GetLeaderboard.pl?misnr='.$mission['misnr']); |
@@ -822,19 +822,19 @@ discard block |
||
822 | 822 | $racebuffer = ''; |
823 | 823 | } |
824 | 824 | if ($racebuffer != '') { |
825 | - $race_data = json_decode($racebuffer,true); |
|
825 | + $race_data = json_decode($racebuffer, true); |
|
826 | 826 | //print_r($race_data); |
827 | 827 | unset($racebuffer); |
828 | 828 | if (isset($race_data['mission'])) { |
829 | 829 | $datar = array(); |
830 | 830 | $datar['id'] = $mission['misnr']; |
831 | 831 | $datar['desc'] = $race_data['mission']['misdescr']; |
832 | - $datar['creator'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',$Common->remove_accents($race_data['mission']['usrname']))); |
|
833 | - $datar['name'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',$Common->remove_accents($race_data['mission']['mistitle']))); |
|
832 | + $datar['creator'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $Common->remove_accents($race_data['mission']['usrname']))); |
|
833 | + $datar['name'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $Common->remove_accents($race_data['mission']['mistitle']))); |
|
834 | 834 | $datar['startdate'] = $race_data['mission']['misstartdatetime']; |
835 | 835 | $markers = array(); |
836 | 836 | foreach ($race_data['mission']['course'] as $course) { |
837 | - $markers[] = array('lat' => $course['miclat'],'lon' => $course['miclon'],'name' => $course['micname'],'type' => $course['mictype']); |
|
837 | + $markers[] = array('lat' => $course['miclat'], 'lon' => $course['miclon'], 'name' => $course['micname'], 'type' => $course['mictype']); |
|
838 | 838 | } |
839 | 839 | $datar['markers'] = json_encode($markers); |
840 | 840 | //print_r($datar); |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | } |
843 | 843 | } |
844 | 844 | if ($bufferm != '') { |
845 | - $mission_data = json_decode($bufferm,true); |
|
845 | + $mission_data = json_decode($bufferm, true); |
|
846 | 846 | unset($bufferm); |
847 | 847 | if (isset($mission_data['leaderboard'][0]['results'])) { |
848 | 848 | foreach ($mission_data['leaderboard'][0]['results'] as $sail) { |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | //$data['id'] = $sail['misnr'].'-'.$sail['usrnr'].'-'.$sail['ubtnr']; |
856 | 856 | $data['id'] = $sail['misnr'].'-'.$sail['usrnr']; |
857 | 857 | $data['datetime'] = date('Y-m-d H:i:s'); |
858 | - $data['race_begin'] = date('Y-m-d H:i:s',strtotime($mission_data['leaderboard'][0]['misstart'])); |
|
858 | + $data['race_begin'] = date('Y-m-d H:i:s', strtotime($mission_data['leaderboard'][0]['misstart'])); |
|
859 | 859 | $data['last_update'] = date('Y-m-d H:i:s'); |
860 | 860 | $data['status'] = $sail['status']; |
861 | 861 | $data['type'] = $sail['btptype']; |
@@ -866,16 +866,16 @@ discard block |
||
866 | 866 | $data['longitude'] = $pos['longitude']; |
867 | 867 | } |
868 | 868 | if ($sail['status'] == 'Racing' && $sail['resultdescr'] != '-') { |
869 | - $resultdescr = explode(',',$sail['resultdescr']); |
|
869 | + $resultdescr = explode(',', $sail['resultdescr']); |
|
870 | 870 | if (count($resultdescr) > 2) { |
871 | - $data['speed'] = round(str_replace(array('Spd: ','kn.'),'',trim($resultdescr[2]))*1.852,2); |
|
872 | - $data['heading'] = str_replace(array('Hdg: ','°'),'',trim($resultdescr[1])); |
|
871 | + $data['speed'] = round(str_replace(array('Spd: ', 'kn.'), '', trim($resultdescr[2]))*1.852, 2); |
|
872 | + $data['heading'] = str_replace(array('Hdg: ', '°'), '', trim($resultdescr[1])); |
|
873 | 873 | if (isset($resultdescr[3])) { |
874 | - $data['distance'] = round(str_replace('nm.','',trim(explode(' ',$resultdescr[3])[1]))*1.852,3); |
|
874 | + $data['distance'] = round(str_replace('nm.', '', trim(explode(' ', $resultdescr[3])[1]))*1.852, 3); |
|
875 | 875 | } |
876 | 876 | } |
877 | 877 | } |
878 | - $data['ident'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',$Common->remove_accents($sail['ubtname']))); |
|
878 | + $data['ident'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $Common->remove_accents($sail['ubtname']))); |
|
879 | 879 | $data['captain_id'] = $sail['usrnr']; |
880 | 880 | $data['captain_name'] = $sail['usrname']; |
881 | 881 | $data['race_id'] = $sail['misnr']; |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | if ($globalDebug) echo '! Download... '; |
931 | 931 | $buffer = $Common->getData('http://backend.sailaway.world/cgi-bin/sailaway/TrackAllBoats.pl?key='.$globalSailaway['key']); |
932 | 932 | if ($buffer != '') { |
933 | - $data = json_decode($buffer,true); |
|
933 | + $data = json_decode($buffer, true); |
|
934 | 934 | //print_r($race_data); |
935 | 935 | if (isset($data['boats'])) { |
936 | 936 | foreach ($data['boats'] as $sail) { |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | $data['longitude'] = $sail['ubtlon']; |
943 | 943 | $data['type_id'] = 36; |
944 | 944 | $data['heading'] = $sail['ubtheading']; |
945 | - $data['ident'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',$Common->remove_accents($sail['ubtname']))); |
|
945 | + $data['ident'] = trim(preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $Common->remove_accents($sail['ubtname']))); |
|
946 | 946 | $data['captain_name'] = $sail['usrname']; |
947 | 947 | $data['format_source'] = 'sailaway'; |
948 | 948 | $data['id_source'] = $id_source; |
@@ -971,8 +971,8 @@ discard block |
||
971 | 971 | ) { |
972 | 972 | //$buffer = $Common->getData($hosts[$id]); |
973 | 973 | $buffer = $Common->getData($value['host']); |
974 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
975 | - $buffer = explode('\n',$buffer); |
|
974 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
975 | + $buffer = explode('\n', $buffer); |
|
976 | 976 | $reset = 0; |
977 | 977 | foreach ($buffer as $line) { |
978 | 978 | if ($line != '') { |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
984 | 984 | $data['pilot_id'] = $line[1]; |
985 | 985 | $data['pilot_name'] = $line[2]; |
986 | - $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
|
986 | + $data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT); |
|
987 | 987 | $data['ident'] = $line[0]; // ident |
988 | 988 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
989 | 989 | $data['speed'] = $line[8]; // speed |
@@ -999,7 +999,7 @@ discard block |
||
999 | 999 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
1000 | 1000 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
1001 | 1001 | $data['departure_airport_icao'] = $line[11]; |
1002 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
1002 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); |
|
1003 | 1003 | $data['arrival_airport_icao'] = $line[13]; |
1004 | 1004 | $data['frequency'] = $line[4]; |
1005 | 1005 | $data['type'] = $line[18]; |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | $data['id_source'] = $id_source; |
1009 | 1009 | //$data['arrival_airport_time'] = ; |
1010 | 1010 | if ($line[9] != '') { |
1011 | - $aircraft_data = explode('/',$line[9]); |
|
1011 | + $aircraft_data = explode('/', $line[9]); |
|
1012 | 1012 | if (isset($aircraft_data[1])) { |
1013 | 1013 | $data['aircraft_icao'] = $aircraft_data[1]; |
1014 | 1014 | } |
@@ -1023,9 +1023,9 @@ discard block |
||
1023 | 1023 | if ($line[3] === 'PILOT') $SI->add($data); |
1024 | 1024 | elseif ($line[3] === 'ATC') { |
1025 | 1025 | //print_r($data); |
1026 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
1027 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
1028 | - $typec = substr($data['ident'],-3); |
|
1026 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
1027 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
1028 | + $typec = substr($data['ident'], -3); |
|
1029 | 1029 | if ($typec === 'APP') $data['type'] = 'Approach'; |
1030 | 1030 | elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
1031 | 1031 | elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
@@ -1037,8 +1037,8 @@ discard block |
||
1037 | 1037 | elseif ($data['type'] === '') $data['type'] = 'Observer'; |
1038 | 1038 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
1039 | 1039 | if (isset($ATC)) { |
1040 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
1041 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
1040 | + if (count($ATC->getByIdent($data['ident'], $data['format_source'])) > 0) echo $ATC->update($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
1041 | + else echo $ATC->add($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
1042 | 1042 | } |
1043 | 1043 | } |
1044 | 1044 | unset($data); |
@@ -1054,24 +1054,24 @@ discard block |
||
1054 | 1054 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
1055 | 1055 | ) |
1056 | 1056 | ) { |
1057 | - $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
1057 | + $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php', 'get', '', '', '', '', '20'); |
|
1058 | 1058 | if ($buffer != '') { |
1059 | 1059 | $all_data = simplexml_load_string($buffer); |
1060 | - foreach($all_data->children() as $childdata) { |
|
1060 | + foreach ($all_data->children() as $childdata) { |
|
1061 | 1061 | $data = array(); |
1062 | 1062 | $line = $childdata; |
1063 | 1063 | //$data['hex'] = str_pad(dechex((int)$line['pktPilotID']),6,'000000',STR_PAD_LEFT); |
1064 | - $data['id'] = date('Ymd').(int)$line['pktPilotID']; |
|
1065 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
|
1066 | - $data['latitude'] = (float)$line['pktLatitude']; |
|
1067 | - $data['longitude'] = (float)$line['pktLongitude']; |
|
1068 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
1069 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
1070 | - $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
|
1064 | + $data['id'] = date('Ymd').(int) $line['pktPilotID']; |
|
1065 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['entryTime'].' BST')); |
|
1066 | + $data['latitude'] = (float) $line['pktLatitude']; |
|
1067 | + $data['longitude'] = (float) $line['pktLongitude']; |
|
1068 | + if ((float) $line['pktTrack'] != 0) $data['heading'] = (float) $line['pktTrack']; |
|
1069 | + if ((int) $line['pktSpeed'] != 0) $data['speed'] = (int) $line['pktSpeed']; |
|
1070 | + $data['altitude'] = round((int) $line['pktAltitude']*3.28084); |
|
1071 | 1071 | $data['altitude_relative'] = 'AMSL'; |
1072 | - $data['pilot_id'] = (int)$line['pktPilotID']; |
|
1072 | + $data['pilot_id'] = (int) $line['pktPilotID']; |
|
1073 | 1073 | $data['aircraft_icao'] = 'PARAGLIDER'; |
1074 | - $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
1074 | + $pilot_data = explode(',', $Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
1075 | 1075 | if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
1076 | 1076 | $data['format_source'] = $value['format']; |
1077 | 1077 | $SI->add($data); |
@@ -1079,22 +1079,22 @@ discard block |
||
1079 | 1079 | } |
1080 | 1080 | } |
1081 | 1081 | $Source->deleteOldLocationByType('gs'); |
1082 | - $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
1082 | + $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php', 'get', '', '', '', '', '20'); |
|
1083 | 1083 | if ($buffer != '') { |
1084 | 1084 | $all_data = simplexml_load_string($buffer); |
1085 | - foreach($all_data->children() as $childdata) { |
|
1085 | + foreach ($all_data->children() as $childdata) { |
|
1086 | 1086 | $data = array(); |
1087 | 1087 | $line = $childdata; |
1088 | - $data['id'] = (int)$line['gsID']; |
|
1089 | - $data['latitude'] = (float)$line['gsLatitude']; |
|
1090 | - $data['longitude'] = (float)$line['gsLongitude']; |
|
1091 | - $data['altitude'] = round((int)$line['gsHeight']*3.28084); |
|
1088 | + $data['id'] = (int) $line['gsID']; |
|
1089 | + $data['latitude'] = (float) $line['gsLatitude']; |
|
1090 | + $data['longitude'] = (float) $line['gsLongitude']; |
|
1091 | + $data['altitude'] = round((int) $line['gsHeight']*3.28084); |
|
1092 | 1092 | $data['altitude_relative'] = 'AMSL'; |
1093 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['gsLastUpdate'].' BST')); |
|
1093 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['gsLastUpdate'].' BST')); |
|
1094 | 1094 | if (count($Source->getLocationInfoByLocationID($data['id'])) > 0) { |
1095 | - $Source->updateLocationByLocationID('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
1095 | + $Source->updateLocationByLocationID('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
1096 | 1096 | } else { |
1097 | - $Source->addLocation('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
1097 | + $Source->addLocation('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
1098 | 1098 | } |
1099 | 1099 | unset($data); |
1100 | 1100 | } |
@@ -1112,9 +1112,9 @@ discard block |
||
1112 | 1112 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
1113 | 1113 | ) |
1114 | 1114 | ) { |
1115 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
1115 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
1116 | 1116 | if ($buffer != '') { |
1117 | - $all_data = json_decode($buffer,true); |
|
1117 | + $all_data = json_decode($buffer, true); |
|
1118 | 1118 | if (isset($all_data['acList'])) { |
1119 | 1119 | $reset = 0; |
1120 | 1120 | foreach ($all_data['acList'] as $line) { |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
1131 | 1131 | $data['emergency'] = ''; // emergency |
1132 | 1132 | if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
1133 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
1133 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
1134 | 1134 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1135 | 1135 | //$data['datetime'] = date('Y-m-d H:i:s'); |
1136 | 1136 | if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | $data['verticalrate'] = $line['vrt']; // verticale rate |
1156 | 1156 | $data['squawk'] = $line['squawk']; // squawk |
1157 | 1157 | $data['emergency'] = ''; // emergency |
1158 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
1158 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
1159 | 1159 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1160 | 1160 | $data['format_source'] = 'aircraftlistjson'; |
1161 | 1161 | $data['id_source'] = $id_source; |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | ) |
1177 | 1177 | ) { |
1178 | 1178 | $buffer = $Common->getData($value['host']); |
1179 | - $all_data = json_decode($buffer,true); |
|
1179 | + $all_data = json_decode($buffer, true); |
|
1180 | 1180 | if (isset($all_data['planes'])) { |
1181 | 1181 | $reset = 0; |
1182 | 1182 | foreach ($all_data['planes'] as $key => $line) { |
@@ -1193,12 +1193,12 @@ discard block |
||
1193 | 1193 | $data['emergency'] = ''; // emergency |
1194 | 1194 | $data['registration'] = $line[2]; |
1195 | 1195 | $data['aircraft_icao'] = $line[0]; |
1196 | - $deparr = explode('-',$line[1]); |
|
1196 | + $deparr = explode('-', $line[1]); |
|
1197 | 1197 | if (count($deparr) === 2) { |
1198 | 1198 | $data['departure_airport_icao'] = $deparr[0]; |
1199 | 1199 | $data['arrival_airport_icao'] = $deparr[1]; |
1200 | 1200 | } |
1201 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
1201 | + $data['datetime'] = date('Y-m-d H:i:s', $line[9]); |
|
1202 | 1202 | $data['format_source'] = 'planeupdatefaa'; |
1203 | 1203 | $data['id_source'] = $id_source; |
1204 | 1204 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | ) |
1217 | 1217 | ) { |
1218 | 1218 | $buffer = $Common->getData($value['host']); |
1219 | - $all_data = json_decode($buffer,true); |
|
1219 | + $all_data = json_decode($buffer, true); |
|
1220 | 1220 | if (isset($all_data['states'])) { |
1221 | 1221 | $reset = 0; |
1222 | 1222 | foreach ($all_data['states'] as $key => $line) { |
@@ -1233,7 +1233,7 @@ discard block |
||
1233 | 1233 | //$data['emergency'] = ''; // emergency |
1234 | 1234 | //$data['registration'] = $line[2]; |
1235 | 1235 | //$data['aircraft_icao'] = $line[0]; |
1236 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
1236 | + $data['datetime'] = date('Y-m-d H:i:s', $line[3]); |
|
1237 | 1237 | $data['format_source'] = 'opensky'; |
1238 | 1238 | $data['id_source'] = $id_source; |
1239 | 1239 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1250,8 +1250,8 @@ discard block |
||
1250 | 1250 | ) |
1251 | 1251 | ) { |
1252 | 1252 | $buffer = $Common->getData($value['host']); |
1253 | - $all_data = json_decode($buffer,true); |
|
1254 | - if (isset($all_data['aircraft']) && isset($all_data['now']) && $all_data['now'] > time()-1800) { |
|
1253 | + $all_data = json_decode($buffer, true); |
|
1254 | + if (isset($all_data['aircraft']) && isset($all_data['now']) && $all_data['now'] > time() - 1800) { |
|
1255 | 1255 | $reset = 0; |
1256 | 1256 | foreach ($all_data['aircraft'] as $key => $line) { |
1257 | 1257 | $data = array(); |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | ) |
1290 | 1290 | ) { |
1291 | 1291 | $buffer = $Common->getData($value['host']); |
1292 | - $all_data = json_decode($buffer,true); |
|
1292 | + $all_data = json_decode($buffer, true); |
|
1293 | 1293 | if (isset($all_data['aircraft'])) { |
1294 | 1294 | $reset = 0; |
1295 | 1295 | foreach ($all_data['aircraft'] as $key => $line) { |
@@ -1306,7 +1306,7 @@ discard block |
||
1306 | 1306 | //$data['emergency'] = ''; // emergency |
1307 | 1307 | if (isset($line['reg'])) $data['registration'] = $line['reg']; |
1308 | 1308 | if (isset($line['type'])) $data['aircraft_icao'] = $line['type']; |
1309 | - $data['datetime'] = date('Y-m-d H:i:s',$line['pos_update_time']); |
|
1309 | + $data['datetime'] = date('Y-m-d H:i:s', $line['pos_update_time']); |
|
1310 | 1310 | $data['format_source'] = 'planefinderclient'; |
1311 | 1311 | $data['id_source'] = $id_source; |
1312 | 1312 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | ) { |
1326 | 1326 | //$buffer = $Common->getData($hosts[$id]); |
1327 | 1327 | $buffer = $Common->getData($value['host']); |
1328 | - $all_data = json_decode($buffer,true); |
|
1328 | + $all_data = json_decode($buffer, true); |
|
1329 | 1329 | if (!empty($all_data)) $reset = 0; |
1330 | 1330 | foreach ($all_data as $key => $line) { |
1331 | 1331 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
@@ -1363,11 +1363,11 @@ discard block |
||
1363 | 1363 | ) |
1364 | 1364 | ) { |
1365 | 1365 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
1366 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
1366 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); |
|
1367 | 1367 | //echo $buffer; |
1368 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
1369 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
1370 | - $all_data = json_decode($buffer,true); |
|
1368 | + $buffer = str_replace(array("\n", "\r"), "", $buffer); |
|
1369 | + $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); |
|
1370 | + $all_data = json_decode($buffer, true); |
|
1371 | 1371 | if (json_last_error() != JSON_ERROR_NONE) { |
1372 | 1372 | die(json_last_error_msg()); |
1373 | 1373 | } |
@@ -1390,7 +1390,7 @@ discard block |
||
1390 | 1390 | //$data['departure_airport_iata'] = $line[11]; |
1391 | 1391 | //$data['arrival_airport_iata'] = $line[12]; |
1392 | 1392 | //$data['emergency'] = ''; // emergency |
1393 | - $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
|
1393 | + $data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] |
|
1394 | 1394 | $data['format_source'] = 'radarvirtueljson'; |
1395 | 1395 | $data['id_source'] = $id_source; |
1396 | 1396 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1411,14 +1411,14 @@ discard block |
||
1411 | 1411 | ) { |
1412 | 1412 | //$buffer = $Common->getData($hosts[$id]); |
1413 | 1413 | $buffer = $Common->getData($value['host'].'?'.time()); |
1414 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
1414 | + $all_data = json_decode(utf8_encode($buffer), true); |
|
1415 | 1415 | |
1416 | 1416 | if (isset($all_data['pireps'])) { |
1417 | 1417 | $reset = 0; |
1418 | 1418 | foreach ($all_data['pireps'] as $line) { |
1419 | 1419 | $data = array(); |
1420 | 1420 | $data['id'] = $line['id']; |
1421 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
1421 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1422 | 1422 | $data['ident'] = $line['callsign']; // ident |
1423 | 1423 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
1424 | 1424 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
@@ -1448,9 +1448,9 @@ discard block |
||
1448 | 1448 | $SI->add($data); |
1449 | 1449 | // print_r($data); |
1450 | 1450 | } elseif ($line['icon'] === 'ct') { |
1451 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
1452 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
1453 | - $typec = substr($data['ident'],-3); |
|
1451 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
1452 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
1453 | + $typec = substr($data['ident'], -3); |
|
1454 | 1454 | $data['type'] = ''; |
1455 | 1455 | if ($typec === 'APP') $data['type'] = 'Approach'; |
1456 | 1456 | elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
1462 | 1462 | elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
1463 | 1463 | else $data['type'] = 'Observer'; |
1464 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
1464 | + if (isset($ATC)) echo $ATC->add($data['ident'], '', $data['latitude'], $data['longitude'], '0', $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source']); |
|
1465 | 1465 | } |
1466 | 1466 | unset($data); |
1467 | 1467 | } |
@@ -1478,14 +1478,14 @@ discard block |
||
1478 | 1478 | //$buffer = $Common->getData($hosts[$id]); |
1479 | 1479 | if ($globalDebug) echo 'Get Data...'."\n"; |
1480 | 1480 | $buffer = $Common->getData($value['host']); |
1481 | - $all_data = json_decode($buffer,true); |
|
1481 | + $all_data = json_decode($buffer, true); |
|
1482 | 1482 | if ($buffer != '' && is_array($all_data)) { |
1483 | 1483 | $reset = 0; |
1484 | 1484 | foreach ($all_data as $line) { |
1485 | 1485 | $data = array(); |
1486 | 1486 | //$data['id'] = $line['id']; // id not usable |
1487 | 1487 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
1488 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1488 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1489 | 1489 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
1490 | 1490 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
1491 | 1491 | $data['ident'] = $line['flightnum']; // ident |
@@ -1500,7 +1500,7 @@ discard block |
||
1500 | 1500 | //$data['datetime'] = $line['lastupdate']; |
1501 | 1501 | //$data['last_update'] = $line['lastupdate']; |
1502 | 1502 | if (isset($value['timezone'])) { |
1503 | - $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
1503 | + $datetime = new DateTime($line['lastupdate'], new DateTimeZone($value['timezone'])); |
|
1504 | 1504 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
1505 | 1505 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1506 | 1506 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1516,14 +1516,14 @@ discard block |
||
1516 | 1516 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
1517 | 1517 | if (isset($line['aircraftname'])) { |
1518 | 1518 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
1519 | - $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
|
1520 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
1519 | + $line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); |
|
1520 | + $aircraft_data = explode('-', $line['aircraftname']); |
|
1521 | 1521 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
1522 | 1522 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
1523 | 1523 | else { |
1524 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
1525 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1526 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1524 | + $aircraft_data = explode(' ', $line['aircraftname']); |
|
1525 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]); |
|
1526 | + else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']); |
|
1527 | 1527 | } |
1528 | 1528 | } |
1529 | 1529 | if (isset($line['route'])) $data['waypoints'] = $line['route']; |
@@ -1548,7 +1548,7 @@ discard block |
||
1548 | 1548 | //$buffer = $Common->getData($hosts[$id]); |
1549 | 1549 | if ($globalDebug) echo 'Get Data...'."\n"; |
1550 | 1550 | $buffer = $Common->getData($value['host']); |
1551 | - $all_data = json_decode($buffer,true); |
|
1551 | + $all_data = json_decode($buffer, true); |
|
1552 | 1552 | if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) { |
1553 | 1553 | $reset = 0; |
1554 | 1554 | foreach ($all_data['ACARSData'] as $line) { |
@@ -1559,7 +1559,7 @@ discard block |
||
1559 | 1559 | //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
1560 | 1560 | if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username']; |
1561 | 1561 | if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id']; |
1562 | - $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident |
|
1562 | + $data['ident'] = str_replace(' ', '', $line['bid']['flightnum']); // ident |
|
1563 | 1563 | if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
1564 | 1564 | $data['altitude'] = $line['altitude']; // altitude |
1565 | 1565 | $data['speed'] = $line['groundspeed']; // speed |
@@ -1570,7 +1570,7 @@ discard block |
||
1570 | 1570 | //$data['squawk'] = ''; // squawk |
1571 | 1571 | //$data['emergency'] = ''; // emergency |
1572 | 1572 | if (isset($value['timezone'])) { |
1573 | - $datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone'])); |
|
1573 | + $datetime = new DateTime($line['updated_at'], new DateTimeZone($value['timezone'])); |
|
1574 | 1574 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
1575 | 1575 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1576 | 1576 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1606,14 +1606,14 @@ discard block |
||
1606 | 1606 | //$buffer = $Common->getData($hosts[$id]); |
1607 | 1607 | if ($globalDebug) echo 'Get Data...'."\n"; |
1608 | 1608 | $buffer = $Common->getData($value['host']); |
1609 | - $all_data = json_decode($buffer,true); |
|
1609 | + $all_data = json_decode($buffer, true); |
|
1610 | 1610 | if ($buffer != '' && is_array($all_data)) { |
1611 | 1611 | $reset = 0; |
1612 | 1612 | foreach ($all_data as $line) { |
1613 | 1613 | $data = array(); |
1614 | 1614 | //$data['id'] = $line['id']; // id not usable |
1615 | 1615 | $data['id'] = trim($line['flight_id']); |
1616 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1616 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1617 | 1617 | $data['pilot_name'] = $line['pilot_name']; |
1618 | 1618 | $data['pilot_id'] = $line['pilot_id']; |
1619 | 1619 | $data['ident'] = trim($line['callsign']); // ident |
@@ -1657,24 +1657,24 @@ discard block |
||
1657 | 1657 | //$buffer = $Common->getData($hosts[$id]); |
1658 | 1658 | if ($globalDebug) echo 'Get Data...'."\n"; |
1659 | 1659 | $buffer = $Common->getData($value['host']); |
1660 | - $all_data = json_decode($buffer,true); |
|
1660 | + $all_data = json_decode($buffer, true); |
|
1661 | 1661 | if ($buffer != '') { |
1662 | 1662 | $Source->deleteLocationBySource('blitzortung'); |
1663 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
1664 | - $buffer = explode('\n',$buffer); |
|
1663 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
1664 | + $buffer = explode('\n', $buffer); |
|
1665 | 1665 | foreach ($buffer as $buffer_line) { |
1666 | - $line = json_decode($buffer_line,true); |
|
1666 | + $line = json_decode($buffer_line, true); |
|
1667 | 1667 | if (isset($line['time'])) { |
1668 | 1668 | $data = array(); |
1669 | 1669 | $data['altitude'] = $line['alt']; // altitude |
1670 | 1670 | $data['latitude'] = $line['lat']; // lat |
1671 | 1671 | $data['longitude'] = $line['lon']; // long |
1672 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line['time'],0,10)); |
|
1672 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line['time'], 0, 10)); |
|
1673 | 1673 | $data['id_source'] = $id_source; |
1674 | 1674 | $data['format_source'] = 'blitzortung'; |
1675 | 1675 | $SI->add($data); |
1676 | 1676 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
1677 | - $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
|
1677 | + $Source->addLocation('', $data['latitude'], $data['longitude'], 0, '', '', 'blitzortung', 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime']); |
|
1678 | 1678 | unset($data); |
1679 | 1679 | } |
1680 | 1680 | } |
@@ -1686,15 +1686,15 @@ discard block |
||
1686 | 1686 | $arr = $httpfeeds; |
1687 | 1687 | $w = $e = null; |
1688 | 1688 | if (isset($arr[$id])) { |
1689 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
1689 | + $nn = stream_select($arr, $w, $e, $timeout); |
|
1690 | 1690 | if ($nn > 0) { |
1691 | 1691 | foreach ($httpfeeds as $feed) { |
1692 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
1692 | + $buffer = stream_get_line($feed, 2000, "\n"); |
|
1693 | 1693 | if ($buffer === FALSE) { |
1694 | 1694 | connect_all($globalSources); |
1695 | 1695 | } |
1696 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
1697 | - $buffer = explode('\n',$buffer); |
|
1696 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
1697 | + $buffer = explode('\n', $buffer); |
|
1698 | 1698 | foreach ($buffer as $line) { |
1699 | 1699 | if ($line != '') { |
1700 | 1700 | $line = json_decode($line, true); |
@@ -1734,11 +1734,11 @@ discard block |
||
1734 | 1734 | //$value = $formats[$nb]; |
1735 | 1735 | $format = $globalSources[$nb]['format']; |
1736 | 1736 | if ($format === 'sbs' || $format === 'aprs' || $format === 'famaprs' || $format === 'raw' || $format === 'tsv' || $format === 'acarssbs3') { |
1737 | - $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); |
|
1737 | + $buffer = @socket_read($r, 6000, PHP_NORMAL_READ); |
|
1738 | 1738 | } elseif ($format === 'vrstcp') { |
1739 | 1739 | $buffer = @socket_read($r, 6000); |
1740 | 1740 | } else { |
1741 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
1741 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); |
|
1742 | 1742 | } |
1743 | 1743 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
1744 | 1744 | //echo $buffer."\n"; |
@@ -1748,8 +1748,8 @@ discard block |
||
1748 | 1748 | //$SI::del(); |
1749 | 1749 | if ($buffer !== FALSE) { |
1750 | 1750 | if ($format === 'vrstcp') { |
1751 | - $buffer = explode('},{',$buffer); |
|
1752 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1751 | + $buffer = explode('},{', $buffer); |
|
1752 | + } else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); |
|
1753 | 1753 | } |
1754 | 1754 | // SBS format is CSV format |
1755 | 1755 | if ($buffer !== FALSE && $buffer !== '') { |
@@ -1776,7 +1776,7 @@ discard block |
||
1776 | 1776 | $ais_data = $AIS->parse_line(trim($buffer)); |
1777 | 1777 | $data = array(); |
1778 | 1778 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
1779 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
1779 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
1780 | 1780 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
1781 | 1781 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
1782 | 1782 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -1787,13 +1787,13 @@ discard block |
||
1787 | 1787 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
1788 | 1788 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
1789 | 1789 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
1790 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1790 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
1791 | 1791 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1792 | 1792 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
1793 | 1793 | if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
1794 | 1794 | |
1795 | 1795 | if (isset($ais_data['timestamp'])) { |
1796 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
1796 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
1797 | 1797 | } else { |
1798 | 1798 | $data['datetime'] = date('Y-m-d H:i:s'); |
1799 | 1799 | } |
@@ -1804,10 +1804,10 @@ discard block |
||
1804 | 1804 | } elseif ($format === 'flightgearsp') { |
1805 | 1805 | //echo $buffer."\n"; |
1806 | 1806 | if (strlen($buffer) > 5) { |
1807 | - $line = explode(',',$buffer); |
|
1807 | + $line = explode(',', $buffer); |
|
1808 | 1808 | $data = array(); |
1809 | 1809 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
1810 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); |
|
1810 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1811 | 1811 | $data['ident'] = $line[6]; |
1812 | 1812 | $data['aircraft_name'] = $line[7]; |
1813 | 1813 | $data['longitude'] = $line[1]; |
@@ -1824,25 +1824,25 @@ discard block |
||
1824 | 1824 | } elseif ($format === 'acars') { |
1825 | 1825 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
1826 | 1826 | $ACARS->add(trim($buffer)); |
1827 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
1827 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
1828 | 1828 | $ACARS->deleteLiveAcarsData(); |
1829 | 1829 | } elseif ($format === 'acarsjsonudp') { |
1830 | 1830 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
1831 | 1831 | $line = json_decode(trim($buffer), true); |
1832 | 1832 | if (!empty($line)) { |
1833 | - $line = array_merge(array('text' => '','tail' => '','label' => '','block_id' => '','flight' => '','msgno' => ''),$line); |
|
1833 | + $line = array_merge(array('text' => '', 'tail' => '', 'label' => '', 'block_id' => '', 'flight' => '', 'msgno' => ''), $line); |
|
1834 | 1834 | $ACARS->add(isset($line['text']) ? $line['text'] : '', array('registration' => str_replace('.', '', $line['tail']), 'ident' => $line['flight'], 'label' => $line['label'], 'block_id' => $line['block_id'], 'msg_no' => $line['msgno'], 'message' => (isset($line['text']) ? $line['text'] : ''))); |
1835 | 1835 | $ACARS->deleteLiveAcarsData(); |
1836 | 1836 | } |
1837 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
1837 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
1838 | 1838 | } elseif ($format === 'flightgearmp') { |
1839 | - if (substr($buffer,0,1) != '#') { |
|
1839 | + if (substr($buffer, 0, 1) != '#') { |
|
1840 | 1840 | $data = array(); |
1841 | 1841 | //echo $buffer."\n"; |
1842 | - $line = explode(' ',$buffer); |
|
1842 | + $line = explode(' ', $buffer); |
|
1843 | 1843 | if (count($line) === 11) { |
1844 | - $userserver = explode('@',$line[0]); |
|
1845 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
1844 | + $userserver = explode('@', $line[0]); |
|
1845 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex |
|
1846 | 1846 | $data['ident'] = $userserver[0]; |
1847 | 1847 | $data['registration'] = $userserver[0]; |
1848 | 1848 | $data['latitude'] = $line[4]; |
@@ -1850,8 +1850,8 @@ discard block |
||
1850 | 1850 | $data['altitude'] = $line[6]; |
1851 | 1851 | $data['datetime'] = date('Y-m-d H:i:s'); |
1852 | 1852 | $aircraft_type = $line[10]; |
1853 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
1854 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
1853 | + $aircraft_type = preg_split(':/:', $aircraft_type); |
|
1854 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); |
|
1855 | 1855 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1856 | 1856 | if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
1857 | 1857 | } |
@@ -1860,8 +1860,8 @@ discard block |
||
1860 | 1860 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
1861 | 1861 | die; |
1862 | 1862 | } elseif ($format === 'vrstcp') { |
1863 | - foreach($buffer as $all_data) { |
|
1864 | - $line = json_decode('{'.$all_data.'}',true); |
|
1863 | + foreach ($buffer as $all_data) { |
|
1864 | + $line = json_decode('{'.$all_data.'}', true); |
|
1865 | 1865 | $data = array(); |
1866 | 1866 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
1867 | 1867 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
@@ -1887,16 +1887,16 @@ discard block |
||
1887 | 1887 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
1888 | 1888 | unset($data); |
1889 | 1889 | } |
1890 | - } elseif ($format === 'tsv' || substr($buffer,0,4) === 'clock') { |
|
1890 | + } elseif ($format === 'tsv' || substr($buffer, 0, 4) === 'clock') { |
|
1891 | 1891 | $line = explode("\t", $buffer); |
1892 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
1892 | + for ($k = 0; $k < count($line); $k = $k + 2) { |
|
1893 | 1893 | $key = $line[$k]; |
1894 | - $lined[$key] = $line[$k+1]; |
|
1894 | + $lined[$key] = $line[$k + 1]; |
|
1895 | 1895 | } |
1896 | 1896 | if (count($lined) > 3) { |
1897 | 1897 | $data['hex'] = $lined['hexid']; |
1898 | 1898 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
1899 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
1899 | + $data['datetime'] = date('Y-m-d H:i:s'); ; |
|
1900 | 1900 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
1901 | 1901 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
1902 | 1902 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
@@ -1915,23 +1915,23 @@ discard block |
||
1915 | 1915 | } else $error = true; |
1916 | 1916 | } elseif ($format === 'aprs' && $use_aprs) { |
1917 | 1917 | if ($aprs_connect === 0) { |
1918 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
|
1918 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); |
|
1919 | 1919 | $aprs_connect = 1; |
1920 | 1920 | } |
1921 | 1921 | |
1922 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
1922 | + if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { |
|
1923 | 1923 | $aprs_last_tx = time(); |
1924 | 1924 | $data_aprs = "# Keep alive"; |
1925 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
1925 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
1926 | 1926 | } |
1927 | 1927 | |
1928 | 1928 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
1929 | 1929 | //echo 'APRS data : '.$buffer."\n"; |
1930 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
1931 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
1930 | + $buffer = str_replace('APRS <- ', '', $buffer); |
|
1931 | + $buffer = str_replace('APRS -> ', '', $buffer); |
|
1932 | 1932 | //echo $buffer."\n"; |
1933 | 1933 | date_default_timezone_set('UTC'); |
1934 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
1934 | + if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { |
|
1935 | 1935 | $line = $APRS->parse($buffer); |
1936 | 1936 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
1937 | 1937 | if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) { |
@@ -1946,7 +1946,7 @@ discard block |
||
1946 | 1946 | if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date']; |
1947 | 1947 | if (isset($line['typeid'])) $data['type_id'] = $line['typeid']; |
1948 | 1948 | if (isset($line['statusid'])) $data['status_id'] = $line['statusid']; |
1949 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1949 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); |
|
1950 | 1950 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1951 | 1951 | //$data['datetime'] = date('Y-m-d H:i:s'); |
1952 | 1952 | if (isset($line['ident'])) $data['ident'] = $line['ident']; |
@@ -2034,29 +2034,29 @@ discard block |
||
2034 | 2034 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
2035 | 2035 | if (!isset($data['altitude'])) $data['altitude'] = 0; |
2036 | 2036 | $Source->deleteOldLocationByType('gs'); |
2037 | - if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
|
2038 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
2037 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'gs')) > 0) { |
|
2038 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
2039 | 2039 | } else { |
2040 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
2040 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
2041 | 2041 | } |
2042 | 2042 | } elseif (isset($line['symbol']) && $line['symbol'] === 'Weather Station') { |
2043 | 2043 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
2044 | 2044 | if ($globalDebug) echo '# Weather Station added'."\n"; |
2045 | 2045 | $Source->deleteOldLocationByType('wx'); |
2046 | 2046 | $weather_data = json_encode($line); |
2047 | - if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
|
2048 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
|
2047 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'wx')) > 0) { |
|
2048 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); |
|
2049 | 2049 | } else { |
2050 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
|
2050 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); |
|
2051 | 2051 | } |
2052 | 2052 | } elseif (isset($line['symbol']) && ($line['symbol'] === 'Lightning' || $line['symbol'] === 'Thunderstorm')) { |
2053 | 2053 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
2054 | 2054 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
2055 | 2055 | $Source->deleteOldLocationByType('lightning'); |
2056 | - if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
|
2057 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
|
2056 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'lightning')) > 0) { |
|
2057 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); |
|
2058 | 2058 | } else { |
2059 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
|
2059 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); |
|
2060 | 2060 | } |
2061 | 2061 | } elseif ($globalDebug) { |
2062 | 2062 | echo '/!\ Not added: '.$buffer."\n"; |
@@ -2065,7 +2065,7 @@ discard block |
||
2065 | 2065 | unset($data); |
2066 | 2066 | } |
2067 | 2067 | elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
2068 | - $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
|
2068 | + $Source->updateLocationDescByName($line['ident'], $line['source'], $id, $line['comment']); |
|
2069 | 2069 | } |
2070 | 2070 | /* |
2071 | 2071 | elseif (is_array($line) && $globalDebug && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] === 'Car' || $line['symbol'] === 'Ambulance' || $line['symbol'] === 'Van' || $line['symbol'] === 'Truck' || $line['symbol'] === 'Truck (18 Wheeler)' || $line['symbol'] === 'Motorcycle')) { |
@@ -2074,7 +2074,7 @@ discard block |
||
2074 | 2074 | */ |
2075 | 2075 | //elseif ($line === false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
2076 | 2076 | elseif ($line === true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
2077 | - if (isset($Source) && isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
|
2077 | + if (isset($Source) && isset($globalSources[$nb]['last_weather_clean']) && time() - $globalSources[$nb]['last_weather_clean'] > 60*5) { |
|
2078 | 2078 | $Source->deleteOldLocationByType('lightning'); |
2079 | 2079 | $Source->deleteOldLocationByType('wx'); |
2080 | 2080 | $globalSources[$nb]['last_weather_clean'] = time(); |
@@ -2161,7 +2161,7 @@ discard block |
||
2161 | 2161 | connect_all($sourceee); |
2162 | 2162 | $sourceee = array(); |
2163 | 2163 | //connect_all($globalSources); |
2164 | - $tt[$format]=0; |
|
2164 | + $tt[$format] = 0; |
|
2165 | 2165 | break; |
2166 | 2166 | } |
2167 | 2167 | //else if ($globalDebug) echo "Trying again (".$tt[$format]."x) ".$format."..."; |
@@ -2171,14 +2171,14 @@ discard block |
||
2171 | 2171 | } else { |
2172 | 2172 | $error = socket_strerror(socket_last_error()); |
2173 | 2173 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
2174 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
2174 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; |
|
2175 | 2175 | if (isset($globalDebug)) echo "Restarting...\n"; |
2176 | 2176 | // Restart the script if possible |
2177 | 2177 | if (is_array($sockets)) { |
2178 | 2178 | if ($globalDebug) echo "Shutdown all sockets..."; |
2179 | 2179 | |
2180 | 2180 | foreach ($sockets as $sock) { |
2181 | - @socket_shutdown($sock,2); |
|
2181 | + @socket_shutdown($sock, 2); |
|
2182 | 2182 | @socket_close($sock); |
2183 | 2183 | } |
2184 | 2184 |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | require_once(dirname(__FILE__).'/class.create_db.php'); |
24 | 24 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
25 | 25 | require_once(dirname(__FILE__).'/class.settings.php'); |
26 | -$title="Install"; |
|
26 | +$title = "Install"; |
|
27 | 27 | require(dirname(__FILE__).'/../require/settings.php'); |
28 | 28 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
29 | 29 | require(dirname(__FILE__).'/header.php'); |
30 | 30 | |
31 | 31 | if (!isset($_SESSION['install']) && !isset($_SESSION['identified'])) { |
32 | - $password = filter_input(INPUT_POST,'password',FILTER_SANITIZE_STRING); |
|
32 | + $password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING); |
|
33 | 33 | if ($password == '') { |
34 | 34 | if ($globalInstalled === TRUE && (!isset($globalInstallPassword) || $globalInstallPassword == '')) { |
35 | 35 | print '<div class="alert alert-danger">You need to change $globalInstalled in settings.php to FALSE if you want to access setup again.</div>'; |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | if (!file_exists(dirname(__FILE__).'/../.htaccess')) { |
111 | 111 | $error[] = dirname(__FILE__).'/../.htaccess'." doesn't exist. The provided .htaccess must exist if you use Apache."; |
112 | 112 | } |
113 | - if(function_exists('apache_get_modules') ){ |
|
114 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
113 | + if (function_exists('apache_get_modules')) { |
|
114 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
115 | 115 | $error[] = "mod_rewrite is not available."; |
116 | 116 | } |
117 | 117 | /* |
@@ -130,22 +130,22 @@ discard block |
||
130 | 130 | $alllng = $Language->listLocaleDir(); |
131 | 131 | if (count($alllng) != count($availablelng)) { |
132 | 132 | $notavailable = array(); |
133 | - foreach($alllng as $lng) { |
|
133 | + foreach ($alllng as $lng) { |
|
134 | 134 | if (!isset($availablelng[$lng])) $notavailable[] = $lng; |
135 | 135 | } |
136 | - print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
136 | + print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ', $notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | print '<div class="alert alert-info">If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some tables can fail.</div>'; |
140 | 140 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
141 | 141 | if (function_exists('get_headers')) { |
142 | 142 | //$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"]))); |
143 | - $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"]))); |
|
144 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
143 | + $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"]))); |
|
144 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
145 | 145 | 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>'; |
146 | 146 | } else { |
147 | - $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"]))); |
|
148 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
147 | + $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"]))); |
|
148 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
149 | 149 | 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>'; |
150 | 150 | } |
151 | 151 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
234 | 234 | if (isset($_SERVER['REQUEST_URI'])) { |
235 | 235 | $URL = $_SERVER['REQUEST_URI']; |
236 | - $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
|
236 | + $globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL))); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | ?> |
@@ -583,13 +583,13 @@ discard block |
||
583 | 583 | ?> |
584 | 584 | <tr> |
585 | 585 | <?php |
586 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
586 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
587 | 587 | ?> |
588 | 588 | <td><input type="text" name="host[]" value="<?php print $source['host']; ?>" /></td> |
589 | 589 | <td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
590 | 590 | <?php |
591 | 591 | } else { |
592 | - $hostport = explode(':',$source['host']); |
|
592 | + $hostport = explode(':', $source['host']); |
|
593 | 593 | if (isset($hostport[1])) { |
594 | 594 | $host = $hostport[0]; |
595 | 595 | $port = $hostport[1]; |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | <select name="timezones[]"> |
645 | 645 | <?php |
646 | 646 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
647 | - foreach($timezonelist as $timezones){ |
|
647 | + foreach ($timezonelist as $timezones) { |
|
648 | 648 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
649 | 649 | print '<option selected>'.$timezones.'</option>'; |
650 | 650 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | <select name="timezones[]" id="timezones"> |
705 | 705 | <?php |
706 | 706 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
707 | - foreach($timezonelist as $timezones){ |
|
707 | + foreach ($timezonelist as $timezones) { |
|
708 | 708 | if ($timezones == 'UTC') { |
709 | 709 | print '<option selected>'.$timezones.'</option>'; |
710 | 710 | } else print '<option>'.$timezones.'</option>'; |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | <br /> |
1185 | 1185 | <p> |
1186 | 1186 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1187 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1187 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
1188 | 1188 | </p> |
1189 | 1189 | <br /> |
1190 | 1190 | <p> |
@@ -1267,17 +1267,17 @@ discard block |
||
1267 | 1267 | $error = ''; |
1268 | 1268 | |
1269 | 1269 | if (isset($_POST['dbtype'])) { |
1270 | - $installpass = filter_input(INPUT_POST,'installpass',FILTER_SANITIZE_STRING); |
|
1271 | - $settings = array_merge($settings,array('globalInstallPassword' => $installpass)); |
|
1270 | + $installpass = filter_input(INPUT_POST, 'installpass', FILTER_SANITIZE_STRING); |
|
1271 | + $settings = array_merge($settings, array('globalInstallPassword' => $installpass)); |
|
1272 | 1272 | |
1273 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
1274 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
1275 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
1276 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
1277 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
1278 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
1279 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
1280 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
1273 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
1274 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
1275 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
1276 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
1277 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
1278 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
1279 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
1280 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
1281 | 1281 | |
1282 | 1282 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
1283 | 1283 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -1297,60 +1297,60 @@ discard block |
||
1297 | 1297 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
1298 | 1298 | */ |
1299 | 1299 | |
1300 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
1300 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
1301 | 1301 | |
1302 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
1303 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
1304 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
1305 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
1306 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
1302 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
1303 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
1304 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
1305 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
1306 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
1307 | 1307 | |
1308 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
1309 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
1310 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
1311 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
1312 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
1313 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
1314 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
1315 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
1316 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
1317 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1308 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
1309 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
1310 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
1311 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
1312 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
1313 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
1314 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
1315 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
1316 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
1317 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1318 | 1318 | |
1319 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
1320 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
1321 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
1322 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
1323 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
1324 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
1319 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
1320 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
1321 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
1322 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
1323 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
1324 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
1325 | 1325 | |
1326 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
1327 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
1326 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
1327 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
1328 | 1328 | |
1329 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
1330 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
1331 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
1329 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
1330 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
1331 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
1332 | 1332 | |
1333 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
1333 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
1334 | 1334 | if ($acars == 'acars') { |
1335 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
1335 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
1336 | 1336 | } else { |
1337 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
1337 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1338 | 1338 | } |
1339 | - $updatecheck = filter_input(INPUT_POST,'updatecheck',FILTER_SANITIZE_STRING); |
|
1339 | + $updatecheck = filter_input(INPUT_POST, 'updatecheck', FILTER_SANITIZE_STRING); |
|
1340 | 1340 | if ($updatecheck == 'updatecheck') { |
1341 | - $settings = array_merge($settings,array('globalDisableUpdateCheck' => 'TRUE')); |
|
1341 | + $settings = array_merge($settings, array('globalDisableUpdateCheck' => 'TRUE')); |
|
1342 | 1342 | } else { |
1343 | - $settings = array_merge($settings,array('globalDisableUpdateCheck' => 'FALSE')); |
|
1343 | + $settings = array_merge($settings, array('globalDisableUpdateCheck' => 'FALSE')); |
|
1344 | 1344 | } |
1345 | 1345 | |
1346 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1347 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1348 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1346 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1347 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1348 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1349 | 1349 | |
1350 | - $sailawayemail = filter_input(INPUT_POST,'sailawayemail',FILTER_SANITIZE_STRING); |
|
1351 | - $sailawaypass = filter_input(INPUT_POST,'sailawaypassword',FILTER_SANITIZE_STRING); |
|
1352 | - $sailawaykey = filter_input(INPUT_POST,'sailawaykey',FILTER_SANITIZE_STRING); |
|
1353 | - $settings = array_merge($settings,array('globalSailaway' => array('email' => $sailawayemail,'password' => $sailawaypass,'key' => $sailawaykey))); |
|
1350 | + $sailawayemail = filter_input(INPUT_POST, 'sailawayemail', FILTER_SANITIZE_STRING); |
|
1351 | + $sailawaypass = filter_input(INPUT_POST, 'sailawaypassword', FILTER_SANITIZE_STRING); |
|
1352 | + $sailawaykey = filter_input(INPUT_POST, 'sailawaykey', FILTER_SANITIZE_STRING); |
|
1353 | + $settings = array_merge($settings, array('globalSailaway' => array('email' => $sailawayemail, 'password' => $sailawaypass, 'key' => $sailawaykey))); |
|
1354 | 1354 | |
1355 | 1355 | $source_name = $_POST['source_name']; |
1356 | 1356 | $source_latitude = $_POST['source_latitude']; |
@@ -1364,8 +1364,8 @@ discard block |
||
1364 | 1364 | |
1365 | 1365 | $sources = array(); |
1366 | 1366 | foreach ($source_name as $keys => $name) { |
1367 | - 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]); |
|
1368 | - 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]); |
|
1367 | + 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]); |
|
1368 | + 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]); |
|
1369 | 1369 | } |
1370 | 1370 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1371 | 1371 | |
@@ -1374,16 +1374,16 @@ discard block |
||
1374 | 1374 | $newstype = $_POST['newstype']; |
1375 | 1375 | |
1376 | 1376 | $newsfeeds = array(); |
1377 | - foreach($newsurl as $newskey => $url) { |
|
1377 | + foreach ($newsurl as $newskey => $url) { |
|
1378 | 1378 | if ($url != '') { |
1379 | 1379 | $type = $newstype[$newskey]; |
1380 | 1380 | $lng = $newslng[$newskey]; |
1381 | 1381 | if (isset($newsfeeds[$type][$lng])) { |
1382 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1382 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url)); |
|
1383 | 1383 | } else $newsfeeds[$type][$lng] = array($url); |
1384 | 1384 | } |
1385 | 1385 | } |
1386 | - $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
|
1386 | + $settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds)); |
|
1387 | 1387 | |
1388 | 1388 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
1389 | 1389 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1394,28 +1394,28 @@ discard block |
||
1394 | 1394 | $sbsurl = $_POST['sbsurl']; |
1395 | 1395 | */ |
1396 | 1396 | |
1397 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1398 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1399 | - $globalvm = filter_input(INPUT_POST,'globalvm',FILTER_SANITIZE_STRING); |
|
1400 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1401 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1402 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1403 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1404 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1405 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1397 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1398 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1399 | + $globalvm = filter_input(INPUT_POST, 'globalvm', FILTER_SANITIZE_STRING); |
|
1400 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1401 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1402 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1403 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1404 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1405 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1406 | 1406 | |
1407 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1408 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1409 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1410 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1411 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1412 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1413 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1414 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1415 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1416 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1417 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1418 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1407 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1408 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1409 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1410 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1411 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1412 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1413 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1414 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1415 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1416 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1417 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1418 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1419 | 1419 | |
1420 | 1420 | /* |
1421 | 1421 | $globalSBS1Hosts = array(); |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | } |
1432 | 1432 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1433 | 1433 | */ |
1434 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1434 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1435 | 1435 | $host = $_POST['host']; |
1436 | 1436 | $port = $_POST['port']; |
1437 | 1437 | $name = $_POST['name']; |
@@ -1448,115 +1448,115 @@ discard block |
||
1448 | 1448 | else $cov = 'FALSE'; |
1449 | 1449 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1450 | 1450 | else $arch = 'FALSE'; |
1451 | - if (strpos($format[$key],'_callback')) { |
|
1452 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1451 | + if (strpos($format[$key], '_callback')) { |
|
1452 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1453 | 1453 | } elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) { |
1454 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1454 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1455 | 1455 | } |
1456 | 1456 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1457 | 1457 | } |
1458 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1458 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1459 | 1459 | |
1460 | 1460 | /* |
1461 | 1461 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1462 | 1462 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1463 | 1463 | */ |
1464 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1465 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1466 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1464 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1465 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1466 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1467 | 1467 | |
1468 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1469 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1468 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1469 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1470 | 1470 | |
1471 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1472 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1471 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1472 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1473 | 1473 | |
1474 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
1475 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
1474 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
1475 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
1476 | 1476 | |
1477 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1478 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1479 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1480 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1477 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1478 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1479 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1480 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1481 | 1481 | |
1482 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1483 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1484 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1482 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1483 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1484 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1485 | 1485 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1486 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1487 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1486 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1487 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1488 | 1488 | |
1489 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1490 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1491 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1492 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1493 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1494 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1495 | - $minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT); |
|
1496 | - $settings = array_merge($settings,array('globalMinFetch' => $minfetch)); |
|
1497 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1498 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1489 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1490 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1491 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1492 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1493 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1494 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1495 | + $minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT); |
|
1496 | + $settings = array_merge($settings, array('globalMinFetch' => $minfetch)); |
|
1497 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1498 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1499 | 1499 | |
1500 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1501 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1500 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1501 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1502 | 1502 | |
1503 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1504 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1503 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1504 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1505 | 1505 | |
1506 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1506 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1507 | 1507 | if ($archiveyear == "archiveyear") { |
1508 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1508 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1509 | 1509 | } else { |
1510 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1510 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1511 | 1511 | } |
1512 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1513 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1514 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1515 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1512 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1513 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1514 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1515 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1516 | 1516 | |
1517 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1518 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1519 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1520 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1517 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1518 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1519 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1520 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1521 | 1521 | |
1522 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1523 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1524 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1522 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1523 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1524 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1525 | 1525 | |
1526 | 1526 | // Create in settings.php keys not yet configurable if not already here |
1527 | 1527 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1528 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1528 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1529 | 1529 | |
1530 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1530 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1531 | 1531 | if ($resetyearstats == 'resetyearstats') { |
1532 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1532 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1533 | 1533 | } else { |
1534 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1534 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1535 | 1535 | } |
1536 | 1536 | |
1537 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1537 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1538 | 1538 | if ($archive == 'archive') { |
1539 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1539 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1540 | 1540 | } else { |
1541 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1541 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1542 | 1542 | } |
1543 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
1543 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
1544 | 1544 | if ($archiveresults == 'archiveresults') { |
1545 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
1545 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
1546 | 1546 | } else { |
1547 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
1547 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
1548 | 1548 | } |
1549 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1549 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1550 | 1550 | if ($daemon == 'daemon') { |
1551 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1551 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1552 | 1552 | } else { |
1553 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1553 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1554 | 1554 | } |
1555 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1555 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1556 | 1556 | if ($schedules == 'schedules') { |
1557 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1557 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1558 | 1558 | } else { |
1559 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1559 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1560 | 1560 | } |
1561 | 1561 | |
1562 | 1562 | /* |
@@ -1567,311 +1567,311 @@ discard block |
||
1567 | 1567 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1568 | 1568 | } |
1569 | 1569 | */ |
1570 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1571 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1572 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1573 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1574 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1570 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1571 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1572 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1573 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1574 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1575 | 1575 | $va = false; |
1576 | 1576 | if ($globalivao == 'ivao') { |
1577 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1577 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1578 | 1578 | $va = true; |
1579 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1579 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1580 | 1580 | if ($globalvatsim == 'vatsim') { |
1581 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1581 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1582 | 1582 | $va = true; |
1583 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1583 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1584 | 1584 | if ($globalphpvms == 'phpvms') { |
1585 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1585 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1586 | 1586 | $va = true; |
1587 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1587 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1588 | 1588 | if ($globalvam == 'vam') { |
1589 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1589 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1590 | 1590 | $va = true; |
1591 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1591 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1592 | 1592 | if ($va) { |
1593 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1594 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1593 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1594 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1595 | 1595 | if ($globalva == 'va' || $va) { |
1596 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1597 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1596 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1597 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1598 | 1598 | } else { |
1599 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1600 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1601 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1599 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1600 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1601 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1602 | 1602 | } |
1603 | 1603 | if ($globalvm == 'vm') { |
1604 | - $settings = array_merge($settings,array('globalVM' => 'TRUE')); |
|
1604 | + $settings = array_merge($settings, array('globalVM' => 'TRUE')); |
|
1605 | 1605 | } else { |
1606 | - $settings = array_merge($settings,array('globalVM' => 'FALSE')); |
|
1606 | + $settings = array_merge($settings, array('globalVM' => 'FALSE')); |
|
1607 | 1607 | } |
1608 | 1608 | |
1609 | - $mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING); |
|
1609 | + $mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING); |
|
1610 | 1610 | if ($mapoffline == 'mapoffline') { |
1611 | - $settings = array_merge($settings,array('globalMapOffline' => 'TRUE')); |
|
1611 | + $settings = array_merge($settings, array('globalMapOffline' => 'TRUE')); |
|
1612 | 1612 | } else { |
1613 | - $settings = array_merge($settings,array('globalMapOffline' => 'FALSE')); |
|
1613 | + $settings = array_merge($settings, array('globalMapOffline' => 'FALSE')); |
|
1614 | 1614 | } |
1615 | - $globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING); |
|
1615 | + $globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING); |
|
1616 | 1616 | if ($globaloffline == 'globaloffline') { |
1617 | - $settings = array_merge($settings,array('globalOffline' => 'TRUE')); |
|
1617 | + $settings = array_merge($settings, array('globalOffline' => 'TRUE')); |
|
1618 | 1618 | } else { |
1619 | - $settings = array_merge($settings,array('globalOffline' => 'FALSE')); |
|
1619 | + $settings = array_merge($settings, array('globalOffline' => 'FALSE')); |
|
1620 | 1620 | } |
1621 | 1621 | |
1622 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1622 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1623 | 1623 | if ($notam == 'notam') { |
1624 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1624 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1625 | 1625 | } else { |
1626 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1626 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1627 | 1627 | } |
1628 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1628 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1629 | 1629 | if ($owner == 'owner') { |
1630 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1630 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1631 | 1631 | } else { |
1632 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1632 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1633 | 1633 | } |
1634 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1634 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1635 | 1635 | if ($map3d == 'map3d') { |
1636 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1636 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1637 | 1637 | } else { |
1638 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1638 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1639 | 1639 | } |
1640 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1640 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1641 | 1641 | if ($crash == 'crash') { |
1642 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1642 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1643 | 1643 | } else { |
1644 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1644 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1645 | 1645 | } |
1646 | - $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING); |
|
1646 | + $fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING); |
|
1647 | 1647 | if ($fires == 'fires') { |
1648 | - $settings = array_merge($settings,array('globalMapFires' => 'TRUE')); |
|
1648 | + $settings = array_merge($settings, array('globalMapFires' => 'TRUE')); |
|
1649 | 1649 | } else { |
1650 | - $settings = array_merge($settings,array('globalMapFires' => 'FALSE')); |
|
1650 | + $settings = array_merge($settings, array('globalMapFires' => 'FALSE')); |
|
1651 | 1651 | } |
1652 | - $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING); |
|
1652 | + $firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING); |
|
1653 | 1653 | if ($firessupport == 'firessupport') { |
1654 | - $settings = array_merge($settings,array('globalFires' => 'TRUE')); |
|
1654 | + $settings = array_merge($settings, array('globalFires' => 'TRUE')); |
|
1655 | 1655 | } else { |
1656 | - $settings = array_merge($settings,array('globalFires' => 'FALSE')); |
|
1656 | + $settings = array_merge($settings, array('globalFires' => 'FALSE')); |
|
1657 | 1657 | } |
1658 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1658 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1659 | 1659 | if ($mapsatellites == 'mapsatellites') { |
1660 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1660 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1661 | 1661 | } else { |
1662 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1662 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1663 | 1663 | } |
1664 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1664 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1665 | 1665 | if ($map3ddefault == 'map3ddefault') { |
1666 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1666 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1667 | 1667 | } else { |
1668 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1668 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1669 | 1669 | } |
1670 | - $one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING); |
|
1670 | + $one3dmodel = filter_input(INPUT_POST, 'one3dmodel', FILTER_SANITIZE_STRING); |
|
1671 | 1671 | if ($one3dmodel == 'one3dmodel') { |
1672 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE')); |
|
1672 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'TRUE')); |
|
1673 | 1673 | } else { |
1674 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE')); |
|
1674 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'FALSE')); |
|
1675 | 1675 | } |
1676 | - $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING); |
|
1676 | + $map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING); |
|
1677 | 1677 | if ($map3dliveries == 'map3dliveries') { |
1678 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE')); |
|
1678 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE')); |
|
1679 | 1679 | } else { |
1680 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE')); |
|
1680 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE')); |
|
1681 | 1681 | } |
1682 | - $map3dshadows = filter_input(INPUT_POST,'map3dshadows',FILTER_SANITIZE_STRING); |
|
1682 | + $map3dshadows = filter_input(INPUT_POST, 'map3dshadows', FILTER_SANITIZE_STRING); |
|
1683 | 1683 | if ($map3dshadows == 'map3dshadows') { |
1684 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'TRUE')); |
|
1684 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'TRUE')); |
|
1685 | 1685 | } else { |
1686 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'FALSE')); |
|
1686 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'FALSE')); |
|
1687 | 1687 | } |
1688 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1688 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1689 | 1689 | if ($translate == 'translate') { |
1690 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1690 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1691 | 1691 | } else { |
1692 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1692 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1693 | 1693 | } |
1694 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1694 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1695 | 1695 | if ($realairlines == 'realairlines') { |
1696 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1696 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1697 | 1697 | } else { |
1698 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1698 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1699 | 1699 | } |
1700 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1700 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1701 | 1701 | if ($estimation == 'estimation') { |
1702 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1702 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1703 | 1703 | } else { |
1704 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1704 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1705 | 1705 | } |
1706 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1706 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1707 | 1707 | if ($metar == 'metar') { |
1708 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1708 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1709 | 1709 | } else { |
1710 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1710 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1711 | 1711 | } |
1712 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1712 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1713 | 1713 | if ($metarcycle == 'metarcycle') { |
1714 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1714 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1715 | 1715 | } else { |
1716 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1716 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1717 | 1717 | } |
1718 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1718 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1719 | 1719 | if ($fork == 'fork') { |
1720 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1720 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1721 | 1721 | } else { |
1722 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1722 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1723 | 1723 | } |
1724 | 1724 | |
1725 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1725 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1726 | 1726 | if ($colormap == 'colormap') { |
1727 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1727 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1728 | 1728 | } else { |
1729 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1729 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1730 | 1730 | } |
1731 | 1731 | |
1732 | 1732 | if (isset($_POST['aircrafticoncolor'])) { |
1733 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1734 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1733 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1734 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1735 | 1735 | } |
1736 | 1736 | if (isset($_POST['marineiconcolor'])) { |
1737 | - $marineiconcolor = filter_input(INPUT_POST,'marineiconcolor',FILTER_SANITIZE_STRING); |
|
1738 | - $settings = array_merge($settings,array('globalMarineIconColor' => substr($marineiconcolor,1))); |
|
1737 | + $marineiconcolor = filter_input(INPUT_POST, 'marineiconcolor', FILTER_SANITIZE_STRING); |
|
1738 | + $settings = array_merge($settings, array('globalMarineIconColor' => substr($marineiconcolor, 1))); |
|
1739 | 1739 | } |
1740 | 1740 | if (isset($_POST['trackericoncolor'])) { |
1741 | - $trackericoncolor = filter_input(INPUT_POST,'trackericoncolor',FILTER_SANITIZE_STRING); |
|
1742 | - $settings = array_merge($settings,array('globalTrackerIconColor' => substr($trackericoncolor,1))); |
|
1741 | + $trackericoncolor = filter_input(INPUT_POST, 'trackericoncolor', FILTER_SANITIZE_STRING); |
|
1742 | + $settings = array_merge($settings, array('globalTrackerIconColor' => substr($trackericoncolor, 1))); |
|
1743 | 1743 | } |
1744 | 1744 | if (isset($_POST['satelliteiconcolor'])) { |
1745 | - $satelliteiconcolor = filter_input(INPUT_POST,'satelliteiconcolor',FILTER_SANITIZE_STRING); |
|
1746 | - $settings = array_merge($settings,array('globalSatelliteIconColor' => substr($satelliteiconcolor,1))); |
|
1745 | + $satelliteiconcolor = filter_input(INPUT_POST, 'satelliteiconcolor', FILTER_SANITIZE_STRING); |
|
1746 | + $settings = array_merge($settings, array('globalSatelliteIconColor' => substr($satelliteiconcolor, 1))); |
|
1747 | 1747 | } |
1748 | 1748 | |
1749 | - $corsproxy = filter_input(INPUT_POST,'corsproxy',FILTER_SANITIZE_STRING); |
|
1750 | - $settings = array_merge($settings,array('globalCORSproxy' => $corsproxy)); |
|
1749 | + $corsproxy = filter_input(INPUT_POST, 'corsproxy', FILTER_SANITIZE_STRING); |
|
1750 | + $settings = array_merge($settings, array('globalCORSproxy' => $corsproxy)); |
|
1751 | 1751 | |
1752 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1753 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1752 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1753 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1754 | 1754 | |
1755 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1756 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1757 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1758 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1759 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1760 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1755 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1756 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1757 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1758 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1759 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1760 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1761 | 1761 | |
1762 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1762 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1763 | 1763 | if ($mappopup == 'mappopup') { |
1764 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1764 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1765 | 1765 | } else { |
1766 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1766 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1767 | 1767 | } |
1768 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1768 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1769 | 1769 | if ($airportpopup == 'airportpopup') { |
1770 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1770 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1771 | 1771 | } else { |
1772 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1772 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1773 | 1773 | } |
1774 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1774 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1775 | 1775 | if ($maphistory == 'maphistory') { |
1776 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1776 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1777 | 1777 | } else { |
1778 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1778 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1779 | 1779 | } |
1780 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1780 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1781 | 1781 | if ($maptooltip == 'maptooltip') { |
1782 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1782 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1783 | 1783 | } else { |
1784 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1784 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1785 | 1785 | } |
1786 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1786 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1787 | 1787 | if ($flightroute == 'flightroute') { |
1788 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1788 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1789 | 1789 | } else { |
1790 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1790 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1791 | 1791 | } |
1792 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1792 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1793 | 1793 | if ($flightremainingroute == 'flightremainingroute') { |
1794 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1794 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1795 | 1795 | } else { |
1796 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1796 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1797 | 1797 | } |
1798 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1798 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1799 | 1799 | if ($allflights == 'allflights') { |
1800 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1800 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1801 | 1801 | } else { |
1802 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1802 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1803 | 1803 | } |
1804 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1804 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1805 | 1805 | if ($bbox == 'bbox') { |
1806 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1806 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1807 | 1807 | } else { |
1808 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1808 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1809 | 1809 | } |
1810 | - $singlemodel = filter_input(INPUT_POST,'singlemodel',FILTER_SANITIZE_STRING); |
|
1810 | + $singlemodel = filter_input(INPUT_POST, 'singlemodel', FILTER_SANITIZE_STRING); |
|
1811 | 1811 | if ($singlemodel == 'singlemodel') { |
1812 | - $settings = array_merge($settings,array('globalMap3DSelected' => 'TRUE')); |
|
1812 | + $settings = array_merge($settings, array('globalMap3DSelected' => 'TRUE')); |
|
1813 | 1813 | } else { |
1814 | - $settings = array_merge($settings,array('globalMap3DSelected' => 'FALSE')); |
|
1814 | + $settings = array_merge($settings, array('globalMap3DSelected' => 'FALSE')); |
|
1815 | 1815 | } |
1816 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1816 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1817 | 1817 | if ($groundaltitude == 'groundaltitude') { |
1818 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1818 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1819 | 1819 | } else { |
1820 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1820 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1821 | 1821 | } |
1822 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1822 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1823 | 1823 | if ($waypoints == 'waypoints') { |
1824 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1824 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1825 | 1825 | } else { |
1826 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1826 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1827 | 1827 | } |
1828 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1828 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1829 | 1829 | if ($geoid == 'geoid') { |
1830 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1830 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1831 | 1831 | } else { |
1832 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1832 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1833 | 1833 | } |
1834 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1835 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1834 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1835 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1836 | 1836 | |
1837 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1837 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1838 | 1838 | if ($noairlines == 'noairlines') { |
1839 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1839 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1840 | 1840 | } else { |
1841 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1841 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1842 | 1842 | } |
1843 | 1843 | |
1844 | - $tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING); |
|
1844 | + $tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING); |
|
1845 | 1845 | if ($tsk == 'tsk') { |
1846 | - $settings = array_merge($settings,array('globalTSK' => 'TRUE')); |
|
1846 | + $settings = array_merge($settings, array('globalTSK' => 'TRUE')); |
|
1847 | 1847 | } else { |
1848 | - $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
|
1848 | + $settings = array_merge($settings, array('globalTSK' => 'FALSE')); |
|
1849 | 1849 | } |
1850 | - $mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING); |
|
1850 | + $mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING); |
|
1851 | 1851 | if ($mapmatching == 'mapmatching') { |
1852 | - $settings = array_merge($settings,array('globalMapMatching' => 'TRUE')); |
|
1852 | + $settings = array_merge($settings, array('globalMapMatching' => 'TRUE')); |
|
1853 | 1853 | } else { |
1854 | - $settings = array_merge($settings,array('globalMapMatching' => 'FALSE')); |
|
1854 | + $settings = array_merge($settings, array('globalMapMatching' => 'FALSE')); |
|
1855 | 1855 | } |
1856 | - $mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING); |
|
1857 | - $settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1858 | - $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
|
1859 | - $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
|
1856 | + $mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING); |
|
1857 | + $settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1858 | + $graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING); |
|
1859 | + $settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper)); |
|
1860 | 1860 | |
1861 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1861 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1862 | 1862 | |
1863 | 1863 | // Set some defaults values... |
1864 | 1864 | if (!isset($globalAircraftImageSources)) { |
1865 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1866 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1865 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1866 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1867 | 1867 | } |
1868 | 1868 | |
1869 | 1869 | if (!isset($globalSchedulesSources)) { |
1870 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1871 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1870 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1871 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1872 | 1872 | } |
1873 | 1873 | |
1874 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1874 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1875 | 1875 | |
1876 | 1876 | if ($error == '') settings::modify_settings($settings); |
1877 | 1877 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -27,33 +27,33 @@ discard block |
||
27 | 27 | * @param bool $and |
28 | 28 | * @return string the SQL part |
29 | 29 | */ |
30 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
30 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
31 | 31 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
32 | 32 | $filters = array(); |
33 | 33 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
34 | 34 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
35 | 35 | $filters = $globalStatsFilters[$globalFilterName]; |
36 | 36 | } else { |
37 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
37 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | if (isset($filter[0]['source'])) { |
41 | - $filters = array_merge($filters,$filter); |
|
41 | + $filters = array_merge($filters, $filter); |
|
42 | 42 | } |
43 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
43 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
44 | 44 | $filter_query_join = ''; |
45 | 45 | $filter_query_where = ''; |
46 | - foreach($filters as $flt) { |
|
46 | + foreach ($filters as $flt) { |
|
47 | 47 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
48 | 48 | if (isset($flt['source'])) { |
49 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
49 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
50 | 50 | } else { |
51 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
51 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | } |
55 | 55 | if (isset($filter['source']) && !empty($filter['source'])) { |
56 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
56 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
57 | 57 | } |
58 | 58 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
59 | 59 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | $filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
92 | 92 | } |
93 | 93 | } |
94 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
94 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
95 | 95 | } |
96 | 96 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
97 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
97 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
98 | 98 | } |
99 | 99 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
100 | 100 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
101 | 101 | if ($filter_query_where != '') { |
102 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
102 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
103 | 103 | } |
104 | 104 | $filter_query = $filter_query_join.$filter_query_where; |
105 | 105 | return $filter_query; |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | if ($limit != '') |
125 | 125 | { |
126 | 126 | $limit_array = explode(',', $limit); |
127 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
128 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
127 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
128 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
129 | 129 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
130 | 130 | { |
131 | 131 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
141 | 141 | } |
142 | 142 | } |
143 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
143 | + if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
144 | 144 | |
145 | 145 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
146 | 146 | if ($globalDBdriver == 'mysql') { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } else { |
150 | 150 | $query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query; |
151 | 151 | } |
152 | - $spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true); |
|
152 | + $spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true); |
|
153 | 153 | |
154 | 154 | return $spotter_array; |
155 | 155 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | global $globalDBdriver, $globalLiveInterval; |
166 | 166 | date_default_timezone_set('UTC'); |
167 | 167 | |
168 | - $filter_query = $this->getFilter($filter,true,true); |
|
168 | + $filter_query = $this->getFilter($filter, true, true); |
|
169 | 169 | |
170 | 170 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
171 | 171 | if ($globalDBdriver == 'mysql') { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | try { |
180 | 180 | $sth = $this->db->prepare($query); |
181 | 181 | $sth->execute(); |
182 | - } catch(PDOException $e) { |
|
182 | + } catch (PDOException $e) { |
|
183 | 183 | echo $e->getMessage(); |
184 | 184 | die; |
185 | 185 | } |
@@ -197,26 +197,26 @@ discard block |
||
197 | 197 | * @param string $id |
198 | 198 | * @return array the spotter information |
199 | 199 | */ |
200 | - public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false, $id = '') |
|
200 | + public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false, $id = '') |
|
201 | 201 | { |
202 | 202 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
203 | 203 | date_default_timezone_set('UTC'); |
204 | 204 | $usecoord = false; |
205 | 205 | if (is_array($coord) && !empty($coord)) { |
206 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
207 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
208 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
209 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
206 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
207 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
208 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
209 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
210 | 210 | $usecoord = true; |
211 | 211 | } |
212 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
213 | - $filter_query = $this->getFilter($filter,true,true); |
|
212 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
213 | + $filter_query = $this->getFilter($filter, true, true); |
|
214 | 214 | |
215 | 215 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
216 | 216 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
217 | 217 | if ($globalDBdriver == 'mysql') { |
218 | 218 | if (isset($globalArchive) && $globalArchive === TRUE) { |
219 | - $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
219 | + $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
220 | 220 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
221 | 221 | if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
222 | 222 | if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | ORDER BY fammarine_id, date"; |
231 | 231 | if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
232 | 232 | } else { |
233 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
233 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
234 | 234 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date "; |
235 | 235 | if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
236 | 236 | if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | } else { |
242 | 242 | if (isset($globalArchive) && $globalArchive === TRUE) { |
243 | - $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
243 | + $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
244 | 244 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
245 | 245 | if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
246 | 246 | if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | try { |
268 | 268 | $sth = $this->db->prepare($query); |
269 | 269 | $sth->execute($query_values); |
270 | - } catch(PDOException $e) { |
|
270 | + } catch (PDOException $e) { |
|
271 | 271 | echo $e->getMessage(); |
272 | 272 | die; |
273 | 273 | } |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | * @param bool $limit |
284 | 284 | * @return array the spotter information |
285 | 285 | */ |
286 | - public function getMinLastLiveMarineDataByID($id = '',$filter = array(), $limit = false) |
|
286 | + public function getMinLastLiveMarineDataByID($id = '', $filter = array(), $limit = false) |
|
287 | 287 | { |
288 | 288 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
289 | 289 | date_default_timezone_set('UTC'); |
290 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
291 | - $filter_query = $this->getFilter($filter,true,true); |
|
290 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
291 | + $filter_query = $this->getFilter($filter, true, true); |
|
292 | 292 | |
293 | 293 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
294 | 294 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | try { |
334 | 334 | $sth = $this->db->prepare($query); |
335 | 335 | $sth->execute($query_values); |
336 | - } catch(PDOException $e) { |
|
336 | + } catch (PDOException $e) { |
|
337 | 337 | echo $e->getMessage(); |
338 | 338 | die; |
339 | 339 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | public function getLiveMarineCount($filter = array()) |
351 | 351 | { |
352 | 352 | global $globalDBdriver, $globalLiveInterval; |
353 | - $filter_query = $this->getFilter($filter,true,true); |
|
353 | + $filter_query = $this->getFilter($filter, true, true); |
|
354 | 354 | |
355 | 355 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
356 | 356 | if ($globalDBdriver == 'mysql') { |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | try { |
362 | 362 | $sth = $this->db->prepare($query); |
363 | 363 | $sth->execute(); |
364 | - } catch(PDOException $e) { |
|
364 | + } catch (PDOException $e) { |
|
365 | 365 | echo $e->getMessage(); |
366 | 366 | die; |
367 | 367 | } |
@@ -385,10 +385,10 @@ discard block |
||
385 | 385 | $filter_query = $this->getFilter($filter); |
386 | 386 | |
387 | 387 | if (is_array($coord)) { |
388 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
389 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
390 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
391 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
388 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
389 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
390 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
391 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
392 | 392 | } else return array(); |
393 | 393 | if ($globalDBdriver == 'mysql') { |
394 | 394 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query; |
@@ -411,13 +411,13 @@ discard block |
||
411 | 411 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
412 | 412 | $Marine = new Marine($this->db); |
413 | 413 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
414 | - $filter_query = $this->getFilter($filter,true,true); |
|
414 | + $filter_query = $this->getFilter($filter, true, true); |
|
415 | 415 | |
416 | 416 | if (is_array($coord)) { |
417 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
418 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
419 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
420 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
417 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
418 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
419 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
420 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
421 | 421 | } else return array(); |
422 | 422 | /* |
423 | 423 | if ($globalDBdriver == 'mysql') { |
@@ -432,13 +432,13 @@ discard block |
||
432 | 432 | */ |
433 | 433 | if ($globalDBdriver == 'mysql') { |
434 | 434 | if (isset($globalArchive) && $globalArchive === TRUE) { |
435 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
435 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
436 | 436 | FROM marine_live |
437 | 437 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date |
438 | 438 | AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
439 | 439 | AND marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY race_rank,date DESC'; |
440 | 440 | } else { |
441 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
441 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
442 | 442 | FROM marine_live |
443 | 443 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
444 | 444 | FROM marine_live l |
@@ -450,14 +450,14 @@ discard block |
||
450 | 450 | } |
451 | 451 | } else { |
452 | 452 | if (isset($globalArchive) && $globalArchive === TRUE) { |
453 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
453 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
454 | 454 | FROM marine_live |
455 | 455 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date |
456 | 456 | AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
457 | 457 | AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
458 | 458 | AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' ORDER BY race_rank, date DESC"; |
459 | 459 | } else { |
460 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
460 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
461 | 461 | FROM marine_live |
462 | 462 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
463 | 463 | FROM marine_live l |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | if ($interval == '1m') |
518 | 518 | { |
519 | 519 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
520 | - } else if ($interval == '15m'){ |
|
520 | + } else if ($interval == '15m') { |
|
521 | 521 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
522 | 522 | } |
523 | 523 | } |
@@ -525,14 +525,14 @@ discard block |
||
525 | 525 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
526 | 526 | } |
527 | 527 | |
528 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
528 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
529 | 529 | WHERE marine_live.latitude <> '' |
530 | 530 | AND marine_live.longitude <> '' |
531 | 531 | ".$additional_query." |
532 | 532 | HAVING distance < :radius |
533 | 533 | ORDER BY distance"; |
534 | 534 | |
535 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
535 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
536 | 536 | |
537 | 537 | return $spotter_array; |
538 | 538 | } |
@@ -550,9 +550,9 @@ discard block |
||
550 | 550 | date_default_timezone_set('UTC'); |
551 | 551 | |
552 | 552 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
553 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
553 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
554 | 554 | |
555 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
555 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
556 | 556 | |
557 | 557 | return $spotter_array; |
558 | 558 | } |
@@ -564,14 +564,14 @@ discard block |
||
564 | 564 | * @param $date |
565 | 565 | * @return array the spotter information |
566 | 566 | */ |
567 | - public function getDateLiveMarineDataByIdent($ident,$date) |
|
567 | + public function getDateLiveMarineDataByIdent($ident, $date) |
|
568 | 568 | { |
569 | 569 | $Marine = new Marine($this->db); |
570 | 570 | date_default_timezone_set('UTC'); |
571 | 571 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
572 | 572 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
573 | - $date = date('c',$date); |
|
574 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
573 | + $date = date('c', $date); |
|
574 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
575 | 575 | return $spotter_array; |
576 | 576 | } |
577 | 577 | |
@@ -582,14 +582,14 @@ discard block |
||
582 | 582 | * @param $date |
583 | 583 | * @return array the spotter information |
584 | 584 | */ |
585 | - public function getDateLiveMarineDataByMMSI($mmsi,$date) |
|
585 | + public function getDateLiveMarineDataByMMSI($mmsi, $date) |
|
586 | 586 | { |
587 | 587 | $Marine = new Marine($this->db); |
588 | 588 | date_default_timezone_set('UTC'); |
589 | 589 | $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
590 | 590 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
591 | - $date = date('c',$date); |
|
592 | - $spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date)); |
|
591 | + $date = date('c', $date); |
|
592 | + $spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date)); |
|
593 | 593 | return $spotter_array; |
594 | 594 | } |
595 | 595 | |
@@ -605,9 +605,9 @@ discard block |
||
605 | 605 | date_default_timezone_set('UTC'); |
606 | 606 | |
607 | 607 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
608 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
608 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
609 | 609 | |
610 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
|
610 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true); |
|
611 | 611 | |
612 | 612 | return $spotter_array; |
613 | 613 | } |
@@ -619,15 +619,15 @@ discard block |
||
619 | 619 | * @param $date |
620 | 620 | * @return array the spotter information |
621 | 621 | */ |
622 | - public function getDateLiveMarineDataById($id,$date) |
|
622 | + public function getDateLiveMarineDataById($id, $date) |
|
623 | 623 | { |
624 | 624 | $Marine = new Marine($this->db); |
625 | 625 | date_default_timezone_set('UTC'); |
626 | 626 | |
627 | 627 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
628 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
629 | - $date = date('c',$date); |
|
630 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
628 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
629 | + $date = date('c', $date); |
|
630 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
631 | 631 | |
632 | 632 | return $spotter_array; |
633 | 633 | } |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | * @param bool $liveinterval |
641 | 641 | * @return array the spotter information |
642 | 642 | */ |
643 | - public function getAllLiveMarineDataById($id,$liveinterval = false) |
|
643 | + public function getAllLiveMarineDataById($id, $liveinterval = false) |
|
644 | 644 | { |
645 | 645 | global $globalDBdriver, $globalLiveInterval; |
646 | 646 | date_default_timezone_set('UTC'); |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | try { |
660 | 660 | $sth = $this->db->prepare($query); |
661 | 661 | $sth->execute(array(':id' => $id)); |
662 | - } catch(PDOException $e) { |
|
662 | + } catch (PDOException $e) { |
|
663 | 663 | echo $e->getMessage(); |
664 | 664 | die; |
665 | 665 | } |
@@ -677,12 +677,12 @@ discard block |
||
677 | 677 | { |
678 | 678 | date_default_timezone_set('UTC'); |
679 | 679 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
680 | - $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
680 | + $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
681 | 681 | try { |
682 | 682 | |
683 | 683 | $sth = $this->db->prepare($query); |
684 | 684 | $sth->execute(array(':ident' => $ident)); |
685 | - } catch(PDOException $e) { |
|
685 | + } catch (PDOException $e) { |
|
686 | 686 | echo $e->getMessage(); |
687 | 687 | die; |
688 | 688 | } |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | |
713 | 713 | $sth = $this->db->prepare($query); |
714 | 714 | $sth->execute(); |
715 | - } catch(PDOException $e) { |
|
715 | + } catch (PDOException $e) { |
|
716 | 716 | return "error"; |
717 | 717 | } |
718 | 718 | |
@@ -735,14 +735,14 @@ discard block |
||
735 | 735 | |
736 | 736 | $sth = $this->db->prepare($query); |
737 | 737 | $sth->execute(); |
738 | - } catch(PDOException $e) { |
|
738 | + } catch (PDOException $e) { |
|
739 | 739 | return "error"; |
740 | 740 | } |
741 | 741 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
742 | 742 | $i = 0; |
743 | - $j =0; |
|
743 | + $j = 0; |
|
744 | 744 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
745 | - foreach($all as $row) |
|
745 | + foreach ($all as $row) |
|
746 | 746 | { |
747 | 747 | $i++; |
748 | 748 | $j++; |
@@ -750,9 +750,9 @@ discard block |
||
750 | 750 | if ($globalDebug) echo "."; |
751 | 751 | try { |
752 | 752 | |
753 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
753 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
754 | 754 | $sth->execute(); |
755 | - } catch(PDOException $e) { |
|
755 | + } catch (PDOException $e) { |
|
756 | 756 | return "error"; |
757 | 757 | } |
758 | 758 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
@@ -763,9 +763,9 @@ discard block |
||
763 | 763 | if ($i > 0) { |
764 | 764 | try { |
765 | 765 | |
766 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
766 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
767 | 767 | $sth->execute(); |
768 | - } catch(PDOException $e) { |
|
768 | + } catch (PDOException $e) { |
|
769 | 769 | return "error"; |
770 | 770 | } |
771 | 771 | } |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | |
779 | 779 | $sth = $this->db->prepare($query); |
780 | 780 | $sth->execute(); |
781 | - } catch(PDOException $e) { |
|
781 | + } catch (PDOException $e) { |
|
782 | 782 | return "error"; |
783 | 783 | } |
784 | 784 | /* $query_delete = "DELETE FROM marine_live WHERE fammarine_id IN ("; |
@@ -827,13 +827,13 @@ discard block |
||
827 | 827 | public function deleteLiveMarineDataByIdent($ident) |
828 | 828 | { |
829 | 829 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
830 | - $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
830 | + $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
831 | 831 | |
832 | 832 | try { |
833 | 833 | |
834 | 834 | $sth = $this->db->prepare($query); |
835 | 835 | $sth->execute(array(':ident' => $ident)); |
836 | - } catch(PDOException $e) { |
|
836 | + } catch (PDOException $e) { |
|
837 | 837 | return "error"; |
838 | 838 | } |
839 | 839 | |
@@ -849,13 +849,13 @@ discard block |
||
849 | 849 | public function deleteLiveMarineDataById($id) |
850 | 850 | { |
851 | 851 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
852 | - $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
852 | + $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
853 | 853 | |
854 | 854 | try { |
855 | 855 | |
856 | 856 | $sth = $this->db->prepare($query); |
857 | 857 | $sth->execute(array(':id' => $id)); |
858 | - } catch(PDOException $e) { |
|
858 | + } catch (PDOException $e) { |
|
859 | 859 | return "error"; |
860 | 860 | } |
861 | 861 | |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | */ |
872 | 872 | public function getAllRaces() |
873 | 873 | { |
874 | - $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
|
874 | + $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
|
875 | 875 | $sth = $this->db->prepare($query); |
876 | 876 | $sth->execute(); |
877 | 877 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -887,13 +887,13 @@ discard block |
||
887 | 887 | { |
888 | 888 | global $globalDBdriver; |
889 | 889 | if ($globalDBdriver == 'mysql') { |
890 | - $query = 'SELECT marine_live.ident FROM marine_live |
|
890 | + $query = 'SELECT marine_live.ident FROM marine_live |
|
891 | 891 | WHERE marine_live.ident = :ident |
892 | 892 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
893 | 893 | AND marine_live.date < UTC_TIMESTAMP()'; |
894 | 894 | $query_data = array(':ident' => $ident); |
895 | 895 | } else { |
896 | - $query = "SELECT marine_live.ident FROM marine_live |
|
896 | + $query = "SELECT marine_live.ident FROM marine_live |
|
897 | 897 | WHERE marine_live.ident = :ident |
898 | 898 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
899 | 899 | AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -902,8 +902,8 @@ discard block |
||
902 | 902 | |
903 | 903 | $sth = $this->db->prepare($query); |
904 | 904 | $sth->execute($query_data); |
905 | - $ident_result=''; |
|
906 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
905 | + $ident_result = ''; |
|
906 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
907 | 907 | { |
908 | 908 | $ident_result = $row['ident']; |
909 | 909 | } |
@@ -920,13 +920,13 @@ discard block |
||
920 | 920 | { |
921 | 921 | global $globalDBdriver; |
922 | 922 | if ($globalDBdriver == 'mysql') { |
923 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
923 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
924 | 924 | WHERE marine_live.ident = :ident |
925 | 925 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
926 | 926 | // AND marine_live.date < UTC_TIMESTAMP()"; |
927 | 927 | $query_data = array(':ident' => $ident); |
928 | 928 | } else { |
929 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
929 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
930 | 930 | WHERE marine_live.ident = :ident |
931 | 931 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
932 | 932 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -935,8 +935,8 @@ discard block |
||
935 | 935 | |
936 | 936 | $sth = $this->db->prepare($query); |
937 | 937 | $sth->execute($query_data); |
938 | - $ident_result=''; |
|
939 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
938 | + $ident_result = ''; |
|
939 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
940 | 940 | { |
941 | 941 | $ident_result = $row['fammarine_id']; |
942 | 942 | } |
@@ -953,13 +953,13 @@ discard block |
||
953 | 953 | { |
954 | 954 | global $globalDBdriver; |
955 | 955 | if ($globalDBdriver == 'mysql') { |
956 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
956 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
957 | 957 | WHERE marine_live.fammarine_id = :id |
958 | 958 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
959 | 959 | // AND marine_live.date < UTC_TIMESTAMP()"; |
960 | 960 | $query_data = array(':id' => $id); |
961 | 961 | } else { |
962 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
962 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
963 | 963 | WHERE marine_live.fammarine_id = :id |
964 | 964 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
965 | 965 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -968,8 +968,8 @@ discard block |
||
968 | 968 | |
969 | 969 | $sth = $this->db->prepare($query); |
970 | 970 | $sth->execute($query_data); |
971 | - $ident_result=''; |
|
972 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
971 | + $ident_result = ''; |
|
972 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
973 | 973 | { |
974 | 974 | $ident_result = $row['fammarine_id']; |
975 | 975 | } |
@@ -986,13 +986,13 @@ discard block |
||
986 | 986 | { |
987 | 987 | global $globalDBdriver; |
988 | 988 | if ($globalDBdriver == 'mysql') { |
989 | - $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
989 | + $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
990 | 990 | WHERE marine_live.mmsi = :mmsi |
991 | 991 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
992 | 992 | // AND marine_live.date < UTC_TIMESTAMP()"; |
993 | 993 | $query_data = array(':mmsi' => $mmsi); |
994 | 994 | } else { |
995 | - $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
995 | + $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
996 | 996 | WHERE marine_live.mmsi = :mmsi |
997 | 997 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
998 | 998 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -1001,8 +1001,8 @@ discard block |
||
1001 | 1001 | |
1002 | 1002 | $sth = $this->db->prepare($query); |
1003 | 1003 | $sth->execute($query_data); |
1004 | - $ident_result=''; |
|
1005 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1004 | + $ident_result = ''; |
|
1005 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1006 | 1006 | { |
1007 | 1007 | $ident_result = $row['fammarine_id']; |
1008 | 1008 | } |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | * @param string $race_time |
1043 | 1043 | * @return String success or false |
1044 | 1044 | */ |
1045 | - public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
|
1045 | + public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
|
1046 | 1046 | { |
1047 | 1047 | global $globalArchive, $globalDebug; |
1048 | 1048 | $Common = new Common(); |
@@ -1094,39 +1094,39 @@ discard block |
||
1094 | 1094 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
1095 | 1095 | |
1096 | 1096 | |
1097 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
1098 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1099 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1100 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1101 | - $distance = filter_var($distance,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1102 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1103 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1104 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1105 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
1106 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
1107 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
1108 | - $typeid = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT); |
|
1109 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
1110 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
1111 | - $statusid = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT); |
|
1112 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
1113 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
1114 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
1115 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
1116 | - $captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING); |
|
1117 | - $captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING); |
|
1118 | - $race_id = filter_var($race_id,FILTER_SANITIZE_STRING); |
|
1119 | - $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
|
1120 | - $race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT); |
|
1097 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
1098 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1099 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1100 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1101 | + $distance = filter_var($distance, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1102 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1103 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1104 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1105 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
1106 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
1107 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
1108 | + $typeid = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT); |
|
1109 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
1110 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
1111 | + $statusid = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT); |
|
1112 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
1113 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
1114 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
1115 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
1116 | + $captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING); |
|
1117 | + $captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING); |
|
1118 | + $race_id = filter_var($race_id, FILTER_SANITIZE_STRING); |
|
1119 | + $race_name = filter_var($race_name, FILTER_SANITIZE_STRING); |
|
1120 | + $race_rank = filter_var($race_rank, FILTER_SANITIZE_NUMBER_INT); |
|
1121 | 1121 | if ($race_rank == '') $race_rank = NULL; |
1122 | - $race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1122 | + $race_time = filter_var($race_time, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1123 | 1123 | if ($race_time == '') $race_time = NULL; |
1124 | 1124 | if ($typeid == '') $typeid = NULL; |
1125 | 1125 | if ($statusid == '') $statusid = NULL; |
1126 | 1126 | if ($distance == '') $distance = NULL; |
1127 | 1127 | |
1128 | 1128 | //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
1129 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1129 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1130 | 1130 | if ($arrival_date == '') $arrival_date = NULL; |
1131 | 1131 | $query = ''; |
1132 | 1132 | if ($globalArchive) { |
@@ -1135,19 +1135,19 @@ discard block |
||
1135 | 1135 | } |
1136 | 1136 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name,distance,race_rank,race_time) |
1137 | 1137 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:typeid,:status,:statusid,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name,:distance,:race_rank,:race_time)'; |
1138 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':typeid' => $typeid,':status' => $status,':statusid' => $statusid,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name,':distance' => $distance,':race_time' => $race_time,':race_rank' => $race_rank); |
|
1138 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':typeid' => $typeid, ':status' => $status, ':statusid' => $statusid, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name, ':distance' => $distance, ':race_time' => $race_time, ':race_rank' => $race_rank); |
|
1139 | 1139 | try { |
1140 | 1140 | $sth = $this->db->prepare($query); |
1141 | 1141 | $sth->execute($query_values); |
1142 | 1142 | $sth->closeCursor(); |
1143 | - } catch(PDOException $e) { |
|
1143 | + } catch (PDOException $e) { |
|
1144 | 1144 | return "error : ".$e->getMessage(); |
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1148 | 1148 | if ($globalDebug) echo '(Add to Marine archive : '; |
1149 | 1149 | $MarineArchive = new MarineArchive($this->db); |
1150 | - $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name,$distance,$race_rank,$race_time); |
|
1150 | + $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country, $captain_id, $captain_name, $race_id, $race_name, $distance, $race_rank, $race_time); |
|
1151 | 1151 | if ($globalDebug) echo $result.')'; |
1152 | 1152 | } |
1153 | 1153 | return "success"; |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | |
1156 | 1156 | public function getOrderBy() |
1157 | 1157 | { |
1158 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
1158 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
1159 | 1159 | return $orderby; |
1160 | 1160 | } |
1161 | 1161 |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | $Marine = new Marine($this->db); |
69 | 69 | if (isset($globalVM) && $globalVM) { |
70 | 70 | if ($this->all_tracked[$key]['status'] == 'Racing') { |
71 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
71 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
72 | 72 | } else { |
73 | - $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']); |
|
73 | + $timerace = (strtotime($this->all_tracked[$key]['race_begin']) + $this->all_tracked[$key]['race_time']); |
|
74 | 74 | if ($timerace > time()) $finaldatetime = NULL; |
75 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
76 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
75 | + else $finaldatetime = date('Y-m-d H:i:s', $timerace); |
|
76 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $finaldatetime, $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
77 | 77 | } |
78 | 78 | } else { |
79 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
79 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
90 | 90 | foreach ($this->all_tracked as $key => $flight) { |
91 | 91 | if (isset($flight['lastupdate'])) { |
92 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
92 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
93 | 93 | if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
94 | 94 | if (isset($this->all_tracked[$key]['id'])) { |
95 | 95 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
@@ -103,15 +103,15 @@ discard block |
||
103 | 103 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
104 | 104 | if (isset($globalVM) && $globalVM) { |
105 | 105 | if ($this->all_tracked[$key]['status'] == 'Racing') { |
106 | - $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
106 | + $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
107 | 107 | } else { |
108 | - $timerace = strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']; |
|
108 | + $timerace = strtotime($this->all_tracked[$key]['race_begin']) + $this->all_tracked[$key]['race_time']; |
|
109 | 109 | if ($timerace > time()) $finaldatetime = NULL; |
110 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
111 | - $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
110 | + else $finaldatetime = date('Y-m-d H:i:s', $timerace); |
|
111 | + $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $finaldatetime, $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
112 | 112 | } |
113 | 113 | } else { |
114 | - $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
114 | + $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
115 | 115 | } |
116 | 116 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
117 | 117 | } |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | public function add($line) { |
129 | - global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM; |
|
129 | + global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS, $APRSMarine, $globalLiveInterval, $globalVM; |
|
130 | 130 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
131 | 131 | date_default_timezone_set('UTC'); |
132 | 132 | $dataFound = false; |
133 | 133 | $send = false; |
134 | 134 | |
135 | 135 | // SBS format is CSV format |
136 | - if(is_array($line) && (isset($line['mmsi']) || isset($line['id']))) { |
|
136 | + if (is_array($line) && (isset($line['mmsi']) || isset($line['id']))) { |
|
137 | 137 | print_r($line); |
138 | 138 | if (isset($line['mmsi']) || isset($line['id'])) { |
139 | 139 | |
@@ -158,25 +158,25 @@ discard block |
||
158 | 158 | |
159 | 159 | if (!isset($this->all_tracked[$id])) { |
160 | 160 | $this->all_tracked[$id] = array(); |
161 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
162 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => '')); |
|
163 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
161 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedMarine' => 0)); |
|
162 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'typeid' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '', 'mmsi' => '', 'status' => '', 'status_id' => '', 'imo' => '', 'callsign' => '', 'arrival_code' => '', 'arrival_date' => '', 'mmsi_type' => '', 'captain_id' => '', 'captain_name' => '', 'race_id' => '', 'race_name' => '', 'distance' => NULL, 'race_rank' => NULL, 'race_time' => NULL, 'race_begin' => '')); |
|
163 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
164 | 164 | if (!isset($line['id'])) { |
165 | 165 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
166 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
167 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
166 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
167 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); |
|
168 | 168 | if ($globalAllTracked !== FALSE) $dataFound = true; |
169 | 169 | } |
170 | 170 | |
171 | 171 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
172 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
172 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi' => $line['mmsi'])); |
|
173 | 173 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
174 | 174 | $Marine = new Marine($this->db); |
175 | 175 | $identity = $Marine->getIdentity($line['mmsi']); |
176 | 176 | if (!empty($identity)) { |
177 | 177 | $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
178 | 178 | $this->all_tracked[$id]['type'] = $identity['type']; |
179 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
179 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
180 | 180 | } |
181 | 181 | //print_r($identity); |
182 | 182 | unset($Marine); |
@@ -184,25 +184,25 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | if (isset($line['type_id'])) { |
187 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
188 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
187 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $AIS->getShipType($line['type_id']))); |
|
188 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $line['type_id'])); |
|
189 | 189 | } |
190 | 190 | if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') { |
191 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
192 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
191 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
192 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
193 | 193 | } elseif (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] != '') { |
194 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
194 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
195 | 195 | } |
196 | 196 | if (isset($line['status']) && $line['status'] != '') { |
197 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
197 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status' => $line['status'])); |
|
198 | 198 | } |
199 | 199 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
200 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
200 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status_id' => $line['status_id'])); |
|
201 | 201 | if ($this->all_tracked[$id]['addedMarine'] == 1) { |
202 | 202 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
203 | 203 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
204 | 204 | $Marine = new Marine($this->db); |
205 | - $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
|
205 | + $Marine->updateStatusMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['status']); |
|
206 | 206 | unset($Marine); |
207 | 207 | } |
208 | 208 | } |
@@ -211,24 +211,24 @@ discard block |
||
211 | 211 | |
212 | 212 | |
213 | 213 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
214 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
214 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi_type' => $line['mmsi_type'])); |
|
215 | 215 | } |
216 | 216 | if (isset($line['imo']) && $line['imo'] != '') { |
217 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
217 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('imo' => $line['imo'])); |
|
218 | 218 | } |
219 | 219 | if (isset($line['callsign']) && $line['callsign'] != '') { |
220 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
220 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('callsign' => $line['callsign'])); |
|
221 | 221 | } |
222 | 222 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
223 | 223 | if (!isset($this->all_tracked[$id]['arrival_code'])) { |
224 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
224 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_code' => $line['arrival_code'])); |
|
225 | 225 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
226 | 226 | if ($this->all_tracked[$id]['addedMarine'] != 0) { |
227 | 227 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
228 | 228 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
229 | 229 | $Marine = new Marine($this->db); |
230 | 230 | $fromsource = NULL; |
231 | - $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
231 | + $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['arrival_code'], $fromsource); |
|
232 | 232 | $Marine->db = null; |
233 | 233 | } |
234 | 234 | } |
@@ -244,31 +244,31 @@ discard block |
||
244 | 244 | } |
245 | 245 | } |
246 | 246 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
247 | - if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
247 | + if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_date' => $line['arrival_date'])); |
|
248 | 248 | } |
249 | 249 | if (isset($line['captain_id']) && $line['captain_id'] != '') { |
250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id'])); |
|
250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('captain_id' => $line['captain_id'])); |
|
251 | 251 | } |
252 | 252 | if (isset($line['captain_name']) && $line['captain_name'] != '') { |
253 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_name' => $line['captain_name'])); |
|
253 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('captain_name' => $line['captain_name'])); |
|
254 | 254 | } |
255 | 255 | if (isset($line['race_id']) && $line['race_id'] != '') { |
256 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_id' => $line['race_id'])); |
|
256 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_id' => $line['race_id'])); |
|
257 | 257 | } |
258 | 258 | if (isset($line['race_name']) && $line['race_name'] != '') { |
259 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_name' => $line['race_name'])); |
|
259 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_name' => $line['race_name'])); |
|
260 | 260 | } |
261 | 261 | if (isset($line['race_rank']) && $line['race_rank'] != '') { |
262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_rank' => $line['race_rank'])); |
|
262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_rank' => $line['race_rank'])); |
|
263 | 263 | } |
264 | 264 | if (isset($line['race_time']) && $line['race_time'] != '') { |
265 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_time' => $line['race_time'])); |
|
265 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_time' => $line['race_time'])); |
|
266 | 266 | } |
267 | 267 | if (isset($line['race_begin']) && $line['race_begin'] != '') { |
268 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_begin' => $line['race_begin'])); |
|
268 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_begin' => $line['race_begin'])); |
|
269 | 269 | } |
270 | 270 | if (isset($line['distance']) && $line['distance'] != '') { |
271 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('distance' => $line['distance'])); |
|
271 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('distance' => $line['distance'])); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | //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'])) { |
@@ -277,44 +277,44 @@ discard block |
||
277 | 277 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
278 | 278 | $timeelapsed = microtime(true); |
279 | 279 | $Marine = new Marine($this->db); |
280 | - $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']); |
|
280 | + $Marine->addIdentity($this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['type']); |
|
281 | 281 | $Marine->db = null; |
282 | 282 | } |
283 | 283 | } |
284 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
284 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
285 | 285 | if ($this->all_tracked[$id]['addedMarine'] == 1) { |
286 | 286 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
287 | 287 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
288 | 288 | $timeelapsed = microtime(true); |
289 | 289 | $Marine = new Marine($this->db); |
290 | 290 | $fromsource = NULL; |
291 | - $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
291 | + $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
292 | 292 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
293 | 293 | $Marine->db = null; |
294 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
294 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
295 | 295 | } |
296 | 296 | } |
297 | 297 | } |
298 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
298 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); |
|
299 | 299 | } |
300 | 300 | |
301 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
|
301 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 30*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
302 | 302 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
303 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
303 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
304 | 304 | } else { |
305 | 305 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
306 | 306 | 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]['hex']." - format : ".$line['format_source']."\n"; |
307 | 307 | return ''; |
308 | 308 | } |
309 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
|
309 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time() - 30*60) { |
|
310 | 310 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
311 | 311 | return ''; |
312 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time()+20*60) { |
|
312 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time() + 20*60) { |
|
313 | 313 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
314 | 314 | return ''; |
315 | 315 | } elseif (!isset($line['datetime'])) { |
316 | 316 | date_default_timezone_set('UTC'); |
317 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
317 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
318 | 318 | } else { |
319 | 319 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n"; |
320 | 320 | return ''; |
@@ -322,20 +322,20 @@ discard block |
||
322 | 322 | |
323 | 323 | |
324 | 324 | if (isset($line['speed'])) { |
325 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'],2))); |
|
326 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
325 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed'], 2))); |
|
326 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
327 | 327 | } 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'])) { |
328 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
328 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
329 | 329 | if ($distance > 1000 && $distance < 10000) { |
330 | 330 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
331 | 331 | $speed = $speed*3.6; |
332 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2))); |
|
332 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed, 2))); |
|
333 | 333 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['id']." : ".$speed." - distance : ".$distance."\n"; |
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
337 | 337 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
338 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
338 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
339 | 339 | else unset($timediff); |
340 | 340 | if ($this->tmd > 5 || |
341 | 341 | !isset($timediff) || |
@@ -344,11 +344,11 @@ discard block |
||
344 | 344 | $timediff > 30 && |
345 | 345 | isset($this->all_tracked[$id]['latitude']) && |
346 | 346 | isset($this->all_tracked[$id]['longitude']) && |
347 | - $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')) |
|
347 | + $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')) |
|
348 | 348 | ) |
349 | 349 | ) { |
350 | 350 | 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'])) { |
351 | - 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'])) { |
|
351 | + 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'])) { |
|
352 | 352 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
353 | 353 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
354 | 354 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | $timeelapsed = microtime(true); |
358 | 358 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
359 | 359 | $Marine = new Marine($this->db); |
360 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
360 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
361 | 361 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
362 | 362 | $Marine->db = null; |
363 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
363 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
364 | 364 | } |
365 | 365 | $this->tmd = 0; |
366 | 366 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
@@ -369,55 +369,55 @@ discard block |
||
369 | 369 | |
370 | 370 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
371 | 371 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
372 | - if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
372 | + if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
373 | 373 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
374 | 374 | $dataFound = true; |
375 | 375 | $this->all_tracked[$id]['time_last_coord'] = time(); |
376 | 376 | } |
377 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
377 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
378 | 378 | } |
379 | 379 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
380 | 380 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
381 | 381 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
382 | - if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
382 | + if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
383 | 383 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
384 | 384 | $dataFound = true; |
385 | 385 | $this->all_tracked[$id]['time_last_coord'] = time(); |
386 | 386 | } |
387 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
387 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | } else if ($globalDebug && $timediff > 20) { |
391 | 391 | $this->tmd = $this->tmd + 1; |
392 | 392 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
393 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
394 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
393 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
394 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
395 | 395 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
396 | 396 | } |
397 | 397 | } |
398 | 398 | if (isset($line['last_update']) && $line['last_update'] != '') { |
399 | 399 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
400 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
400 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
401 | 401 | } |
402 | 402 | if (isset($line['format_source']) && $line['format_source'] != '') { |
403 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
403 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
404 | 404 | } |
405 | 405 | if (isset($line['source_name']) && $line['source_name'] != '') { |
406 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
406 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
407 | 407 | } |
408 | 408 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
409 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
409 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | if (isset($line['heading']) && $line['heading'] != '') { |
413 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
414 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
415 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
413 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
414 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
415 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
416 | 416 | //$dataFound = true; |
417 | 417 | } 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']) { |
418 | - $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']); |
|
419 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
420 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
418 | + $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']); |
|
419 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); |
|
420 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
421 | 421 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
422 | 422 | } |
423 | 423 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | if ($dataFound === true && (isset($this->all_tracked[$id]['mmsi']) || isset($this->all_tracked[$id]['id']))) { |
428 | 428 | $this->all_tracked[$id]['lastupdate'] = time(); |
429 | 429 | if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) { |
430 | - 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'])) { |
|
430 | + 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'])) { |
|
431 | 431 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
432 | 432 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
433 | 433 | if ($globalDebug) echo "Check if vessel is already in DB..."; |
@@ -436,28 +436,28 @@ discard block |
||
436 | 436 | if (isset($line['id']) && isset($globalVM) && $globalVM) { |
437 | 437 | $Marine = new Marine($this->db); |
438 | 438 | $recent_ident = $Marine->checkId($line['id']); |
439 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
440 | - $Marine->db=null; |
|
439 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
440 | + $Marine->db = null; |
|
441 | 441 | } elseif (isset($line['id'])) { |
442 | 442 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
443 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
443 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
444 | 444 | } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
445 | 445 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
446 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
446 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
447 | 447 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
448 | 448 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
449 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
449 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
450 | 450 | } else $recent_ident = ''; |
451 | - $MarineLive->db=null; |
|
451 | + $MarineLive->db = null; |
|
452 | 452 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
453 | 453 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
454 | 454 | } else $recent_ident = ''; |
455 | 455 | } else { |
456 | 456 | $recent_ident = ''; |
457 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
457 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
458 | 458 | } |
459 | 459 | //if there was no vessel with the same callsign within the last hour and go post it into the archive |
460 | - if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
|
460 | + if ($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
|
461 | 461 | { |
462 | 462 | if ($globalDebug) { |
463 | 463 | if ($this->all_tracked[$id]['mmsi'] != '') echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
@@ -465,19 +465,19 @@ discard block |
||
465 | 465 | } |
466 | 466 | //adds the spotter data for the archive |
467 | 467 | $highlight = ''; |
468 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
468 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
469 | 469 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
470 | 470 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
471 | 471 | $timeelapsed = microtime(true); |
472 | 472 | $Marine = new Marine($this->db); |
473 | 473 | if (isset($globalVM) && $globalVM && ($this->all_tracked[$id]['race_begin'] != '' || $this->all_tracked[$id]['format_source'] == 'sailaway')) { |
474 | - $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['race_begin'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
|
474 | + $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['race_begin'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['captain_id'], $this->all_tracked[$id]['captain_name'], $this->all_tracked[$id]['race_id'], $this->all_tracked[$id]['race_name'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time']); |
|
475 | 475 | } else { |
476 | - $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
|
476 | + $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['captain_id'], $this->all_tracked[$id]['captain_name'], $this->all_tracked[$id]['race_id'], $this->all_tracked[$id]['race_name'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time']); |
|
477 | 477 | } |
478 | 478 | $Marine->db = null; |
479 | 479 | if ($globalDebug && isset($result)) echo $result."\n"; |
480 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
480 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
481 | 481 | } |
482 | 482 | } |
483 | 483 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
@@ -485,15 +485,15 @@ discard block |
||
485 | 485 | $Stats = new Stats($this->db); |
486 | 486 | if (!empty($this->stats)) { |
487 | 487 | if ($globalDebug) echo 'Add source stats : '; |
488 | - foreach($this->stats as $date => $data) { |
|
489 | - foreach($data as $source => $sourced) { |
|
488 | + foreach ($this->stats as $date => $data) { |
|
489 | + foreach ($data as $source => $sourced) { |
|
490 | 490 | //print_r($sourced); |
491 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
492 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
491 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_marine', $date); |
|
492 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_marine', $date); |
|
493 | 493 | if (isset($sourced['msg'])) { |
494 | 494 | if (time() - $sourced['msg']['date'] > 10) { |
495 | 495 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
496 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
496 | + echo $Stats->addStatSource($nbmsg, $source, 'msg_marine', $date); |
|
497 | 497 | unset($this->stats[$date][$source]['msg']); |
498 | 498 | } |
499 | 499 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
518 | 518 | $MarineLive = new MarineLive($this->db); |
519 | 519 | $MarineLive->deleteLiveMarineData(); |
520 | - $MarineLive->db=null; |
|
520 | + $MarineLive->db = null; |
|
521 | 521 | if ($globalDebug) echo " Done\n"; |
522 | 522 | } |
523 | 523 | $this->last_delete = time(); |
@@ -530,17 +530,17 @@ discard block |
||
530 | 530 | $Marine = new Marine($this->db); |
531 | 531 | if (isset($globalVM) && $globalVM) { |
532 | 532 | if ($this->all_tracked[$id]['status'] == 'Racing') { |
533 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
533 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['race_begin']); |
|
534 | 534 | } else { |
535 | 535 | //$finaldatetime = date('Y-m-d H:i:s',strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
536 | - $timerace = (strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
|
536 | + $timerace = (strtotime($this->all_tracked[$id]['race_begin']) + $this->all_tracked[$id]['race_time']); |
|
537 | 537 | if ($timerace > time()) $finaldatetime = NULL; |
538 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
538 | + else $finaldatetime = date('Y-m-d H:i:s', $timerace); |
|
539 | 539 | |
540 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$finaldatetime,$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
540 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $finaldatetime, $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['race_begin']); |
|
541 | 541 | } |
542 | 542 | } else { |
543 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
543 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['race_begin']); |
|
544 | 544 | } |
545 | 545 | $Marine->db = null; |
546 | 546 | } |
@@ -556,20 +556,20 @@ discard block |
||
556 | 556 | $ignoreImport = false; |
557 | 557 | if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] == 'sailawayfull' && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true; |
558 | 558 | if (!$ignoreImport) { |
559 | - 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'])) { |
|
559 | + 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'])) { |
|
560 | 560 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
561 | 561 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
562 | 562 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
563 | 563 | $timeelapsed = microtime(true); |
564 | 564 | $MarineLive = new MarineLive($this->db); |
565 | - $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
|
565 | + $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country'], $this->all_tracked[$id]['captain_id'], $this->all_tracked[$id]['captain_name'], $this->all_tracked[$id]['race_id'], $this->all_tracked[$id]['race_name'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time']); |
|
566 | 566 | $MarineLive->db = null; |
567 | 567 | if ($globalDebug) echo $result."\n"; |
568 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
568 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
569 | 569 | } |
570 | 570 | } |
571 | 571 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
572 | - $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
572 | + $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
573 | 573 | } |
574 | 574 | $this->all_tracked[$id]['putinarchive'] = false; |
575 | 575 | |
@@ -588,19 +588,19 @@ discard block |
||
588 | 588 | $latitude = $globalCenterLatitude; |
589 | 589 | $longitude = $globalCenterLongitude; |
590 | 590 | } |
591 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
591 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
592 | 592 | } else { |
593 | 593 | $latitude = $this->source_location[$source]['latitude']; |
594 | 594 | $longitude = $this->source_location[$source]['longitude']; |
595 | 595 | } |
596 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
596 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
597 | 597 | //$stats_heading = $stats_heading%22.5; |
598 | 598 | $stats_heading = round($stats_heading/22.5); |
599 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
599 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
600 | 600 | $current_date = date('Y-m-d'); |
601 | 601 | if ($stats_heading == 16) $stats_heading = 0; |
602 | 602 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
603 | - for ($i=0;$i<=15;$i++) { |
|
603 | + for ($i = 0; $i <= 15; $i++) { |
|
604 | 604 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
605 | 605 | } |
606 | 606 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -615,9 +615,9 @@ discard block |
||
615 | 615 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
616 | 616 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
617 | 617 | end($this->stats[$current_date][$source]['hist']); |
618 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
618 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
619 | 619 | } else $mini = 0; |
620 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
620 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
621 | 621 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
622 | 622 | } |
623 | 623 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | |
630 | 630 | $this->all_tracked[$id]['lastupdate'] = time(); |
631 | 631 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
632 | - } 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"; |
|
632 | + } 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"; |
|
633 | 633 | //$this->del(); |
634 | 634 | |
635 | 635 | |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | |
657 | 657 | public function race_add($data) { |
658 | 658 | $Marine = new Marine(); |
659 | - $Marine->addRace($data['id'],$data['name'],$data['creator'],$data['desc'],$data['startdate'],$data['markers']); |
|
659 | + $Marine->addRace($data['id'], $data['name'], $data['creator'], $data['desc'], $data['startdate'], $data['markers']); |
|
660 | 660 | $Marine->db = null; |
661 | 661 | } |
662 | 662 | } |