@@ -46,20 +46,20 @@ discard block |
||
46 | 46 | die; |
47 | 47 | } |
48 | 48 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
49 | - $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
|
49 | + $globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | -$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver')); |
|
53 | +$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::', 'aprsserverhost::', 'aprsserverport::', 'format::', 'noaprsserver')); |
|
54 | 54 | //if (isset($options['s'])) $hosts = array($options['s']); |
55 | 55 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
56 | 56 | if (isset($options['s'])) { |
57 | 57 | $globalSources = array(); |
58 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
58 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['s'], 'format' => $options['format']); |
|
59 | 59 | else $globalSources[] = array('host' => $options['s']); |
60 | 60 | } elseif (isset($options['source'])) { |
61 | 61 | $globalSources = array(); |
62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
62 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['source'], 'format' => $options['format']); |
|
63 | 63 | else $globalSources[] = array('host' => $options['source']); |
64 | 64 | } |
65 | 65 | if (isset($options['aprsserverhost'])) { |
@@ -76,28 +76,28 @@ discard block |
||
76 | 76 | else $id_source = 1; |
77 | 77 | if (isset($globalServer) && $globalServer) { |
78 | 78 | if ($globalDebug) echo "Using Server Mode\n"; |
79 | - $SI=new SpotterServer(); |
|
79 | + $SI = new SpotterServer(); |
|
80 | 80 | /* |
81 | 81 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
82 | 82 | $SI = new adsb2aprs(); |
83 | 83 | $SI->connect(); |
84 | 84 | */ |
85 | -} else $SI=new SpotterImport($Connection->db); |
|
85 | +} else $SI = new SpotterImport($Connection->db); |
|
86 | 86 | if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
87 | 87 | if (isset($globalMarine) && $globalMarine) { |
88 | 88 | $AIS = new AIS(); |
89 | 89 | $MI = new MarineImport($Connection->db); |
90 | 90 | } |
91 | 91 | //$APRS=new APRS($Connection->db); |
92 | -$SBS=new SBS(); |
|
93 | -$ACARS=new ACARS($Connection->db); |
|
94 | -$Source=new Source($Connection->db); |
|
95 | -$Common=new Common(); |
|
92 | +$SBS = new SBS(); |
|
93 | +$ACARS = new ACARS($Connection->db); |
|
94 | +$Source = new Source($Connection->db); |
|
95 | +$Common = new Common(); |
|
96 | 96 | date_default_timezone_set('UTC'); |
97 | 97 | //$servertz = system('date +%Z'); |
98 | 98 | // signal handler - playing nice with sockets and dump1090 |
99 | 99 | if (function_exists('pcntl_fork')) { |
100 | - pcntl_signal(SIGINT, function() { |
|
100 | + pcntl_signal(SIGINT, function() { |
|
101 | 101 | global $sockets; |
102 | 102 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
103 | 103 | die("Bye!\n"); |
@@ -113,30 +113,30 @@ discard block |
||
113 | 113 | |
114 | 114 | function connect_all($hosts) { |
115 | 115 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
116 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
116 | + global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context; |
|
117 | 117 | $reset++; |
118 | 118 | if ($globalDebug) echo 'Connect to all...'."\n"; |
119 | 119 | foreach ($hosts as $id => $value) { |
120 | 120 | $host = $value['host']; |
121 | 121 | $globalSources[$id]['last_exec'] = 0; |
122 | 122 | // Here we check type of source(s) |
123 | - if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
124 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
123 | + if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
124 | + if (preg_match('/deltadb.txt$/i', $host)) { |
|
125 | 125 | //$formats[$id] = 'deltadbtxt'; |
126 | 126 | $globalSources[$id]['format'] = 'deltadbtxt'; |
127 | 127 | //$last_exec['deltadbtxt'] = 0; |
128 | 128 | if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
129 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
129 | + } else if (preg_match('/vatsim-data.txt$/i', $host)) { |
|
130 | 130 | //$formats[$id] = 'vatsimtxt'; |
131 | 131 | $globalSources[$id]['format'] = 'vatsimtxt'; |
132 | 132 | //$last_exec['vatsimtxt'] = 0; |
133 | 133 | if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
134 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
134 | + } else if (preg_match('/aircraftlist.json$/i', $host)) { |
|
135 | 135 | //$formats[$id] = 'aircraftlistjson'; |
136 | 136 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
137 | 137 | //$last_exec['aircraftlistjson'] = 0; |
138 | 138 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
139 | - } else if (preg_match('/opensky/i',$host)) { |
|
139 | + } else if (preg_match('/opensky/i', $host)) { |
|
140 | 140 | //$formats[$id] = 'aircraftlistjson'; |
141 | 141 | $globalSources[$id]['format'] = 'opensky'; |
142 | 142 | //$last_exec['aircraftlistjson'] = 0; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | exit(0); |
154 | 154 | } |
155 | 155 | */ |
156 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
156 | + } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { |
|
157 | 157 | //$formats[$id] = 'planeupdatefaa'; |
158 | 158 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
159 | 159 | //$last_exec['planeupdatefaa'] = 0; |
@@ -162,29 +162,29 @@ discard block |
||
162 | 162 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
163 | 163 | exit(0); |
164 | 164 | } |
165 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
165 | + } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { |
|
166 | 166 | //$formats[$id] = 'phpvmacars'; |
167 | 167 | $globalSources[$id]['format'] = 'phpvmacars'; |
168 | 168 | //$last_exec['phpvmacars'] = 0; |
169 | 169 | if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
170 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
170 | + } else if (preg_match('/VAM-json.php$/i', $host)) { |
|
171 | 171 | //$formats[$id] = 'phpvmacars'; |
172 | 172 | $globalSources[$id]['format'] = 'vam'; |
173 | 173 | if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
174 | - } else if (preg_match('/whazzup/i',$host)) { |
|
174 | + } else if (preg_match('/whazzup/i', $host)) { |
|
175 | 175 | //$formats[$id] = 'whazzup'; |
176 | 176 | $globalSources[$id]['format'] = 'whazzup'; |
177 | 177 | //$last_exec['whazzup'] = 0; |
178 | 178 | if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
179 | - } else if (preg_match('/airwhere/i',$host)) { |
|
179 | + } else if (preg_match('/airwhere/i', $host)) { |
|
180 | 180 | $globalSources[$id]['format'] = 'airwhere'; |
181 | 181 | if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
182 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
182 | + } else if (preg_match('/recentpireps/i', $host)) { |
|
183 | 183 | //$formats[$id] = 'pirepsjson'; |
184 | 184 | $globalSources[$id]['format'] = 'pirepsjson'; |
185 | 185 | //$last_exec['pirepsjson'] = 0; |
186 | 186 | if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
187 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
187 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { |
|
188 | 188 | //$formats[$id] = 'fr24json'; |
189 | 189 | $globalSources[$id]['format'] = 'fr24json'; |
190 | 190 | //$last_exec['fr24json'] = 0; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
194 | 194 | exit(0); |
195 | 195 | } |
196 | - } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
196 | + } else if (preg_match(':myshiptracking.com/:i', $host)) { |
|
197 | 197 | //$formats[$id] = 'fr24json'; |
198 | 198 | $globalSources[$id]['format'] = 'myshiptracking'; |
199 | 199 | //$last_exec['fr24json'] = 0; |
@@ -203,22 +203,22 @@ discard block |
||
203 | 203 | exit(0); |
204 | 204 | } |
205 | 205 | //} else if (preg_match('/10001/',$host)) { |
206 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
206 | + } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
207 | 207 | //$formats[$id] = 'tsv'; |
208 | 208 | $globalSources[$id]['format'] = 'tsv'; |
209 | 209 | if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
210 | 210 | } |
211 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
211 | + } elseif (filter_var($host, FILTER_VALIDATE_URL)) { |
|
212 | 212 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
213 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
213 | + $idf = fopen($globalSources[$id]['host'], 'r', false, $context); |
|
214 | 214 | if ($idf !== false) { |
215 | 215 | $httpfeeds[$id] = $idf; |
216 | 216 | if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
217 | 217 | } |
218 | 218 | elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
219 | 219 | } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
220 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
221 | - $hostport = explode(':',$host); |
|
220 | + } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { |
|
221 | + $hostport = explode(':', $host); |
|
222 | 222 | if (isset($hostport[1])) { |
223 | 223 | $port = $hostport[1]; |
224 | 224 | $hostn = $hostport[0]; |
@@ -228,19 +228,19 @@ discard block |
||
228 | 228 | } |
229 | 229 | $Common = new Common(); |
230 | 230 | if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
231 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
231 | + $s = $Common->create_socket($hostn, $port, $errno, $errstr); |
|
232 | 232 | } else { |
233 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
233 | + $s = $Common->create_socket_udp($hostn, $port, $errno, $errstr); |
|
234 | 234 | } |
235 | 235 | if ($s) { |
236 | 236 | $sockets[$id] = $s; |
237 | 237 | if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
238 | - if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
238 | + if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') { |
|
239 | 239 | //$formats[$id] = 'aprs'; |
240 | 240 | $globalSources[$id]['format'] = 'aprs'; |
241 | 241 | //$aprs_connect = 0; |
242 | 242 | //$use_aprs = true; |
243 | - } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
243 | + } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
244 | 244 | $globalSources[$id]['format'] = 'vrstcp'; |
245 | 245 | } elseif ($port == '10001') { |
246 | 246 | //$formats[$id] = 'tsv'; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
280 | 280 | else $timeout = 20; |
281 | 281 | $errno = ''; |
282 | -$errstr=''; |
|
282 | +$errstr = ''; |
|
283 | 283 | |
284 | 284 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
285 | 285 | /* Initiate connections to all the hosts simultaneously */ |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | //connect_all($globalSources); |
288 | 288 | |
289 | 289 | if (isset($globalProxy) && $globalProxy) { |
290 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
290 | + $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true))); |
|
291 | 291 | } else { |
292 | 292 | $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
293 | 293 | } |
@@ -314,16 +314,16 @@ discard block |
||
314 | 314 | |
315 | 315 | if ($use_aprs) { |
316 | 316 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
317 | - $APRS=new APRS(); |
|
317 | + $APRS = new APRS(); |
|
318 | 318 | $aprs_connect = 0; |
319 | 319 | $aprs_keep = 120; |
320 | 320 | $aprs_last_tx = time(); |
321 | 321 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
322 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
322 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
323 | 323 | if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
324 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
324 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
325 | 325 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
326 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
326 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
327 | 327 | if ($aprs_full) $aprs_filter = ''; |
328 | 328 | if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
329 | 329 | else $aprs_pass = '-1'; |
@@ -337,12 +337,12 @@ discard block |
||
337 | 337 | sleep(1); |
338 | 338 | if ($globalDebug) echo "SCAN MODE \n\n"; |
339 | 339 | if (!isset($globalCronEnd)) $globalCronEnd = 60; |
340 | -$endtime = time()+$globalCronEnd; |
|
340 | +$endtime = time() + $globalCronEnd; |
|
341 | 341 | $i = 1; |
342 | 342 | $tt = array(); |
343 | 343 | // Delete all ATC |
344 | 344 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
345 | - $ATC=new ATC($Connection->db); |
|
345 | + $ATC = new ATC($Connection->db); |
|
346 | 346 | } |
347 | 347 | if (!$globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
348 | 348 | $ATC->deleteAll(); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
352 | 352 | while ($i > 0) { |
353 | - if (!$globalDaemon) $i = $endtime-time(); |
|
353 | + if (!$globalDaemon) $i = $endtime - time(); |
|
354 | 354 | // Delete old ATC |
355 | 355 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
356 | 356 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | } |
365 | 365 | if ($max != $globalMinFetch) { |
366 | 366 | if ($globalDebug) echo 'Sleeping...'."\n"; |
367 | - sleep($globalMinFetch-$max+2); |
|
367 | + sleep($globalMinFetch - $max + 2); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | //$buffer = $Common->getData($hosts[$id]); |
378 | 378 | $buffer = $Common->getData($value['host']); |
379 | 379 | if ($buffer != '') $reset = 0; |
380 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
381 | - $buffer = explode('\n',$buffer); |
|
380 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
381 | + $buffer = explode('\n', $buffer); |
|
382 | 382 | foreach ($buffer as $line) { |
383 | 383 | if ($line != '' && count($line) > 7) { |
384 | 384 | $line = explode(',', $line); |
@@ -406,11 +406,11 @@ discard block |
||
406 | 406 | $last_exec[$id]['last'] = time(); |
407 | 407 | } elseif ($value['format'] == 'aisnmeatxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
408 | 408 | date_default_timezone_set('CET'); |
409 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
409 | + $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host'])); |
|
410 | 410 | date_default_timezone_set('UTC'); |
411 | 411 | if ($buffer != '') $reset = 0; |
412 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
413 | - $buffer = explode('\n',$buffer); |
|
412 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
413 | + $buffer = explode('\n', $buffer); |
|
414 | 414 | foreach ($buffer as $line) { |
415 | 415 | if ($line != '') { |
416 | 416 | echo "'".$line."'\n"; |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
429 | 429 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
430 | 430 | if (isset($ais_data['timestamp'])) { |
431 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
431 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
432 | 432 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
433 | 433 | $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
434 | 434 | $add = true; |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | $w = $e = null; |
452 | 452 | |
453 | 453 | if (isset($arr[$id])) { |
454 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
454 | + $nn = stream_select($arr, $w, $e, $timeout); |
|
455 | 455 | if ($nn > 0) { |
456 | 456 | foreach ($httpfeeds as $feed) { |
457 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
458 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
459 | - $buffer = explode('\n',$buffer); |
|
457 | + $buffer = stream_get_line($feed, 2000, "\n"); |
|
458 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
459 | + $buffer = explode('\n', $buffer); |
|
460 | 460 | foreach ($buffer as $line) { |
461 | 461 | if ($line != '') { |
462 | 462 | $ais_data = $AIS->parse_line(trim($line)); |
@@ -474,9 +474,9 @@ discard block |
||
474 | 474 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
475 | 475 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
476 | 476 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
477 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
477 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
478 | 478 | if (isset($ais_data['timestamp'])) { |
479 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
479 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
480 | 480 | } else { |
481 | 481 | $data['datetime'] = date('Y-m-d H:i:s'); |
482 | 482 | } |
@@ -502,10 +502,10 @@ discard block |
||
502 | 502 | } |
503 | 503 | } |
504 | 504 | } elseif ($value['format'] == 'myshiptracking' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
505 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
505 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
506 | 506 | if ($buffer != '') { |
507 | 507 | //echo $buffer; |
508 | - $all_data = json_decode($buffer,true); |
|
508 | + $all_data = json_decode($buffer, true); |
|
509 | 509 | //print_r($all_data); |
510 | 510 | if (isset($all_data[0]['DATA'])) { |
511 | 511 | foreach ($all_data[0]['DATA'] as $line) { |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
521 | 521 | $data['imo'] = $line['IMO']; |
522 | 522 | //$data['arrival_code'] = $ais_data['destination']; |
523 | - $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
523 | + $data['datetime'] = date('Y-m-d H:i:s', $line['T']); |
|
524 | 524 | $data['format_source'] = 'myshiptracking'; |
525 | 525 | $data['id_source'] = $id_source; |
526 | 526 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -532,9 +532,9 @@ discard block |
||
532 | 532 | } |
533 | 533 | $last_exec[$id]['last'] = time(); |
534 | 534 | } elseif ($value['format'] == 'boatbeaconapp' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
535 | - $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
535 | + $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host'])); |
|
536 | 536 | if ($buffer != '') { |
537 | - $all_data = json_decode($buffer,true); |
|
537 | + $all_data = json_decode($buffer, true); |
|
538 | 538 | if (isset($all_data[0]['mmsi'])) { |
539 | 539 | foreach ($all_data as $line) { |
540 | 540 | if ($line != '') { |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | } elseif ($value['format'] == 'boatnerd' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
564 | 564 | $buffer = $Common->getData($value['host']); |
565 | 565 | if ($buffer != '') { |
566 | - $all_data = json_decode($buffer,true); |
|
566 | + $all_data = json_decode($buffer, true); |
|
567 | 567 | if (isset($all_data['features'][0]['id'])) { |
568 | 568 | foreach ($all_data['features'] as $line) { |
569 | 569 | $data = array(); |
@@ -591,27 +591,27 @@ discard block |
||
591 | 591 | $last_exec[$id]['last'] = time(); |
592 | 592 | } elseif ($value['format'] == 'shipplotter' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
593 | 593 | echo 'download...'; |
594 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
594 | + $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter'); |
|
595 | 595 | echo 'done !'."\n"; |
596 | 596 | if ($buffer != '') $reset = 0; |
597 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
598 | - $buffer = explode('\n',$buffer); |
|
597 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
598 | + $buffer = explode('\n', $buffer); |
|
599 | 599 | foreach ($buffer as $line) { |
600 | 600 | if ($line != '') { |
601 | 601 | $data = array(); |
602 | - $data['mmsi'] = (int)substr($line,0,9); |
|
603 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
602 | + $data['mmsi'] = (int) substr($line, 0, 9); |
|
603 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10)); |
|
604 | 604 | //$data['status'] = substr($line,21,2); |
605 | 605 | //$data['type'] = substr($line,24,3); |
606 | - $data['latitude'] = substr($line,29,9); |
|
607 | - $data['longitude'] = substr($line,41,9); |
|
608 | - $data['speed'] = round(substr($line,51,5)); |
|
606 | + $data['latitude'] = substr($line, 29, 9); |
|
607 | + $data['longitude'] = substr($line, 41, 9); |
|
608 | + $data['speed'] = round(substr($line, 51, 5)); |
|
609 | 609 | //$data['course'] = substr($line,57,5); |
610 | - $data['heading'] = round(substr($line,63,3)); |
|
610 | + $data['heading'] = round(substr($line, 63, 3)); |
|
611 | 611 | //$data['draft'] = substr($line,67,4); |
612 | 612 | //$data['length'] = substr($line,72,3); |
613 | 613 | //$data['beam'] = substr($line,76,2); |
614 | - $data['ident'] = trim(utf8_encode(substr($line,79,20))); |
|
614 | + $data['ident'] = trim(utf8_encode(substr($line, 79, 20))); |
|
615 | 615 | //$data['callsign'] = trim(substr($line,100,7); |
616 | 616 | //$data['dest'] = substr($line,108,20); |
617 | 617 | //$data['etaDate'] = substr($line,129,5); |
@@ -630,8 +630,8 @@ discard block |
||
630 | 630 | } elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch))) { |
631 | 631 | //$buffer = $Common->getData($hosts[$id]); |
632 | 632 | $buffer = $Common->getData($value['host']); |
633 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
634 | - $buffer = explode('\n',$buffer); |
|
633 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
634 | + $buffer = explode('\n', $buffer); |
|
635 | 635 | $reset = 0; |
636 | 636 | foreach ($buffer as $line) { |
637 | 637 | if ($line != '') { |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
643 | 643 | $data['pilot_id'] = $line[1]; |
644 | 644 | $data['pilot_name'] = $line[2]; |
645 | - $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
|
645 | + $data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT); |
|
646 | 646 | $data['ident'] = $line[0]; // ident |
647 | 647 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
648 | 648 | $data['speed'] = $line[8]; // speed |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
659 | 659 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
660 | 660 | $data['departure_airport_icao'] = $line[11]; |
661 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
661 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); |
|
662 | 662 | $data['arrival_airport_icao'] = $line[13]; |
663 | 663 | $data['frequency'] = $line[4]; |
664 | 664 | $data['type'] = $line[18]; |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | $data['id_source'] = $id_source; |
668 | 668 | //$data['arrival_airport_time'] = ; |
669 | 669 | if ($line[9] != '') { |
670 | - $aircraft_data = explode('/',$line[9]); |
|
670 | + $aircraft_data = explode('/', $line[9]); |
|
671 | 671 | if (isset($aircraft_data[1])) { |
672 | 672 | $data['aircraft_icao'] = $aircraft_data[1]; |
673 | 673 | } |
@@ -682,9 +682,9 @@ discard block |
||
682 | 682 | if ($line[3] == 'PILOT') $SI->add($data); |
683 | 683 | elseif ($line[3] == 'ATC') { |
684 | 684 | //print_r($data); |
685 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
686 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
687 | - $typec = substr($data['ident'],-3); |
|
685 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
686 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
687 | + $typec = substr($data['ident'], -3); |
|
688 | 688 | if ($typec == 'APP') $data['type'] = 'Approach'; |
689 | 689 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
690 | 690 | elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
@@ -696,8 +696,8 @@ discard block |
||
696 | 696 | elseif ($data['type'] == '') $data['type'] = 'Observer'; |
697 | 697 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
698 | 698 | if (isset($ATC)) { |
699 | - 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']); |
|
700 | - 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']); |
|
699 | + 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']); |
|
700 | + 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']); |
|
701 | 701 | } |
702 | 702 | } |
703 | 703 | unset($data); |
@@ -708,23 +708,23 @@ discard block |
||
708 | 708 | //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
709 | 709 | $last_exec[$id]['last'] = time(); |
710 | 710 | } elseif ($value['format'] == 'airwhere' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
711 | - $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
711 | + $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php', 'get', '', '', '', '', '20'); |
|
712 | 712 | if ($buffer != '') { |
713 | 713 | $all_data = simplexml_load_string($buffer); |
714 | - foreach($all_data->children() as $childdata) { |
|
714 | + foreach ($all_data->children() as $childdata) { |
|
715 | 715 | $data = array(); |
716 | 716 | $line = $childdata; |
717 | 717 | //$data['hex'] = str_pad(dechex((int)$line['pktPilotID']),6,'000000',STR_PAD_LEFT); |
718 | - $data['id'] = date('Ymd').(int)$line['pktPilotID']; |
|
719 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
|
720 | - $data['latitude'] = (float)$line['pktLatitude']; |
|
721 | - $data['longitude'] = (float)$line['pktLongitude']; |
|
722 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
723 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
724 | - $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
|
725 | - $data['pilot_id'] = (int)$line['pktPilotID']; |
|
718 | + $data['id'] = date('Ymd').(int) $line['pktPilotID']; |
|
719 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['entryTime'].' BST')); |
|
720 | + $data['latitude'] = (float) $line['pktLatitude']; |
|
721 | + $data['longitude'] = (float) $line['pktLongitude']; |
|
722 | + if ((float) $line['pktTrack'] != 0) $data['heading'] = (float) $line['pktTrack']; |
|
723 | + if ((int) $line['pktSpeed'] != 0) $data['speed'] = (int) $line['pktSpeed']; |
|
724 | + $data['altitude'] = round((int) $line['pktAltitude']*3.28084); |
|
725 | + $data['pilot_id'] = (int) $line['pktPilotID']; |
|
726 | 726 | $data['aircraft_icao'] = 'PARAGLIDER'; |
727 | - $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
727 | + $pilot_data = explode(',', $Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
728 | 728 | if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
729 | 729 | $data['format_source'] = $value['format']; |
730 | 730 | $SI->add($data); |
@@ -732,30 +732,30 @@ discard block |
||
732 | 732 | } |
733 | 733 | } |
734 | 734 | $Source->deleteOldLocationByType('gs'); |
735 | - $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
735 | + $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php', 'get', '', '', '', '', '20'); |
|
736 | 736 | if ($buffer != '') { |
737 | 737 | $all_data = simplexml_load_string($buffer); |
738 | - foreach($all_data->children() as $childdata) { |
|
738 | + foreach ($all_data->children() as $childdata) { |
|
739 | 739 | $data = array(); |
740 | 740 | $line = $childdata; |
741 | - $data['id'] = (int)$line['gsID']; |
|
742 | - $data['latitude'] = (float)$line['gsLatitude']; |
|
743 | - $data['longitude'] = (float)$line['gsLongitude']; |
|
744 | - $data['altitude'] = round((int)$line['gsHeight']*3.28084); |
|
745 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['gsLastUpdate'].' BST')); |
|
741 | + $data['id'] = (int) $line['gsID']; |
|
742 | + $data['latitude'] = (float) $line['gsLatitude']; |
|
743 | + $data['longitude'] = (float) $line['gsLongitude']; |
|
744 | + $data['altitude'] = round((int) $line['gsHeight']*3.28084); |
|
745 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['gsLastUpdate'].' BST')); |
|
746 | 746 | if (count($Source->getLocationInfoByLocationID($data['id'])) > 0) { |
747 | - $Source->updateLocationByLocationID('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
747 | + $Source->updateLocationByLocationID('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
748 | 748 | } else { |
749 | - $Source->addLocation('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
749 | + $Source->addLocation('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
750 | 750 | } |
751 | 751 | unset($data); |
752 | 752 | } |
753 | 753 | } |
754 | 754 | $last_exec[$id]['last'] = time(); |
755 | 755 | } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
756 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
756 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
757 | 757 | if ($buffer != '') { |
758 | - $all_data = json_decode($buffer,true); |
|
758 | + $all_data = json_decode($buffer, true); |
|
759 | 759 | if (isset($all_data['acList'])) { |
760 | 760 | $reset = 0; |
761 | 761 | foreach ($all_data['acList'] as $line) { |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | $data['emergency'] = ''; // emergency |
773 | 773 | if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
774 | 774 | |
775 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
775 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
776 | 776 | else $data['datetime'] = date('Y-m-d H:i:s'); |
777 | 777 | |
778 | 778 | //$data['datetime'] = date('Y-m-d H:i:s'); |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | $data['verticalrate'] = $line['vrt']; // verticale rate |
799 | 799 | $data['squawk'] = $line['squawk']; // squawk |
800 | 800 | $data['emergency'] = ''; // emergency |
801 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
801 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
802 | 802 | else $data['datetime'] = date('Y-m-d H:i:s'); |
803 | 803 | $data['format_source'] = 'aircraftlistjson'; |
804 | 804 | $data['id_source'] = $id_source; |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
815 | 815 | } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
816 | 816 | $buffer = $Common->getData($value['host']); |
817 | - $all_data = json_decode($buffer,true); |
|
817 | + $all_data = json_decode($buffer, true); |
|
818 | 818 | if (isset($all_data['planes'])) { |
819 | 819 | $reset = 0; |
820 | 820 | foreach ($all_data['planes'] as $key => $line) { |
@@ -831,12 +831,12 @@ discard block |
||
831 | 831 | $data['emergency'] = ''; // emergency |
832 | 832 | $data['registration'] = $line[2]; |
833 | 833 | $data['aircraft_icao'] = $line[0]; |
834 | - $deparr = explode('-',$line[1]); |
|
834 | + $deparr = explode('-', $line[1]); |
|
835 | 835 | if (count($deparr) == 2) { |
836 | 836 | $data['departure_airport_icao'] = $deparr[0]; |
837 | 837 | $data['arrival_airport_icao'] = $deparr[1]; |
838 | 838 | } |
839 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
839 | + $data['datetime'] = date('Y-m-d H:i:s', $line[9]); |
|
840 | 840 | $data['format_source'] = 'planeupdatefaa'; |
841 | 841 | $data['id_source'] = $id_source; |
842 | 842 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | $last_exec[$id]['last'] = time(); |
850 | 850 | } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
851 | 851 | $buffer = $Common->getData($value['host']); |
852 | - $all_data = json_decode($buffer,true); |
|
852 | + $all_data = json_decode($buffer, true); |
|
853 | 853 | if (isset($all_data['states'])) { |
854 | 854 | $reset = 0; |
855 | 855 | foreach ($all_data['states'] as $key => $line) { |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | //$data['emergency'] = ''; // emergency |
867 | 867 | //$data['registration'] = $line[2]; |
868 | 868 | //$data['aircraft_icao'] = $line[0]; |
869 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
869 | + $data['datetime'] = date('Y-m-d H:i:s', $line[3]); |
|
870 | 870 | $data['format_source'] = 'opensky'; |
871 | 871 | $data['id_source'] = $id_source; |
872 | 872 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
881 | 881 | //$buffer = $Common->getData($hosts[$id]); |
882 | 882 | $buffer = $Common->getData($value['host']); |
883 | - $all_data = json_decode($buffer,true); |
|
883 | + $all_data = json_decode($buffer, true); |
|
884 | 884 | if (!empty($all_data)) $reset = 0; |
885 | 885 | foreach ($all_data as $key => $line) { |
886 | 886 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
@@ -913,11 +913,11 @@ discard block |
||
913 | 913 | //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
914 | 914 | } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
915 | 915 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
916 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
916 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); |
|
917 | 917 | //echo $buffer; |
918 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
919 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
920 | - $all_data = json_decode($buffer,true); |
|
918 | + $buffer = str_replace(array("\n", "\r"), "", $buffer); |
|
919 | + $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); |
|
920 | + $all_data = json_decode($buffer, true); |
|
921 | 921 | if (json_last_error() != JSON_ERROR_NONE) { |
922 | 922 | die(json_last_error_msg()); |
923 | 923 | } |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | //$data['departure_airport_iata'] = $line[11]; |
941 | 941 | //$data['arrival_airport_iata'] = $line[12]; |
942 | 942 | //$data['emergency'] = ''; // emergency |
943 | - $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
|
943 | + $data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] |
|
944 | 944 | $data['format_source'] = 'radarvirtueljson'; |
945 | 945 | $data['id_source'] = $id_source; |
946 | 946 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -956,14 +956,14 @@ discard block |
||
956 | 956 | } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
957 | 957 | //$buffer = $Common->getData($hosts[$id]); |
958 | 958 | $buffer = $Common->getData($value['host'].'?'.time()); |
959 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
959 | + $all_data = json_decode(utf8_encode($buffer), true); |
|
960 | 960 | |
961 | 961 | if (isset($all_data['pireps'])) { |
962 | 962 | $reset = 0; |
963 | 963 | foreach ($all_data['pireps'] as $line) { |
964 | 964 | $data = array(); |
965 | 965 | $data['id'] = $line['id']; |
966 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
966 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
967 | 967 | $data['ident'] = $line['callsign']; // ident |
968 | 968 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
969 | 969 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
@@ -993,9 +993,9 @@ discard block |
||
993 | 993 | $SI->add($data); |
994 | 994 | // print_r($data); |
995 | 995 | } elseif ($line['icon'] == 'ct') { |
996 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
997 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
998 | - $typec = substr($data['ident'],-3); |
|
996 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
997 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
998 | + $typec = substr($data['ident'], -3); |
|
999 | 999 | $data['type'] = ''; |
1000 | 1000 | if ($typec == 'APP') $data['type'] = 'Approach'; |
1001 | 1001 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
1007 | 1007 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
1008 | 1008 | else $data['type'] = 'Observer'; |
1009 | - 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']); |
|
1009 | + 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']); |
|
1010 | 1010 | } |
1011 | 1011 | unset($data); |
1012 | 1012 | } |
@@ -1018,14 +1018,14 @@ discard block |
||
1018 | 1018 | //$buffer = $Common->getData($hosts[$id]); |
1019 | 1019 | if ($globalDebug) echo 'Get Data...'."\n"; |
1020 | 1020 | $buffer = $Common->getData($value['host']); |
1021 | - $all_data = json_decode($buffer,true); |
|
1021 | + $all_data = json_decode($buffer, true); |
|
1022 | 1022 | if ($buffer != '' && is_array($all_data)) { |
1023 | 1023 | $reset = 0; |
1024 | 1024 | foreach ($all_data as $line) { |
1025 | 1025 | $data = array(); |
1026 | 1026 | //$data['id'] = $line['id']; // id not usable |
1027 | 1027 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
1028 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1028 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1029 | 1029 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
1030 | 1030 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
1031 | 1031 | $data['ident'] = $line['flightnum']; // ident |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | //$data['datetime'] = $line['lastupdate']; |
1041 | 1041 | //$data['last_update'] = $line['lastupdate']; |
1042 | 1042 | if (isset($value['timezone'])) { |
1043 | - $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
1043 | + $datetime = new DateTime($line['lastupdate'], new DateTimeZone($value['timezone'])); |
|
1044 | 1044 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
1045 | 1045 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1046 | 1046 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1053,14 +1053,14 @@ discard block |
||
1053 | 1053 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
1054 | 1054 | if (isset($line['aircraftname'])) { |
1055 | 1055 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
1056 | - $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
|
1057 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
1056 | + $line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); |
|
1057 | + $aircraft_data = explode('-', $line['aircraftname']); |
|
1058 | 1058 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
1059 | 1059 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
1060 | 1060 | else { |
1061 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
1062 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1063 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1061 | + $aircraft_data = explode(' ', $line['aircraftname']); |
|
1062 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]); |
|
1063 | + else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']); |
|
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | if (isset($line['route'])) $data['waypoints'] = $line['route']; |
@@ -1080,14 +1080,14 @@ discard block |
||
1080 | 1080 | //$buffer = $Common->getData($hosts[$id]); |
1081 | 1081 | if ($globalDebug) echo 'Get Data...'."\n"; |
1082 | 1082 | $buffer = $Common->getData($value['host']); |
1083 | - $all_data = json_decode($buffer,true); |
|
1083 | + $all_data = json_decode($buffer, true); |
|
1084 | 1084 | if ($buffer != '' && is_array($all_data)) { |
1085 | 1085 | $reset = 0; |
1086 | 1086 | foreach ($all_data as $line) { |
1087 | 1087 | $data = array(); |
1088 | 1088 | //$data['id'] = $line['id']; // id not usable |
1089 | 1089 | $data['id'] = trim($line['flight_id']); |
1090 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1090 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1091 | 1091 | $data['pilot_name'] = $line['pilot_name']; |
1092 | 1092 | $data['pilot_id'] = $line['pilot_id']; |
1093 | 1093 | $data['ident'] = trim($line['callsign']); // ident |
@@ -1139,11 +1139,11 @@ discard block |
||
1139 | 1139 | //$value = $formats[$nb]; |
1140 | 1140 | $format = $globalSources[$nb]['format']; |
1141 | 1141 | if ($format == 'sbs' || $format == 'aprs' || $format == 'famaprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
1142 | - $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); |
|
1142 | + $buffer = @socket_read($r, 6000, PHP_NORMAL_READ); |
|
1143 | 1143 | } elseif ($format == 'vrstcp') { |
1144 | 1144 | $buffer = @socket_read($r, 6000); |
1145 | 1145 | } else { |
1146 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
1146 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); |
|
1147 | 1147 | } |
1148 | 1148 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
1149 | 1149 | //echo $buffer."\n"; |
@@ -1152,8 +1152,8 @@ discard block |
||
1152 | 1152 | $error = false; |
1153 | 1153 | //$SI::del(); |
1154 | 1154 | if ($format == 'vrstcp') { |
1155 | - $buffer = explode('},{',$buffer); |
|
1156 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1155 | + $buffer = explode('},{', $buffer); |
|
1156 | + } else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); |
|
1157 | 1157 | // SBS format is CSV format |
1158 | 1158 | if ($buffer !== FALSE && $buffer != '') { |
1159 | 1159 | $tt[$format] = 0; |
@@ -1187,13 +1187,13 @@ discard block |
||
1187 | 1187 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
1188 | 1188 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
1189 | 1189 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
1190 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1190 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
1191 | 1191 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1192 | 1192 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
1193 | 1193 | if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
1194 | 1194 | |
1195 | 1195 | if (isset($ais_data['timestamp'])) { |
1196 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
1196 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
1197 | 1197 | } else { |
1198 | 1198 | $data['datetime'] = date('Y-m-d H:i:s'); |
1199 | 1199 | } |
@@ -1204,10 +1204,10 @@ discard block |
||
1204 | 1204 | } elseif ($format == 'flightgearsp') { |
1205 | 1205 | //echo $buffer."\n"; |
1206 | 1206 | if (strlen($buffer) > 5) { |
1207 | - $line = explode(',',$buffer); |
|
1207 | + $line = explode(',', $buffer); |
|
1208 | 1208 | $data = array(); |
1209 | 1209 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
1210 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); |
|
1210 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1211 | 1211 | $data['ident'] = $line[6]; |
1212 | 1212 | $data['aircraft_name'] = $line[7]; |
1213 | 1213 | $data['longitude'] = $line[1]; |
@@ -1224,16 +1224,16 @@ discard block |
||
1224 | 1224 | } elseif ($format == 'acars') { |
1225 | 1225 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
1226 | 1226 | $ACARS->add(trim($buffer)); |
1227 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
1227 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
1228 | 1228 | $ACARS->deleteLiveAcarsData(); |
1229 | 1229 | } elseif ($format == 'flightgearmp') { |
1230 | - if (substr($buffer,0,1) != '#') { |
|
1230 | + if (substr($buffer, 0, 1) != '#') { |
|
1231 | 1231 | $data = array(); |
1232 | 1232 | //echo $buffer."\n"; |
1233 | - $line = explode(' ',$buffer); |
|
1233 | + $line = explode(' ', $buffer); |
|
1234 | 1234 | if (count($line) == 11) { |
1235 | - $userserver = explode('@',$line[0]); |
|
1236 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
1235 | + $userserver = explode('@', $line[0]); |
|
1236 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex |
|
1237 | 1237 | $data['ident'] = $userserver[0]; |
1238 | 1238 | $data['registration'] = $userserver[0]; |
1239 | 1239 | $data['latitude'] = $line[4]; |
@@ -1241,8 +1241,8 @@ discard block |
||
1241 | 1241 | $data['altitude'] = $line[6]; |
1242 | 1242 | $data['datetime'] = date('Y-m-d H:i:s'); |
1243 | 1243 | $aircraft_type = $line[10]; |
1244 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
1245 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
1244 | + $aircraft_type = preg_split(':/:', $aircraft_type); |
|
1245 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); |
|
1246 | 1246 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1247 | 1247 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
1248 | 1248 | } |
@@ -1251,8 +1251,8 @@ discard block |
||
1251 | 1251 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
1252 | 1252 | die; |
1253 | 1253 | } elseif ($format == 'vrstcp') { |
1254 | - foreach($buffer as $all_data) { |
|
1255 | - $line = json_decode('{'.$all_data.'}',true); |
|
1254 | + foreach ($buffer as $all_data) { |
|
1255 | + $line = json_decode('{'.$all_data.'}', true); |
|
1256 | 1256 | $data = array(); |
1257 | 1257 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
1258 | 1258 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
@@ -1278,16 +1278,16 @@ discard block |
||
1278 | 1278 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
1279 | 1279 | unset($data); |
1280 | 1280 | } |
1281 | - } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
|
1281 | + } elseif ($format == 'tsv' || substr($buffer, 0, 4) == 'clock') { |
|
1282 | 1282 | $line = explode("\t", $buffer); |
1283 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
1283 | + for ($k = 0; $k < count($line); $k = $k + 2) { |
|
1284 | 1284 | $key = $line[$k]; |
1285 | - $lined[$key] = $line[$k+1]; |
|
1285 | + $lined[$key] = $line[$k + 1]; |
|
1286 | 1286 | } |
1287 | 1287 | if (count($lined) > 3) { |
1288 | 1288 | $data['hex'] = $lined['hexid']; |
1289 | 1289 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
1290 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
1290 | + $data['datetime'] = date('Y-m-d H:i:s'); ; |
|
1291 | 1291 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
1292 | 1292 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
1293 | 1293 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
@@ -1306,22 +1306,22 @@ discard block |
||
1306 | 1306 | } else $error = true; |
1307 | 1307 | } elseif ($format == 'aprs' && $use_aprs) { |
1308 | 1308 | if ($aprs_connect == 0) { |
1309 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
|
1309 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); |
|
1310 | 1310 | $aprs_connect = 1; |
1311 | 1311 | } |
1312 | 1312 | |
1313 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
1313 | + if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { |
|
1314 | 1314 | $aprs_last_tx = time(); |
1315 | 1315 | $data_aprs = "# Keep alive"; |
1316 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
1316 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
1317 | 1317 | } |
1318 | 1318 | |
1319 | 1319 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
1320 | 1320 | //echo 'APRS data : '.$buffer."\n"; |
1321 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
1322 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
1321 | + $buffer = str_replace('APRS <- ', '', $buffer); |
|
1322 | + $buffer = str_replace('APRS -> ', '', $buffer); |
|
1323 | 1323 | //echo $buffer."\n"; |
1324 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
1324 | + if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { |
|
1325 | 1325 | $line = $APRS->parse($buffer); |
1326 | 1326 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
1327 | 1327 | if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) { |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date']; |
1337 | 1337 | if (isset($line['type_id'])) $data['type_id'] = $line['typeid']; |
1338 | 1338 | if (isset($line['status_id'])) $data['status_id'] = $line['statusid']; |
1339 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1339 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); |
|
1340 | 1340 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1341 | 1341 | //$data['datetime'] = date('Y-m-d H:i:s'); |
1342 | 1342 | if (isset($line['ident'])) $data['ident'] = $line['ident']; |
@@ -1382,9 +1382,9 @@ discard block |
||
1382 | 1382 | if (!isset($data['altitude'])) $data['altitude'] = 0; |
1383 | 1383 | $Source->deleteOldLocationByType('gs'); |
1384 | 1384 | if (count($Source->getLocationInfoByName($data['ident'])) > 0) { |
1385 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
1385 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
1386 | 1386 | } else { |
1387 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
1387 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
1388 | 1388 | } |
1389 | 1389 | } else { |
1390 | 1390 | echo '/!\ Not added'."\n"; |
@@ -1397,7 +1397,7 @@ discard block |
||
1397 | 1397 | } |
1398 | 1398 | |
1399 | 1399 | elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
1400 | - $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
|
1400 | + $Source->updateLocationDescByName($line['ident'], $line['source'], $id, $line['comment']); |
|
1401 | 1401 | } |
1402 | 1402 | /* |
1403 | 1403 | 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')) { |
@@ -1484,7 +1484,7 @@ discard block |
||
1484 | 1484 | connect_all($sourceee); |
1485 | 1485 | $sourceee = array(); |
1486 | 1486 | //connect_all($globalSources); |
1487 | - $tt[$format]=0; |
|
1487 | + $tt[$format] = 0; |
|
1488 | 1488 | break; |
1489 | 1489 | } |
1490 | 1490 | } |
@@ -1493,14 +1493,14 @@ discard block |
||
1493 | 1493 | } else { |
1494 | 1494 | $error = socket_strerror(socket_last_error()); |
1495 | 1495 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
1496 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
1496 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; |
|
1497 | 1497 | if (isset($globalDebug)) echo "Restarting...\n"; |
1498 | 1498 | // Restart the script if possible |
1499 | 1499 | if (is_array($sockets)) { |
1500 | 1500 | if ($globalDebug) echo "Shutdown all sockets..."; |
1501 | 1501 | |
1502 | 1502 | foreach ($sockets as $sock) { |
1503 | - @socket_shutdown($sock,2); |
|
1503 | + @socket_shutdown($sock, 2); |
|
1504 | 1504 | @socket_close($sock); |
1505 | 1505 | } |
1506 | 1506 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | require_once(dirname(__FILE__).'/class.create_db.php'); |
11 | 11 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
12 | 12 | require_once(dirname(__FILE__).'/class.settings.php'); |
13 | -$title="Install"; |
|
13 | +$title = "Install"; |
|
14 | 14 | require(dirname(__FILE__).'/../require/settings.php'); |
15 | 15 | require(dirname(__FILE__).'/header.php'); |
16 | 16 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | if (!extension_loaded('curl')) { |
70 | 70 | $error[] = "Curl is not loaded."; |
71 | 71 | } |
72 | -if(function_exists('apache_get_modules') ){ |
|
73 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
72 | +if (function_exists('apache_get_modules')) { |
|
73 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
74 | 74 | $error[] = "mod_rewrite is not available."; |
75 | 75 | } |
76 | 76 | /* |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>'; |
87 | 87 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
88 | 88 | if (function_exists('get_headers')) { |
89 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
90 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
89 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
90 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
91 | 91 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
92 | 92 | } |
93 | 93 | } |
@@ -452,13 +452,13 @@ discard block |
||
452 | 452 | ?> |
453 | 453 | <tr> |
454 | 454 | <?php |
455 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
455 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
456 | 456 | ?> |
457 | 457 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
458 | 458 | <td><input type="number" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
459 | 459 | <?php |
460 | 460 | } else { |
461 | - $hostport = explode(':',$source['host']); |
|
461 | + $hostport = explode(':', $source['host']); |
|
462 | 462 | if (isset($hostport[1])) { |
463 | 463 | $host = $hostport[0]; |
464 | 464 | $port = $hostport[1]; |
@@ -502,9 +502,9 @@ discard block |
||
502 | 502 | <td> |
503 | 503 | <select name="timezone[]" id="timezone"> |
504 | 504 | <?php |
505 | - foreach(timezone_abbreviations_list() as $abbr => $timezone){ |
|
506 | - foreach($timezone as $val){ |
|
507 | - if(isset($val['timezone_id'])){ |
|
505 | + foreach (timezone_abbreviations_list() as $abbr => $timezone) { |
|
506 | + foreach ($timezone as $val) { |
|
507 | + if (isset($val['timezone_id'])) { |
|
508 | 508 | if (isset($source['timezone']) && $source['timezone'] == $val['timezone_id']) { |
509 | 509 | print '<option selected>'.$val['timezone_id'].'</option>'; |
510 | 510 | } elseif (!isset($source['timezone']) && $val['timezone_id'] == 'UTC') { |
@@ -555,9 +555,9 @@ discard block |
||
555 | 555 | <td> |
556 | 556 | <select name="timezone[]" id="timezone"> |
557 | 557 | <?php |
558 | - foreach(timezone_abbreviations_list() as $abbr => $timezone){ |
|
559 | - foreach($timezone as $val){ |
|
560 | - if(isset($val['timezone_id'])){ |
|
558 | + foreach (timezone_abbreviations_list() as $abbr => $timezone) { |
|
559 | + foreach ($timezone as $val) { |
|
560 | + if (isset($val['timezone_id'])) { |
|
561 | 561 | if ($val['timezone_id'] == 'UTC') { |
562 | 562 | print '<option selected>'.$val['timezone_id'].'</option>'; |
563 | 563 | } else print '<option>'.$val['timezone_id'].'</option>'; |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | <br /> |
854 | 854 | <p> |
855 | 855 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
856 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
856 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
857 | 857 | </p> |
858 | 858 | <br /> |
859 | 859 | <p> |
@@ -909,14 +909,14 @@ discard block |
||
909 | 909 | $error = ''; |
910 | 910 | |
911 | 911 | if (isset($_POST['dbtype'])) { |
912 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
913 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
914 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
915 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
916 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
917 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
918 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
919 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
912 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
913 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
914 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
915 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
916 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
917 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
918 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
919 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
920 | 920 | |
921 | 921 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
922 | 922 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -936,49 +936,49 @@ discard block |
||
936 | 936 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
937 | 937 | */ |
938 | 938 | |
939 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
939 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
940 | 940 | |
941 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
942 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
943 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
944 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
945 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
941 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
942 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
943 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
944 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
945 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
946 | 946 | |
947 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
948 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
949 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
950 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
951 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
952 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
953 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
954 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
955 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
956 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
947 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
948 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
949 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
950 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
951 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
952 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
953 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
954 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
955 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
956 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
957 | 957 | |
958 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
959 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
960 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
961 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
962 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
963 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
958 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
959 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
960 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
961 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
962 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
963 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
964 | 964 | |
965 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
966 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
965 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
966 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
967 | 967 | |
968 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
969 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
970 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
968 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
969 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
970 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
971 | 971 | |
972 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
972 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
973 | 973 | if ($acars == 'acars') { |
974 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
974 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
975 | 975 | } else { |
976 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
976 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
977 | 977 | } |
978 | 978 | |
979 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
980 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
981 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
979 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
980 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
981 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
982 | 982 | |
983 | 983 | $source_name = $_POST['source_name']; |
984 | 984 | $source_latitude = $_POST['source_latitude']; |
@@ -992,8 +992,8 @@ discard block |
||
992 | 992 | |
993 | 993 | $sources = array(); |
994 | 994 | foreach ($source_name as $keys => $name) { |
995 | - 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]); |
|
996 | - 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]); |
|
995 | + 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]); |
|
996 | + 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]); |
|
997 | 997 | } |
998 | 998 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
999 | 999 | |
@@ -1006,24 +1006,24 @@ discard block |
||
1006 | 1006 | $sbsurl = $_POST['sbsurl']; |
1007 | 1007 | */ |
1008 | 1008 | |
1009 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1010 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1011 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1012 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1013 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1014 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1015 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1016 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1009 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1010 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1011 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1012 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1013 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1014 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1015 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1016 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1017 | 1017 | |
1018 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1019 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1020 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1021 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1022 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1023 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1024 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1025 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1026 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1018 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1019 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1020 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1021 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1022 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1023 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1024 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1025 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1026 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1027 | 1027 | |
1028 | 1028 | /* |
1029 | 1029 | $globalSBS1Hosts = array(); |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | } |
1040 | 1040 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1041 | 1041 | */ |
1042 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1042 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1043 | 1043 | $host = $_POST['host']; |
1044 | 1044 | $port = $_POST['port']; |
1045 | 1045 | $name = $_POST['name']; |
@@ -1056,100 +1056,100 @@ discard block |
||
1056 | 1056 | else $cov = 'FALSE'; |
1057 | 1057 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1058 | 1058 | else $arch = 'FALSE'; |
1059 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezone[$key]); |
|
1059 | + if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezone[$key]); |
|
1060 | 1060 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1061 | 1061 | } |
1062 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1062 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1063 | 1063 | |
1064 | 1064 | /* |
1065 | 1065 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1066 | 1066 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1067 | 1067 | */ |
1068 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1069 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1070 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1068 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1069 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1070 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1071 | 1071 | |
1072 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1073 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1072 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1073 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1074 | 1074 | |
1075 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1076 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1075 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1076 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1077 | 1077 | |
1078 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1079 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1080 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1081 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1078 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1079 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1080 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1081 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1082 | 1082 | |
1083 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1084 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1085 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1083 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1084 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1085 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1086 | 1086 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1087 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1088 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1087 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1088 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1089 | 1089 | |
1090 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1091 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1092 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1093 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1094 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1095 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1096 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1097 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1090 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1091 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1092 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1093 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1094 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1095 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1096 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1097 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1098 | 1098 | |
1099 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1100 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1099 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1100 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1101 | 1101 | |
1102 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1103 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1102 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1103 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1104 | 1104 | |
1105 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1105 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1106 | 1106 | if ($archiveyear == "archiveyear") { |
1107 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1107 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1108 | 1108 | } else { |
1109 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1109 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1110 | 1110 | } |
1111 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1112 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1113 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1114 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1111 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1112 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1113 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1114 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1115 | 1115 | |
1116 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1117 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1118 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1119 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1116 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1117 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1118 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1119 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1120 | 1120 | |
1121 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1122 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1123 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1121 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1122 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1123 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1124 | 1124 | |
1125 | 1125 | // Create in settings.php keys not yet configurable if not already here |
1126 | 1126 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1127 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1127 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1128 | 1128 | |
1129 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1129 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1130 | 1130 | if ($resetyearstats == 'resetyearstats') { |
1131 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1131 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1132 | 1132 | } else { |
1133 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1133 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1134 | 1134 | } |
1135 | 1135 | |
1136 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1136 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1137 | 1137 | if ($archive == 'archive') { |
1138 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1138 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1139 | 1139 | } else { |
1140 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1140 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1141 | 1141 | } |
1142 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1142 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1143 | 1143 | if ($daemon == 'daemon') { |
1144 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1144 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1145 | 1145 | } else { |
1146 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1146 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1147 | 1147 | } |
1148 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1148 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1149 | 1149 | if ($schedules == 'schedules') { |
1150 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1150 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1151 | 1151 | } else { |
1152 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1152 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | /* |
@@ -1160,218 +1160,218 @@ discard block |
||
1160 | 1160 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1161 | 1161 | } |
1162 | 1162 | */ |
1163 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1164 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1165 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1166 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1167 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1163 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1164 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1165 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1166 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1167 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1168 | 1168 | $va = false; |
1169 | 1169 | if ($globalivao == 'ivao') { |
1170 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1170 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1171 | 1171 | $va = true; |
1172 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1172 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1173 | 1173 | if ($globalvatsim == 'vatsim') { |
1174 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1174 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1175 | 1175 | $va = true; |
1176 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1176 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1177 | 1177 | if ($globalphpvms == 'phpvms') { |
1178 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1178 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1179 | 1179 | $va = true; |
1180 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1180 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1181 | 1181 | if ($globalvam == 'vam') { |
1182 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1182 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1183 | 1183 | $va = true; |
1184 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1184 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1185 | 1185 | if ($va) { |
1186 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1187 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1186 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1187 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1188 | 1188 | if ($globalva == 'va' || $va) { |
1189 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1190 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1189 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1190 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1191 | 1191 | } else { |
1192 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1193 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1194 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1192 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1193 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1194 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | |
1198 | 1198 | |
1199 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1199 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1200 | 1200 | if ($notam == 'notam') { |
1201 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1201 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1202 | 1202 | } else { |
1203 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1203 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1204 | 1204 | } |
1205 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1205 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1206 | 1206 | if ($owner == 'owner') { |
1207 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1207 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1208 | 1208 | } else { |
1209 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1209 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1210 | 1210 | } |
1211 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1211 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1212 | 1212 | if ($map3d == 'map3d') { |
1213 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1213 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1214 | 1214 | } else { |
1215 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1215 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1216 | 1216 | } |
1217 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1217 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1218 | 1218 | if ($crash == 'crash') { |
1219 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1219 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1220 | 1220 | } else { |
1221 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1221 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1222 | 1222 | } |
1223 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1223 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1224 | 1224 | if ($mapsatellites == 'mapsatellites') { |
1225 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1225 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1226 | 1226 | } else { |
1227 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1227 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1228 | 1228 | } |
1229 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1229 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1230 | 1230 | if ($map3ddefault == 'map3ddefault') { |
1231 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1231 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1232 | 1232 | } else { |
1233 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1233 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1234 | 1234 | } |
1235 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1235 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1236 | 1236 | if ($translate == 'translate') { |
1237 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1237 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1238 | 1238 | } else { |
1239 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1239 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1240 | 1240 | } |
1241 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1241 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1242 | 1242 | if ($realairlines == 'realairlines') { |
1243 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1243 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1244 | 1244 | } else { |
1245 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1245 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1246 | 1246 | } |
1247 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1247 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1248 | 1248 | if ($estimation == 'estimation') { |
1249 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1249 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1250 | 1250 | } else { |
1251 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1251 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1252 | 1252 | } |
1253 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1253 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1254 | 1254 | if ($metar == 'metar') { |
1255 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1255 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1256 | 1256 | } else { |
1257 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1257 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1258 | 1258 | } |
1259 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1259 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1260 | 1260 | if ($metarcycle == 'metarcycle') { |
1261 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1261 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1262 | 1262 | } else { |
1263 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1263 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1264 | 1264 | } |
1265 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1265 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1266 | 1266 | if ($fork == 'fork') { |
1267 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1267 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1268 | 1268 | } else { |
1269 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1269 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1270 | 1270 | } |
1271 | 1271 | |
1272 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1272 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1273 | 1273 | if ($colormap == 'colormap') { |
1274 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1274 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1275 | 1275 | } else { |
1276 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1276 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1277 | 1277 | } |
1278 | 1278 | |
1279 | 1279 | if (isset($_POST['aircrafticoncolor'])) { |
1280 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1281 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1280 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1281 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1282 | 1282 | } |
1283 | 1283 | |
1284 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1285 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1284 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1285 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1286 | 1286 | |
1287 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1288 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1289 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1290 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1291 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1292 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1287 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1288 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1289 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1290 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1291 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1292 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1293 | 1293 | |
1294 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1294 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1295 | 1295 | if ($mappopup == 'mappopup') { |
1296 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1296 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1297 | 1297 | } else { |
1298 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1298 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1299 | 1299 | } |
1300 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1300 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1301 | 1301 | if ($airportpopup == 'airportpopup') { |
1302 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1302 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1303 | 1303 | } else { |
1304 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1304 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1305 | 1305 | } |
1306 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1306 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1307 | 1307 | if ($maphistory == 'maphistory') { |
1308 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1308 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1309 | 1309 | } else { |
1310 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1310 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1311 | 1311 | } |
1312 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1312 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1313 | 1313 | if ($maptooltip == 'maptooltip') { |
1314 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1314 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1315 | 1315 | } else { |
1316 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1316 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1317 | 1317 | } |
1318 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1318 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1319 | 1319 | if ($flightroute == 'flightroute') { |
1320 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1320 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1321 | 1321 | } else { |
1322 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1322 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1323 | 1323 | } |
1324 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1324 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1325 | 1325 | if ($flightremainingroute == 'flightremainingroute') { |
1326 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1326 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1327 | 1327 | } else { |
1328 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1328 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1329 | 1329 | } |
1330 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1330 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1331 | 1331 | if ($allflights == 'allflights') { |
1332 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1332 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1333 | 1333 | } else { |
1334 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1334 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1335 | 1335 | } |
1336 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1336 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1337 | 1337 | if ($bbox == 'bbox') { |
1338 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1338 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1339 | 1339 | } else { |
1340 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1340 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1341 | 1341 | } |
1342 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1342 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1343 | 1343 | if ($groundaltitude == 'groundaltitude') { |
1344 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1344 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1345 | 1345 | } else { |
1346 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1346 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1347 | 1347 | } |
1348 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1348 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1349 | 1349 | if ($waypoints == 'waypoints') { |
1350 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1350 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1351 | 1351 | } else { |
1352 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1352 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1353 | 1353 | } |
1354 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1354 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1355 | 1355 | if ($noairlines == 'noairlines') { |
1356 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1356 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1357 | 1357 | } else { |
1358 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1358 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1359 | 1359 | } |
1360 | 1360 | |
1361 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1361 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1362 | 1362 | |
1363 | 1363 | // Set some defaults values... |
1364 | 1364 | if (!isset($globalAircraftImageSources)) { |
1365 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1366 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1365 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1366 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1367 | 1367 | } |
1368 | 1368 | |
1369 | 1369 | if (!isset($globalSchedulesSources)) { |
1370 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1371 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1370 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1371 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1372 | 1372 | } |
1373 | 1373 | |
1374 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1374 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1375 | 1375 | |
1376 | 1376 | if ($error == '') settings::modify_settings($settings); |
1377 | 1377 | if ($error == '') settings::comment_settings($settings_comment); |