@@ -190,12 +190,20 @@ |
||
190 | 190 | return 1; |
191 | 191 | } |
192 | 192 | |
193 | + /** |
|
194 | + * @param double $lat |
|
195 | + * @param integer $isodd |
|
196 | + */ |
|
193 | 197 | private function cprN($lat,$isodd) { |
194 | 198 | $nl = $this->cprNL($lat) - $isodd; |
195 | 199 | if ($nl > 1) return $nl; |
196 | 200 | else return 1; |
197 | 201 | } |
198 | 202 | |
203 | + /** |
|
204 | + * @param string $msg |
|
205 | + * @param string $bin |
|
206 | + */ |
|
199 | 207 | private function parityCheck($msg, $bin) { |
200 | 208 | $modes_checksum_table = array( |
201 | 209 | 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178, |
@@ -198,20 +198,20 @@ |
||
198 | 198 | |
199 | 199 | private function parityCheck($msg, $bin) { |
200 | 200 | $modes_checksum_table = array( |
201 | - 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178, |
|
202 | - 0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14, |
|
203 | - 0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449, |
|
204 | - 0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22, |
|
205 | - 0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7, |
|
206 | - 0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612, |
|
207 | - 0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace, |
|
208 | - 0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53, |
|
209 | - 0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441, |
|
210 | - 0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80, |
|
211 | - 0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409, |
|
212 | - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
213 | - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
214 | - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 |
|
201 | + 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178, |
|
202 | + 0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14, |
|
203 | + 0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449, |
|
204 | + 0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22, |
|
205 | + 0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7, |
|
206 | + 0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612, |
|
207 | + 0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace, |
|
208 | + 0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53, |
|
209 | + 0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441, |
|
210 | + 0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80, |
|
211 | + 0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409, |
|
212 | + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
213 | + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
214 | + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 |
|
215 | 215 | ); |
216 | 216 | $crc = 0; |
217 | 217 | $checksum = intval(substr($msg,22,6),16); |
@@ -18,82 +18,82 @@ discard block |
||
18 | 18 | public function parse($buffer) { |
19 | 19 | // Not yet finished, no CRC checks |
20 | 20 | $data = array(); |
21 | - $typehex = substr($buffer,0,1); |
|
22 | - if ($typehex == '*' || $typehex == ':') $hex = substr($buffer,1,-1); |
|
23 | - elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer,13,-13); |
|
24 | - else $hex = substr($buffer,1,-1); |
|
25 | - $bin = gmp_strval( gmp_init($hex,16), 2); |
|
21 | + $typehex = substr($buffer, 0, 1); |
|
22 | + if ($typehex == '*' || $typehex == ':') $hex = substr($buffer, 1, -1); |
|
23 | + elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer, 13, -13); |
|
24 | + else $hex = substr($buffer, 1, -1); |
|
25 | + $bin = gmp_strval(gmp_init($hex, 16), 2); |
|
26 | 26 | //if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) { |
27 | 27 | if (strlen($hex) == 28) { |
28 | - $df = intval(substr($bin,0,5),2); |
|
28 | + $df = intval(substr($bin, 0, 5), 2); |
|
29 | 29 | //$ca = intval(substr($bin,5,3),2); |
30 | 30 | // Only support DF17 for now |
31 | 31 | //if ($df == 17 || ($df == 18 && ($ca == 0 || $ca == 1 || $ca == 6))) { |
32 | - if (($df == 17 || $df == 18) && ($this->parityCheck($hex,$bin) || $typehex == '@')) { |
|
33 | - $icao = substr($hex,2,6); |
|
32 | + if (($df == 17 || $df == 18) && ($this->parityCheck($hex, $bin) || $typehex == '@')) { |
|
33 | + $icao = substr($hex, 2, 6); |
|
34 | 34 | $data['hex'] = $icao; |
35 | - $tc = intval(substr($bin,32,5),2); |
|
35 | + $tc = intval(substr($bin, 32, 5), 2); |
|
36 | 36 | if ($tc >= 1 && $tc <= 4) { |
37 | 37 | //callsign |
38 | - $csbin = substr($bin,40,56); |
|
38 | + $csbin = substr($bin, 40, 56); |
|
39 | 39 | $charset = str_split('#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######'); |
40 | 40 | $cs = ''; |
41 | - $cs .= $charset[intval(substr($csbin,0,6),2)]; |
|
42 | - $cs .= $charset[intval(substr($csbin,6,6),2)]; |
|
43 | - $cs .= $charset[intval(substr($csbin,12,6),2)]; |
|
44 | - $cs .= $charset[intval(substr($csbin,18,6),2)]; |
|
45 | - $cs .= $charset[intval(substr($csbin,24,6),2)]; |
|
46 | - $cs .= $charset[intval(substr($csbin,30,6),2)]; |
|
47 | - $cs .= $charset[intval(substr($csbin,36,6),2)]; |
|
48 | - $cs .= $charset[intval(substr($csbin,42,6),2)]; |
|
49 | - $cs = str_replace('_','',$cs); |
|
50 | - $cs = str_replace('#','',$cs); |
|
41 | + $cs .= $charset[intval(substr($csbin, 0, 6), 2)]; |
|
42 | + $cs .= $charset[intval(substr($csbin, 6, 6), 2)]; |
|
43 | + $cs .= $charset[intval(substr($csbin, 12, 6), 2)]; |
|
44 | + $cs .= $charset[intval(substr($csbin, 18, 6), 2)]; |
|
45 | + $cs .= $charset[intval(substr($csbin, 24, 6), 2)]; |
|
46 | + $cs .= $charset[intval(substr($csbin, 30, 6), 2)]; |
|
47 | + $cs .= $charset[intval(substr($csbin, 36, 6), 2)]; |
|
48 | + $cs .= $charset[intval(substr($csbin, 42, 6), 2)]; |
|
49 | + $cs = str_replace('_', '', $cs); |
|
50 | + $cs = str_replace('#', '', $cs); |
|
51 | 51 | $callsign = $cs; |
52 | 52 | $data['ident'] = $callsign; |
53 | 53 | } elseif ($tc >= 9 && $tc <= 18) { |
54 | 54 | // Check Q-bit |
55 | - $q = substr($bin,47,1); |
|
55 | + $q = substr($bin, 47, 1); |
|
56 | 56 | if ($q) { |
57 | - $n = intval(substr($bin,40,7).substr($bin,48,4),2); |
|
58 | - $alt = $n*25-1000; |
|
57 | + $n = intval(substr($bin, 40, 7).substr($bin, 48, 4), 2); |
|
58 | + $alt = $n*25 - 1000; |
|
59 | 59 | $data['altitude'] = $alt; |
60 | 60 | } |
61 | 61 | // Check odd/even flag |
62 | - $oe = substr($bin,53,1); |
|
62 | + $oe = substr($bin, 53, 1); |
|
63 | 63 | //if ($oe) => odd else even |
64 | 64 | // 131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits. |
65 | - $cprlat = intval(substr($bin,54,17),2)/131072.0; |
|
66 | - $cprlon = intval(substr($bin,71,17),2)/131072.0; |
|
67 | - if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time()); |
|
65 | + $cprlat = intval(substr($bin, 54, 17), 2)/131072.0; |
|
66 | + $cprlon = intval(substr($bin, 71, 17), 2)/131072.0; |
|
67 | + if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat, 'longitude' => $cprlon, 'created' => time()); |
|
68 | 68 | elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) { |
69 | 69 | $cprlat_odd = $cprlat; |
70 | 70 | $cprlon_odd = $cprlon; |
71 | 71 | $cprlat_even = $this::$latlon[$icao]['latitude']; |
72 | 72 | $cprlon_even = $this::$latlon[$icao]['longitude']; |
73 | - $j = 59*$cprlat_even-60*$cprlat_odd+0.5; |
|
74 | - $lat_even = (360.0/60)*($j%60+$cprlat_even); |
|
75 | - $lat_odd = (360.0/59)*($j%59+$cprlat_odd); |
|
73 | + $j = 59*$cprlat_even - 60*$cprlat_odd + 0.5; |
|
74 | + $lat_even = (360.0/60)*($j%60 + $cprlat_even); |
|
75 | + $lat_odd = (360.0/59)*($j%59 + $cprlat_odd); |
|
76 | 76 | if ($lat_even >= 270) $lat_even = $lat_even - 360; |
77 | 77 | if ($lat_odd >= 270) $lat_odd = $lat_odd - 360; |
78 | 78 | // check latitude zone |
79 | 79 | if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) { |
80 | 80 | if ($this::$latlon[$icao]['created'] > time()) { |
81 | - $ni = $this->cprN($lat_even,0); |
|
82 | - $m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5); |
|
83 | - $lon = (360.0/$ni)*($m%$ni+$cprlon_even); |
|
81 | + $ni = $this->cprN($lat_even, 0); |
|
82 | + $m = floor($cprlon_even*($this->cprNL($lat_even) - 1) - $cprlon_odd*$this->cprNL($lat_even) + 0.5); |
|
83 | + $lon = (360.0/$ni)*($m%$ni + $cprlon_even); |
|
84 | 84 | $lat = $lat_even; |
85 | - if ($lon > 180) $lon = $lon -360; |
|
85 | + if ($lon > 180) $lon = $lon - 360; |
|
86 | 86 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
87 | 87 | //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon; |
88 | 88 | $data['latitude'] = $lat; |
89 | 89 | $data['longitude'] = $lon; |
90 | 90 | } |
91 | 91 | } else { |
92 | - $ni = $this->cprN($lat_odd,1); |
|
93 | - $m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5); |
|
94 | - $lon = (360.0/$ni)*($m%$ni+$cprlon_odd); |
|
92 | + $ni = $this->cprN($lat_odd, 1); |
|
93 | + $m = floor($cprlon_even*($this->cprNL($lat_odd) - 1) - $cprlon_odd*$this->cprNL($lat_odd) + 0.5); |
|
94 | + $lon = (360.0/$ni)*($m%$ni + $cprlon_odd); |
|
95 | 95 | $lat = $lat_odd; |
96 | - if ($lon > 180) $lon = $lon -360; |
|
96 | + if ($lon > 180) $lon = $lon - 360; |
|
97 | 97 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
98 | 98 | //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n"; |
99 | 99 | $data['latitude'] = $lat; |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | } |
106 | 106 | } elseif ($tc == 19) { |
107 | 107 | // speed & heading |
108 | - $v_ew_dir = intval(substr($bin,45,1)); |
|
109 | - $v_ew = intval(substr($bin,46,10),2); |
|
110 | - $v_ns_dir = intval(substr($bin,56,1)); |
|
111 | - $v_ns = intval(substr($bin,57,10),2); |
|
108 | + $v_ew_dir = intval(substr($bin, 45, 1)); |
|
109 | + $v_ew = intval(substr($bin, 46, 10), 2); |
|
110 | + $v_ns_dir = intval(substr($bin, 56, 1)); |
|
111 | + $v_ns = intval(substr($bin, 57, 10), 2); |
|
112 | 112 | if ($v_ew_dir) $v_ew = -1*$v_ew; |
113 | 113 | if ($v_ns_dir) $v_ns = -1*$v_ns; |
114 | - $speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew); |
|
115 | - $heading = atan2($v_ew,$v_ns)*360.0/(2*pi()); |
|
116 | - if ($heading <0) $heading = $heading+360; |
|
114 | + $speed = sqrt($v_ns*$v_ns + $v_ew*$v_ew); |
|
115 | + $heading = atan2($v_ew, $v_ns)*360.0/(2*pi()); |
|
116 | + if ($heading < 0) $heading = $heading + 360; |
|
117 | 117 | $data['speed'] = $speed; |
118 | 118 | $data['heading'] = $heading; |
119 | 119 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * Lookup table to convert the latitude to index. |
129 | 129 | */ |
130 | 130 | private function cprNL($lat) { |
131 | - if ($lat < 0) $lat = -$lat; // Table is simmetric about the equator. |
|
131 | + if ($lat < 0) $lat = -$lat; // Table is simmetric about the equator. |
|
132 | 132 | if ($lat < 10.47047130) return 59; |
133 | 133 | if ($lat < 14.82817437) return 58; |
134 | 134 | if ($lat < 18.18626357) return 57; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | return 1; |
191 | 191 | } |
192 | 192 | |
193 | - private function cprN($lat,$isodd) { |
|
193 | + private function cprN($lat, $isodd) { |
|
194 | 194 | $nl = $this->cprNL($lat) - $isodd; |
195 | 195 | if ($nl > 1) return $nl; |
196 | 196 | else return 1; |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 |
215 | 215 | ); |
216 | 216 | $crc = 0; |
217 | - $checksum = intval(substr($msg,22,6),16); |
|
217 | + $checksum = intval(substr($msg, 22, 6), 16); |
|
218 | 218 | for ($j = 0; $j < strlen($bin); $j++) { |
219 | - if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0); |
|
219 | + if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j], 0); |
|
220 | 220 | } |
221 | 221 | if ($crc == $checksum) return true; |
222 | 222 | else { |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | $msg['aircraftid'] = hexdec($data['address']); |
239 | 239 | $msg['hex'] = $data['address']; |
240 | 240 | $msg['flightid'] = hexdec($data['address']); |
241 | - $msg['date_gen'] = date('Y/m/d',$data['timestamp']); |
|
242 | - $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180'; |
|
243 | - $msg['date_log'] = date('Y/m/d',$data['timestamp']); |
|
244 | - $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180'; |
|
241 | + $msg['date_gen'] = date('Y/m/d', $data['timestamp']); |
|
242 | + $msg['time_gen'] = date('H:i:s', $data['timestamp']).'.180'; |
|
243 | + $msg['date_log'] = date('Y/m/d', $data['timestamp']); |
|
244 | + $msg['time_log'] = date('H:i:s', $data['timestamp']).'.180'; |
|
245 | 245 | $msg['callsign'] = $data['ident']; |
246 | 246 | $msg['altitude'] = ''; |
247 | 247 | $msg['speed'] = ''; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $msg['emergency'] = ''; |
255 | 255 | $msg['SPI'] = ''; |
256 | 256 | $msg['ground'] = ''; |
257 | - $result[] = implode(',',$msg); |
|
257 | + $result[] = implode(',', $msg); |
|
258 | 258 | } |
259 | 259 | if (isset($data['latitude']) && $data['latitude'] != 0) { |
260 | 260 | $msg = array(); |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | $msg['aircraftid'] = hexdec($data['address']); |
265 | 265 | $msg['hex'] = $data['address']; |
266 | 266 | $msg['flightid'] = hexdec($data['address']); |
267 | - $msg['date_gen'] = date('Y/m/d',$data['timestamp']); |
|
268 | - $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180'; |
|
269 | - $msg['date_log'] = date('Y/m/d',$data['timestamp']); |
|
270 | - $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180'; |
|
267 | + $msg['date_gen'] = date('Y/m/d', $data['timestamp']); |
|
268 | + $msg['time_gen'] = date('H:i:s', $data['timestamp']).'.180'; |
|
269 | + $msg['date_log'] = date('Y/m/d', $data['timestamp']); |
|
270 | + $msg['time_log'] = date('H:i:s', $data['timestamp']).'.180'; |
|
271 | 271 | $msg['callsign'] = ''; |
272 | 272 | if (isset($data['altitude'])) $msg['altitude'] = $data['altitude']; |
273 | 273 | else $msg['altitude'] = ''; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $msg['SPI'] = 0; |
286 | 286 | if (isset($data['ground'])) $msg['ground'] = 1; |
287 | 287 | else $msg['ground'] = 0; |
288 | - $result[] = implode(',',$msg); |
|
288 | + $result[] = implode(',', $msg); |
|
289 | 289 | } |
290 | 290 | return $result; |
291 | 291 | } |
@@ -19,9 +19,13 @@ discard block |
||
19 | 19 | // Not yet finished, no CRC checks |
20 | 20 | $data = array(); |
21 | 21 | $typehex = substr($buffer,0,1); |
22 | - if ($typehex == '*' || $typehex == ':') $hex = substr($buffer,1,-1); |
|
23 | - elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer,13,-13); |
|
24 | - else $hex = substr($buffer,1,-1); |
|
22 | + if ($typehex == '*' || $typehex == ':') { |
|
23 | + $hex = substr($buffer,1,-1); |
|
24 | + } elseif ($typehex == '@' || $typehex == '%') { |
|
25 | + $hex = substr($buffer,13,-13); |
|
26 | + } else { |
|
27 | + $hex = substr($buffer,1,-1); |
|
28 | + } |
|
25 | 29 | $bin = gmp_strval( gmp_init($hex,16), 2); |
26 | 30 | //if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) { |
27 | 31 | if (strlen($hex) == 28) { |
@@ -64,8 +68,9 @@ discard block |
||
64 | 68 | // 131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits. |
65 | 69 | $cprlat = intval(substr($bin,54,17),2)/131072.0; |
66 | 70 | $cprlon = intval(substr($bin,71,17),2)/131072.0; |
67 | - if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time()); |
|
68 | - elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) { |
|
71 | + if ($oe == 0) { |
|
72 | + $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time()); |
|
73 | + } elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) { |
|
69 | 74 | $cprlat_odd = $cprlat; |
70 | 75 | $cprlon_odd = $cprlon; |
71 | 76 | $cprlat_even = $this::$latlon[$icao]['latitude']; |
@@ -73,8 +78,12 @@ discard block |
||
73 | 78 | $j = 59*$cprlat_even-60*$cprlat_odd+0.5; |
74 | 79 | $lat_even = (360.0/60)*($j%60+$cprlat_even); |
75 | 80 | $lat_odd = (360.0/59)*($j%59+$cprlat_odd); |
76 | - if ($lat_even >= 270) $lat_even = $lat_even - 360; |
|
77 | - if ($lat_odd >= 270) $lat_odd = $lat_odd - 360; |
|
81 | + if ($lat_even >= 270) { |
|
82 | + $lat_even = $lat_even - 360; |
|
83 | + } |
|
84 | + if ($lat_odd >= 270) { |
|
85 | + $lat_odd = $lat_odd - 360; |
|
86 | + } |
|
78 | 87 | // check latitude zone |
79 | 88 | if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) { |
80 | 89 | if ($this::$latlon[$icao]['created'] > time()) { |
@@ -82,7 +91,9 @@ discard block |
||
82 | 91 | $m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5); |
83 | 92 | $lon = (360.0/$ni)*($m%$ni+$cprlon_even); |
84 | 93 | $lat = $lat_even; |
85 | - if ($lon > 180) $lon = $lon -360; |
|
94 | + if ($lon > 180) { |
|
95 | + $lon = $lon -360; |
|
96 | + } |
|
86 | 97 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
87 | 98 | //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon; |
88 | 99 | $data['latitude'] = $lat; |
@@ -93,14 +104,18 @@ discard block |
||
93 | 104 | $m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5); |
94 | 105 | $lon = (360.0/$ni)*($m%$ni+$cprlon_odd); |
95 | 106 | $lat = $lat_odd; |
96 | - if ($lon > 180) $lon = $lon -360; |
|
107 | + if ($lon > 180) { |
|
108 | + $lon = $lon -360; |
|
109 | + } |
|
97 | 110 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
98 | 111 | //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n"; |
99 | 112 | $data['latitude'] = $lat; |
100 | 113 | $data['longitude'] = $lon; |
101 | 114 | } |
102 | 115 | } |
103 | - } else echo "Not cprNL"; |
|
116 | + } else { |
|
117 | + echo "Not cprNL"; |
|
118 | + } |
|
104 | 119 | unset($this::$latlon[$icao]); |
105 | 120 | } |
106 | 121 | } elseif ($tc == 19) { |
@@ -109,11 +124,17 @@ discard block |
||
109 | 124 | $v_ew = intval(substr($bin,46,10),2); |
110 | 125 | $v_ns_dir = intval(substr($bin,56,1)); |
111 | 126 | $v_ns = intval(substr($bin,57,10),2); |
112 | - if ($v_ew_dir) $v_ew = -1*$v_ew; |
|
113 | - if ($v_ns_dir) $v_ns = -1*$v_ns; |
|
127 | + if ($v_ew_dir) { |
|
128 | + $v_ew = -1*$v_ew; |
|
129 | + } |
|
130 | + if ($v_ns_dir) { |
|
131 | + $v_ns = -1*$v_ns; |
|
132 | + } |
|
114 | 133 | $speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew); |
115 | 134 | $heading = atan2($v_ew,$v_ns)*360.0/(2*pi()); |
116 | - if ($heading <0) $heading = $heading+360; |
|
135 | + if ($heading <0) { |
|
136 | + $heading = $heading+360; |
|
137 | + } |
|
117 | 138 | $data['speed'] = $speed; |
118 | 139 | $data['heading'] = $heading; |
119 | 140 | } |
@@ -128,72 +149,194 @@ discard block |
||
128 | 149 | * Lookup table to convert the latitude to index. |
129 | 150 | */ |
130 | 151 | private function cprNL($lat) { |
131 | - if ($lat < 0) $lat = -$lat; // Table is simmetric about the equator. |
|
132 | - if ($lat < 10.47047130) return 59; |
|
133 | - if ($lat < 14.82817437) return 58; |
|
134 | - if ($lat < 18.18626357) return 57; |
|
135 | - if ($lat < 21.02939493) return 56; |
|
136 | - if ($lat < 23.54504487) return 55; |
|
137 | - if ($lat < 25.82924707) return 54; |
|
138 | - if ($lat < 27.93898710) return 53; |
|
139 | - if ($lat < 29.91135686) return 52; |
|
140 | - if ($lat < 31.77209708) return 51; |
|
141 | - if ($lat < 33.53993436) return 50; |
|
142 | - if ($lat < 35.22899598) return 49; |
|
143 | - if ($lat < 36.85025108) return 48; |
|
144 | - if ($lat < 38.41241892) return 47; |
|
145 | - if ($lat < 39.92256684) return 46; |
|
146 | - if ($lat < 41.38651832) return 45; |
|
147 | - if ($lat < 42.80914012) return 44; |
|
148 | - if ($lat < 44.19454951) return 43; |
|
149 | - if ($lat < 45.54626723) return 42; |
|
150 | - if ($lat < 46.86733252) return 41; |
|
151 | - if ($lat < 48.16039128) return 40; |
|
152 | - if ($lat < 49.42776439) return 39; |
|
153 | - if ($lat < 50.67150166) return 38; |
|
154 | - if ($lat < 51.89342469) return 37; |
|
155 | - if ($lat < 53.09516153) return 36; |
|
156 | - if ($lat < 54.27817472) return 35; |
|
157 | - if ($lat < 55.44378444) return 34; |
|
158 | - if ($lat < 56.59318756) return 33; |
|
159 | - if ($lat < 57.72747354) return 32; |
|
160 | - if ($lat < 58.84763776) return 31; |
|
161 | - if ($lat < 59.95459277) return 30; |
|
162 | - if ($lat < 61.04917774) return 29; |
|
163 | - if ($lat < 62.13216659) return 28; |
|
164 | - if ($lat < 63.20427479) return 27; |
|
165 | - if ($lat < 64.26616523) return 26; |
|
166 | - if ($lat < 65.31845310) return 25; |
|
167 | - if ($lat < 66.36171008) return 24; |
|
168 | - if ($lat < 67.39646774) return 23; |
|
169 | - if ($lat < 68.42322022) return 22; |
|
170 | - if ($lat < 69.44242631) return 21; |
|
171 | - if ($lat < 70.45451075) return 20; |
|
172 | - if ($lat < 71.45986473) return 19; |
|
173 | - if ($lat < 72.45884545) return 18; |
|
174 | - if ($lat < 73.45177442) return 17; |
|
175 | - if ($lat < 74.43893416) return 16; |
|
176 | - if ($lat < 75.42056257) return 15; |
|
177 | - if ($lat < 76.39684391) return 14; |
|
178 | - if ($lat < 77.36789461) return 13; |
|
179 | - if ($lat < 78.33374083) return 12; |
|
180 | - if ($lat < 79.29428225) return 11; |
|
181 | - if ($lat < 80.24923213) return 10; |
|
182 | - if ($lat < 81.19801349) return 9; |
|
183 | - if ($lat < 82.13956981) return 8; |
|
184 | - if ($lat < 83.07199445) return 7; |
|
185 | - if ($lat < 83.99173563) return 6; |
|
186 | - if ($lat < 84.89166191) return 5; |
|
187 | - if ($lat < 85.75541621) return 4; |
|
188 | - if ($lat < 86.53536998) return 3; |
|
189 | - if ($lat < 87.00000000) return 2; |
|
152 | + if ($lat < 0) { |
|
153 | + $lat = -$lat; |
|
154 | + } |
|
155 | + // Table is simmetric about the equator. |
|
156 | + if ($lat < 10.47047130) { |
|
157 | + return 59; |
|
158 | + } |
|
159 | + if ($lat < 14.82817437) { |
|
160 | + return 58; |
|
161 | + } |
|
162 | + if ($lat < 18.18626357) { |
|
163 | + return 57; |
|
164 | + } |
|
165 | + if ($lat < 21.02939493) { |
|
166 | + return 56; |
|
167 | + } |
|
168 | + if ($lat < 23.54504487) { |
|
169 | + return 55; |
|
170 | + } |
|
171 | + if ($lat < 25.82924707) { |
|
172 | + return 54; |
|
173 | + } |
|
174 | + if ($lat < 27.93898710) { |
|
175 | + return 53; |
|
176 | + } |
|
177 | + if ($lat < 29.91135686) { |
|
178 | + return 52; |
|
179 | + } |
|
180 | + if ($lat < 31.77209708) { |
|
181 | + return 51; |
|
182 | + } |
|
183 | + if ($lat < 33.53993436) { |
|
184 | + return 50; |
|
185 | + } |
|
186 | + if ($lat < 35.22899598) { |
|
187 | + return 49; |
|
188 | + } |
|
189 | + if ($lat < 36.85025108) { |
|
190 | + return 48; |
|
191 | + } |
|
192 | + if ($lat < 38.41241892) { |
|
193 | + return 47; |
|
194 | + } |
|
195 | + if ($lat < 39.92256684) { |
|
196 | + return 46; |
|
197 | + } |
|
198 | + if ($lat < 41.38651832) { |
|
199 | + return 45; |
|
200 | + } |
|
201 | + if ($lat < 42.80914012) { |
|
202 | + return 44; |
|
203 | + } |
|
204 | + if ($lat < 44.19454951) { |
|
205 | + return 43; |
|
206 | + } |
|
207 | + if ($lat < 45.54626723) { |
|
208 | + return 42; |
|
209 | + } |
|
210 | + if ($lat < 46.86733252) { |
|
211 | + return 41; |
|
212 | + } |
|
213 | + if ($lat < 48.16039128) { |
|
214 | + return 40; |
|
215 | + } |
|
216 | + if ($lat < 49.42776439) { |
|
217 | + return 39; |
|
218 | + } |
|
219 | + if ($lat < 50.67150166) { |
|
220 | + return 38; |
|
221 | + } |
|
222 | + if ($lat < 51.89342469) { |
|
223 | + return 37; |
|
224 | + } |
|
225 | + if ($lat < 53.09516153) { |
|
226 | + return 36; |
|
227 | + } |
|
228 | + if ($lat < 54.27817472) { |
|
229 | + return 35; |
|
230 | + } |
|
231 | + if ($lat < 55.44378444) { |
|
232 | + return 34; |
|
233 | + } |
|
234 | + if ($lat < 56.59318756) { |
|
235 | + return 33; |
|
236 | + } |
|
237 | + if ($lat < 57.72747354) { |
|
238 | + return 32; |
|
239 | + } |
|
240 | + if ($lat < 58.84763776) { |
|
241 | + return 31; |
|
242 | + } |
|
243 | + if ($lat < 59.95459277) { |
|
244 | + return 30; |
|
245 | + } |
|
246 | + if ($lat < 61.04917774) { |
|
247 | + return 29; |
|
248 | + } |
|
249 | + if ($lat < 62.13216659) { |
|
250 | + return 28; |
|
251 | + } |
|
252 | + if ($lat < 63.20427479) { |
|
253 | + return 27; |
|
254 | + } |
|
255 | + if ($lat < 64.26616523) { |
|
256 | + return 26; |
|
257 | + } |
|
258 | + if ($lat < 65.31845310) { |
|
259 | + return 25; |
|
260 | + } |
|
261 | + if ($lat < 66.36171008) { |
|
262 | + return 24; |
|
263 | + } |
|
264 | + if ($lat < 67.39646774) { |
|
265 | + return 23; |
|
266 | + } |
|
267 | + if ($lat < 68.42322022) { |
|
268 | + return 22; |
|
269 | + } |
|
270 | + if ($lat < 69.44242631) { |
|
271 | + return 21; |
|
272 | + } |
|
273 | + if ($lat < 70.45451075) { |
|
274 | + return 20; |
|
275 | + } |
|
276 | + if ($lat < 71.45986473) { |
|
277 | + return 19; |
|
278 | + } |
|
279 | + if ($lat < 72.45884545) { |
|
280 | + return 18; |
|
281 | + } |
|
282 | + if ($lat < 73.45177442) { |
|
283 | + return 17; |
|
284 | + } |
|
285 | + if ($lat < 74.43893416) { |
|
286 | + return 16; |
|
287 | + } |
|
288 | + if ($lat < 75.42056257) { |
|
289 | + return 15; |
|
290 | + } |
|
291 | + if ($lat < 76.39684391) { |
|
292 | + return 14; |
|
293 | + } |
|
294 | + if ($lat < 77.36789461) { |
|
295 | + return 13; |
|
296 | + } |
|
297 | + if ($lat < 78.33374083) { |
|
298 | + return 12; |
|
299 | + } |
|
300 | + if ($lat < 79.29428225) { |
|
301 | + return 11; |
|
302 | + } |
|
303 | + if ($lat < 80.24923213) { |
|
304 | + return 10; |
|
305 | + } |
|
306 | + if ($lat < 81.19801349) { |
|
307 | + return 9; |
|
308 | + } |
|
309 | + if ($lat < 82.13956981) { |
|
310 | + return 8; |
|
311 | + } |
|
312 | + if ($lat < 83.07199445) { |
|
313 | + return 7; |
|
314 | + } |
|
315 | + if ($lat < 83.99173563) { |
|
316 | + return 6; |
|
317 | + } |
|
318 | + if ($lat < 84.89166191) { |
|
319 | + return 5; |
|
320 | + } |
|
321 | + if ($lat < 85.75541621) { |
|
322 | + return 4; |
|
323 | + } |
|
324 | + if ($lat < 86.53536998) { |
|
325 | + return 3; |
|
326 | + } |
|
327 | + if ($lat < 87.00000000) { |
|
328 | + return 2; |
|
329 | + } |
|
190 | 330 | return 1; |
191 | 331 | } |
192 | 332 | |
193 | 333 | private function cprN($lat,$isodd) { |
194 | 334 | $nl = $this->cprNL($lat) - $isodd; |
195 | - if ($nl > 1) return $nl; |
|
196 | - else return 1; |
|
335 | + if ($nl > 1) { |
|
336 | + return $nl; |
|
337 | + } else { |
|
338 | + return 1; |
|
339 | + } |
|
197 | 340 | } |
198 | 341 | |
199 | 342 | private function parityCheck($msg, $bin) { |
@@ -216,10 +359,13 @@ discard block |
||
216 | 359 | $crc = 0; |
217 | 360 | $checksum = intval(substr($msg,22,6),16); |
218 | 361 | for ($j = 0; $j < strlen($bin); $j++) { |
219 | - if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0); |
|
362 | + if ($bin[$j]) { |
|
363 | + $crc = $crc^intval($modes_checksum_table[$j],0); |
|
364 | + } |
|
220 | 365 | } |
221 | - if ($crc == $checksum) return true; |
|
222 | - else { |
|
366 | + if ($crc == $checksum) { |
|
367 | + return true; |
|
368 | + } else { |
|
223 | 369 | //echo "**** CRC ERROR ****\n"; |
224 | 370 | return false; |
225 | 371 | } |
@@ -269,22 +415,37 @@ discard block |
||
269 | 415 | $msg['date_log'] = date('Y/m/d',$data['timestamp']); |
270 | 416 | $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180'; |
271 | 417 | $msg['callsign'] = ''; |
272 | - if (isset($data['altitude'])) $msg['altitude'] = $data['altitude']; |
|
273 | - else $msg['altitude'] = ''; |
|
418 | + if (isset($data['altitude'])) { |
|
419 | + $msg['altitude'] = $data['altitude']; |
|
420 | + } else { |
|
421 | + $msg['altitude'] = ''; |
|
422 | + } |
|
274 | 423 | $msg['speed'] = $data['speed']; |
275 | - if (isset($data['heading'])) $msg['track'] = $data['heading']; |
|
276 | - else $msg['track'] = ''; |
|
424 | + if (isset($data['heading'])) { |
|
425 | + $msg['track'] = $data['heading']; |
|
426 | + } else { |
|
427 | + $msg['track'] = ''; |
|
428 | + } |
|
277 | 429 | $msg['latitude'] = $data['latitude']; |
278 | 430 | $msg['longitude'] = $data['longitude']; |
279 | - if (isset($data['verticalrate'])) $msg['verticalrate'] = $data['verticalrate']; |
|
280 | - else $msg['verticalrate'] = ''; |
|
281 | - if (isset($data['squawk'])) $msg['squawk'] = $data['squawk']; |
|
282 | - else $msg['squawk'] = 0; |
|
431 | + if (isset($data['verticalrate'])) { |
|
432 | + $msg['verticalrate'] = $data['verticalrate']; |
|
433 | + } else { |
|
434 | + $msg['verticalrate'] = ''; |
|
435 | + } |
|
436 | + if (isset($data['squawk'])) { |
|
437 | + $msg['squawk'] = $data['squawk']; |
|
438 | + } else { |
|
439 | + $msg['squawk'] = 0; |
|
440 | + } |
|
283 | 441 | $msg['alert'] = 0; |
284 | 442 | $msg['emergency'] = 0; |
285 | 443 | $msg['SPI'] = 0; |
286 | - if (isset($data['ground'])) $msg['ground'] = 1; |
|
287 | - else $msg['ground'] = 0; |
|
444 | + if (isset($data['ground'])) { |
|
445 | + $msg['ground'] = 1; |
|
446 | + } else { |
|
447 | + $msg['ground'] = 0; |
|
448 | + } |
|
288 | 449 | $result[] = implode(',',$msg); |
289 | 450 | } |
290 | 451 | return $result; |
@@ -14,35 +14,35 @@ discard block |
||
14 | 14 | public $db; |
15 | 15 | |
16 | 16 | protected $texts = Array( |
17 | - 'MI' => 'Shallow', |
|
18 | - 'PR' => 'Partial', |
|
19 | - 'BC' => 'Low drifting', |
|
20 | - 'BL' => 'Blowing', |
|
21 | - 'SH' => 'Showers', |
|
22 | - 'TS' => 'Thunderstorm', |
|
23 | - 'FZ' => 'Freezing', |
|
24 | - 'DZ' => 'Drizzle', |
|
25 | - 'RA' => 'Rain', |
|
26 | - 'SN' => 'Snow', |
|
27 | - 'SG' => 'Snow Grains', |
|
28 | - 'IC' => 'Ice crystals', |
|
29 | - 'PL' => 'Ice pellets', |
|
30 | - 'GR' => 'Hail', |
|
31 | - 'GS' => 'Small hail', |
|
32 | - 'UP' => 'Unknown', |
|
33 | - 'BR' => 'Mist', |
|
34 | - 'FG' => 'Fog', |
|
35 | - 'FU' => 'Smoke', |
|
36 | - 'VA' => 'Volcanic ash', |
|
37 | - 'DU' => 'Widespread dust', |
|
38 | - 'SA' => 'Sand', |
|
39 | - 'HZ' => 'Haze', |
|
40 | - 'PY' => 'Spray', |
|
41 | - 'PO' => 'Well developed dust / sand whirls', |
|
42 | - 'SQ' => 'Squalls', |
|
43 | - 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
44 | - 'SS' => 'Sandstorm', |
|
45 | - 'DS' => 'Duststorm' |
|
17 | + 'MI' => 'Shallow', |
|
18 | + 'PR' => 'Partial', |
|
19 | + 'BC' => 'Low drifting', |
|
20 | + 'BL' => 'Blowing', |
|
21 | + 'SH' => 'Showers', |
|
22 | + 'TS' => 'Thunderstorm', |
|
23 | + 'FZ' => 'Freezing', |
|
24 | + 'DZ' => 'Drizzle', |
|
25 | + 'RA' => 'Rain', |
|
26 | + 'SN' => 'Snow', |
|
27 | + 'SG' => 'Snow Grains', |
|
28 | + 'IC' => 'Ice crystals', |
|
29 | + 'PL' => 'Ice pellets', |
|
30 | + 'GR' => 'Hail', |
|
31 | + 'GS' => 'Small hail', |
|
32 | + 'UP' => 'Unknown', |
|
33 | + 'BR' => 'Mist', |
|
34 | + 'FG' => 'Fog', |
|
35 | + 'FU' => 'Smoke', |
|
36 | + 'VA' => 'Volcanic ash', |
|
37 | + 'DU' => 'Widespread dust', |
|
38 | + 'SA' => 'Sand', |
|
39 | + 'HZ' => 'Haze', |
|
40 | + 'PY' => 'Spray', |
|
41 | + 'PO' => 'Well developed dust / sand whirls', |
|
42 | + 'SQ' => 'Squalls', |
|
43 | + 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
44 | + 'SS' => 'Sandstorm', |
|
45 | + 'DS' => 'Duststorm' |
|
46 | 46 | ); |
47 | 47 | |
48 | 48 | /* |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg'; |
178 | 178 | */ |
179 | 179 | } |
180 | - /* |
|
180 | + /* |
|
181 | 181 | // Wind Direction |
182 | 182 | if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) { |
183 | 183 | $result['wind_direction'] = $matches[1]; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $result['speed_variable'] = $matches[1]; |
189 | 189 | } |
190 | 190 | */ |
191 | - // Visibility |
|
191 | + // Visibility |
|
192 | 192 | if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
193 | 193 | if (isset($matches[3]) && strlen($matches[3]) > 0) { |
194 | 194 | $result['visibility'] = (float)$matches[3] * 1609.34; |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
247 | 247 | if (isset($matches[3])) { |
248 | 248 | $range = Array( |
249 | - 'from' => (float)$matches[2], |
|
250 | - 'to' => (float)$matches[4], |
|
251 | - 'unit' => $matches[5] ? 'FT' : 'M' |
|
249 | + 'from' => (float)$matches[2], |
|
250 | + 'to' => (float)$matches[4], |
|
251 | + 'unit' => $matches[5] ? 'FT' : 'M' |
|
252 | 252 | ); |
253 | 253 | } |
254 | 254 | $result['RVR'] = $matches[1]; |
@@ -73,8 +73,11 @@ discard block |
||
73 | 73 | } |
74 | 74 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
75 | 75 | $sth->closeCursor(); |
76 | - if ($row['nb'] > 0) return false; |
|
77 | - else return true; |
|
76 | + if ($row['nb'] > 0) { |
|
77 | + return false; |
|
78 | + } else { |
|
79 | + return true; |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | |
80 | 83 | /* |
@@ -104,29 +107,48 @@ discard block |
||
104 | 107 | //$pieces = explode(' ',$data); |
105 | 108 | $pieces = preg_split('/\s/',$data); |
106 | 109 | $pos = 0; |
107 | - if ($pieces[0] == 'METAR') $pos++; |
|
108 | - elseif ($pieces[0] == 'SPECI') $pos++; |
|
109 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
110 | + if ($pieces[0] == 'METAR') { |
|
111 | + $pos++; |
|
112 | + } elseif ($pieces[0] == 'SPECI') { |
|
113 | + $pos++; |
|
114 | + } |
|
115 | + if (strlen($pieces[$pos]) != 4) { |
|
116 | + $pos++; |
|
117 | + } |
|
110 | 118 | $result = array(); |
111 | - if (!isset($pieces[$pos])) return $result; |
|
119 | + if (!isset($pieces[$pos])) { |
|
120 | + return $result; |
|
121 | + } |
|
112 | 122 | $result['location'] = $pieces[$pos]; |
113 | 123 | $pos++; |
114 | - if (!isset($pieces[$pos])) return $result; |
|
124 | + if (!isset($pieces[$pos])) { |
|
125 | + return $result; |
|
126 | + } |
|
115 | 127 | $result['dayofmonth'] = substr($pieces[$pos],0,2); |
116 | 128 | $result['time'] = substr($pieces[$pos],2,4); |
117 | 129 | $c = count($pieces); |
118 | 130 | for($pos++; $pos < $c; $pos++) { |
119 | 131 | $piece = $pieces[$pos]; |
120 | - if ($piece == 'RMK') break; |
|
121 | - if ($piece == 'AUTO') $result['auto'] = true; |
|
122 | - if ($piece == 'COR') $result['correction'] = true; |
|
132 | + if ($piece == 'RMK') { |
|
133 | + break; |
|
134 | + } |
|
135 | + if ($piece == 'AUTO') { |
|
136 | + $result['auto'] = true; |
|
137 | + } |
|
138 | + if ($piece == 'COR') { |
|
139 | + $result['correction'] = true; |
|
140 | + } |
|
123 | 141 | // Wind Speed |
124 | 142 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
125 | 143 | $result['wind']['direction'] = (float)$matches[1]; |
126 | 144 | $result['wind']['unit'] = $matches[4]; |
127 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
128 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
129 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
145 | + if ($result['wind']['unit'] == 'KT') { |
|
146 | + $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
147 | + } elseif ($result['wind']['unit'] == 'KPH') { |
|
148 | + $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
149 | + } elseif ($result['wind']['unit'] == 'MPS') { |
|
150 | + $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
151 | + } |
|
130 | 152 | $result['wind']['gust'] = (float)$matches[3]; |
131 | 153 | $result['wind']['unit'] = $matches[4]; |
132 | 154 | $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
@@ -210,27 +232,49 @@ discard block |
||
210 | 232 | //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
211 | 233 | $type = $matches[1]; |
212 | 234 | $cloud = array(); |
213 | - if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
214 | - elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
215 | - elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
216 | - elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
217 | - elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
218 | - elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
219 | - elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
220 | - elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
235 | + if ($type == 'SKC') { |
|
236 | + $cloud['type'] = 'No cloud/Sky clear'; |
|
237 | + } elseif ($type == 'CLR') { |
|
238 | + $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
239 | + } elseif ($type == 'NSC') { |
|
240 | + $cloud['type'] = 'No significant cloud'; |
|
241 | + } elseif ($type == 'FEW') { |
|
242 | + $cloud['type'] = 'Few'; |
|
243 | + } elseif ($type == 'SCT') { |
|
244 | + $cloud['type'] = 'Scattered'; |
|
245 | + } elseif ($type == 'BKN') { |
|
246 | + $cloud['type'] = 'Broken'; |
|
247 | + } elseif ($type == 'OVC') { |
|
248 | + $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
249 | + } elseif ($type == 'VV') { |
|
250 | + $cloud['type'] = 'Vertical visibility'; |
|
251 | + } |
|
221 | 252 | $cloud['type_code'] = $type; |
222 | 253 | $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
223 | - if (isset($matches[3])) $significant = $matches[3]; |
|
224 | - else $significant = ''; |
|
225 | - if ($significant == 'CB') $cloud['significant'] = 'Cumulonimbus'; |
|
226 | - elseif ($significant == 'AC') $cloud['significant'] = 'Altocumulus'; |
|
227 | - elseif ($significant == 'CBS') $cloud['significant'] = 'Cumulonimbus'; |
|
228 | - elseif ($significant == 'CC') $cloud['significant'] = 'Cirrocumulus'; |
|
229 | - elseif ($significant == 'CU') $cloud['significant'] = 'Cumulus'; |
|
230 | - elseif ($significant == 'CI') $cloud['significant'] = 'Cirrus'; |
|
231 | - elseif ($significant == 'CS') $cloud['significant'] = 'Cirrostratus'; |
|
232 | - elseif ($significant == 'TCU') $cloud['significant'] = 'Towering Cumulus'; |
|
233 | - else $cloud['significant'] = $significant; |
|
254 | + if (isset($matches[3])) { |
|
255 | + $significant = $matches[3]; |
|
256 | + } else { |
|
257 | + $significant = ''; |
|
258 | + } |
|
259 | + if ($significant == 'CB') { |
|
260 | + $cloud['significant'] = 'Cumulonimbus'; |
|
261 | + } elseif ($significant == 'AC') { |
|
262 | + $cloud['significant'] = 'Altocumulus'; |
|
263 | + } elseif ($significant == 'CBS') { |
|
264 | + $cloud['significant'] = 'Cumulonimbus'; |
|
265 | + } elseif ($significant == 'CC') { |
|
266 | + $cloud['significant'] = 'Cirrocumulus'; |
|
267 | + } elseif ($significant == 'CU') { |
|
268 | + $cloud['significant'] = 'Cumulus'; |
|
269 | + } elseif ($significant == 'CI') { |
|
270 | + $cloud['significant'] = 'Cirrus'; |
|
271 | + } elseif ($significant == 'CS') { |
|
272 | + $cloud['significant'] = 'Cirrostratus'; |
|
273 | + } elseif ($significant == 'TCU') { |
|
274 | + $cloud['significant'] = 'Towering Cumulus'; |
|
275 | + } else { |
|
276 | + $cloud['significant'] = $significant; |
|
277 | + } |
|
234 | 278 | //$cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
235 | 279 | $result['cloud'][] = $cloud; |
236 | 280 | } |
@@ -254,8 +298,11 @@ discard block |
||
254 | 298 | $result['RVR']['friction'] = $matches[5]; |
255 | 299 | } |
256 | 300 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
257 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
258 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
301 | + if (isset($matches[5])) { |
|
302 | + $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
303 | + } else { |
|
304 | + $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
305 | + } |
|
259 | 306 | if (isset($matches[3])) { |
260 | 307 | $range = Array( |
261 | 308 | 'from' => (float)$matches[2], |
@@ -288,8 +335,11 @@ discard block |
||
288 | 335 | if (isset($matches[3])) { |
289 | 336 | $text[] = $this->texts[$matches[3]]; |
290 | 337 | } |
291 | - if (!isset($result['weather'])) $result['weather'] = implode(' ', $text); |
|
292 | - else $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
338 | + if (!isset($result['weather'])) { |
|
339 | + $result['weather'] = implode(' ', $text); |
|
340 | + } else { |
|
341 | + $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
342 | + } |
|
293 | 343 | } |
294 | 344 | } |
295 | 345 | return $result; |
@@ -305,8 +355,11 @@ discard block |
||
305 | 355 | if (isset($globalMETARcycle) && $globalMETARcycle) { |
306 | 356 | $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
307 | 357 | } else { |
308 | - if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
309 | - else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
358 | + if ($globalDBdriver == 'mysql') { |
|
359 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
360 | + } else { |
|
361 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
362 | + } |
|
310 | 363 | } |
311 | 364 | $query_values = array(':icao' => $icao); |
312 | 365 | try { |
@@ -378,7 +431,9 @@ discard block |
||
378 | 431 | */ |
379 | 432 | public function addMETARCycle() { |
380 | 433 | global $globalDebug, $globalIVAO, $globalTransaction; |
381 | - if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
434 | + if (isset($globalDebug) && $globalDebug) { |
|
435 | + echo "Downloading METAR cycle..."; |
|
436 | + } |
|
382 | 437 | date_default_timezone_set("UTC"); |
383 | 438 | $Common = new Common(); |
384 | 439 | if (isset($globalIVAO) && $globalIVAO) { |
@@ -389,28 +444,42 @@ discard block |
||
389 | 444 | $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
390 | 445 | } |
391 | 446 | if ($handle) { |
392 | - if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
|
447 | + if (isset($globalDebug) && $globalDebug) { |
|
448 | + echo "Done - Updating DB..."; |
|
449 | + } |
|
393 | 450 | $date = ''; |
394 | - if ($globalTransaction) $this->db->beginTransaction(); |
|
451 | + if ($globalTransaction) { |
|
452 | + $this->db->beginTransaction(); |
|
453 | + } |
|
395 | 454 | while(($line = fgets($handle,4096)) !== false) { |
396 | 455 | $line = str_replace(array("\r\n","\r", "\n"), '', $line); |
397 | 456 | if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
398 | 457 | $date = $line; |
399 | 458 | } elseif (trim($line) != '') { |
400 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
459 | + if ($date == '') { |
|
460 | + $date = date('Y/m/d H:m'); |
|
461 | + } |
|
401 | 462 | $pos = 0; |
402 | 463 | $pieces = preg_split('/\s/',$line); |
403 | - if ($pieces[0] == 'METAR') $pos++; |
|
404 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
464 | + if ($pieces[0] == 'METAR') { |
|
465 | + $pos++; |
|
466 | + } |
|
467 | + if (strlen($pieces[$pos]) != 4) { |
|
468 | + $pos++; |
|
469 | + } |
|
405 | 470 | $location = $pieces[$pos]; |
406 | 471 | //if ($location == 'LFLL') echo 'location: '.$location.' - date: '.$date.' - data: '.$line."\n"; |
407 | 472 | echo $this->addMETAR($location,$line,$date); |
408 | 473 | } |
409 | 474 | } |
410 | 475 | fclose($handle); |
411 | - if ($globalTransaction) $this->db->commit(); |
|
476 | + if ($globalTransaction) { |
|
477 | + $this->db->commit(); |
|
478 | + } |
|
479 | + } |
|
480 | + if (isset($globalDebug) && $globalDebug) { |
|
481 | + echo "Done\n"; |
|
412 | 482 | } |
413 | - if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
414 | 483 | } |
415 | 484 | |
416 | 485 | /* |
@@ -420,7 +489,9 @@ discard block |
||
420 | 489 | */ |
421 | 490 | public function downloadMETAR($icao) { |
422 | 491 | global $globalMETARurl; |
423 | - if ($globalMETARurl == '') return array(); |
|
492 | + if ($globalMETARurl == '') { |
|
493 | + return array(); |
|
494 | + } |
|
424 | 495 | date_default_timezone_set("UTC"); |
425 | 496 | $Common = new Common(); |
426 | 497 | $url = str_replace('{icao}',$icao,$globalMETARurl); |
@@ -432,16 +503,24 @@ discard block |
||
432 | 503 | $date = $line; |
433 | 504 | } |
434 | 505 | if (trim($line) != '') { |
435 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
506 | + if ($date == '') { |
|
507 | + $date = date('Y/m/d H:m'); |
|
508 | + } |
|
436 | 509 | $pos = 0; |
437 | 510 | $pieces = preg_split('/\s/',$line); |
438 | - if ($pieces[0] == 'METAR') $pos++; |
|
439 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
511 | + if ($pieces[0] == 'METAR') { |
|
512 | + $pos++; |
|
513 | + } |
|
514 | + if (strlen($pieces[$pos]) != 4) { |
|
515 | + $pos++; |
|
516 | + } |
|
440 | 517 | $location = $pieces[$pos]; |
441 | 518 | if (strlen($location == 4)) { |
442 | 519 | $this->addMETAR($location,$line,$date); |
443 | 520 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
444 | - } else return array(); |
|
521 | + } else { |
|
522 | + return array(); |
|
523 | + } |
|
445 | 524 | } |
446 | 525 | } |
447 | 526 | return array(); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $Connection = new Connection(); |
69 | 69 | $sth = $Connection->db->prepare($query); |
70 | 70 | $sth->execute(); |
71 | - } catch(PDOException $e) { |
|
71 | + } catch (PDOException $e) { |
|
72 | 72 | return "error : ".$e->getMessage(); |
73 | 73 | } |
74 | 74 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $Connection = new Connection(); |
88 | 88 | $sth = $Connection->db->prepare($query); |
89 | 89 | $sth->execute(); |
90 | - } catch(PDOException $e) { |
|
90 | + } catch (PDOException $e) { |
|
91 | 91 | return "error : ".$e->getMessage(); |
92 | 92 | } |
93 | 93 | } |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | public function parse($data) { |
101 | 101 | //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
102 | 102 | $codes = implode('|', array_keys($this->texts)); |
103 | - $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
103 | + $regWeather = '#^(\+|\-|VC)?('.$codes.')('.$codes.')?$#'; |
|
104 | 104 | //$pieces = explode(' ',$data); |
105 | - $pieces = preg_split('/\s/',$data); |
|
105 | + $pieces = preg_split('/\s/', $data); |
|
106 | 106 | $pos = 0; |
107 | 107 | if ($pieces[0] == 'METAR') $pos++; |
108 | 108 | elseif ($pieces[0] == 'SPECI') $pos++; |
@@ -112,25 +112,25 @@ discard block |
||
112 | 112 | $result['location'] = $pieces[$pos]; |
113 | 113 | $pos++; |
114 | 114 | if (!isset($pieces[$pos])) return $result; |
115 | - $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
116 | - $result['time'] = substr($pieces[$pos],2,4); |
|
115 | + $result['dayofmonth'] = substr($pieces[$pos], 0, 2); |
|
116 | + $result['time'] = substr($pieces[$pos], 2, 4); |
|
117 | 117 | $c = count($pieces); |
118 | - for($pos++; $pos < $c; $pos++) { |
|
118 | + for ($pos++; $pos < $c; $pos++) { |
|
119 | 119 | $piece = $pieces[$pos]; |
120 | 120 | if ($piece == 'RMK') break; |
121 | 121 | if ($piece == 'AUTO') $result['auto'] = true; |
122 | 122 | if ($piece == 'COR') $result['correction'] = true; |
123 | 123 | // Wind Speed |
124 | 124 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
125 | - $result['wind']['direction'] = (float)$matches[1]; |
|
125 | + $result['wind']['direction'] = (float) $matches[1]; |
|
126 | 126 | $result['wind']['unit'] = $matches[4]; |
127 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
128 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
129 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
130 | - $result['wind']['gust'] = (float)$matches[3]; |
|
127 | + if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float) $matches[2])*0.51444444444, 2); |
|
128 | + elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float) $matches[2])*1000, 2); |
|
129 | + elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float) $matches[2]), 2); |
|
130 | + $result['wind']['gust'] = (float) $matches[3]; |
|
131 | 131 | $result['wind']['unit'] = $matches[4]; |
132 | - $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
|
133 | - $result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0; |
|
132 | + $result['wind']['min_variation'] = array_key_exists(5, $matches) ? $matches[5] : 0; |
|
133 | + $result['wind']['max_variation'] = array_key_exists(6, $matches) ? $matches[6] : 0; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /* if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) { |
@@ -151,17 +151,17 @@ discard block |
||
151 | 151 | |
152 | 152 | // Temperature |
153 | 153 | if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
154 | - $temp = (float)$matches[1]; |
|
154 | + $temp = (float) $matches[1]; |
|
155 | 155 | if ($matches[1]{0} == 'M') { |
156 | - $temp = ((float)substr($matches[1], 1)) * -1; |
|
156 | + $temp = ((float) substr($matches[1], 1))*-1; |
|
157 | 157 | } |
158 | 158 | $result['temperature'] = $temp; |
159 | - $dew = (float)$matches[2]; |
|
159 | + $dew = (float) $matches[2]; |
|
160 | 160 | if ($matches[2]{0} == 'M') { |
161 | - $dew = ((float)substr($matches[2], 1)) * -1; |
|
161 | + $dew = ((float) substr($matches[2], 1))*-1; |
|
162 | 162 | } |
163 | 163 | $result['dew'] = $dew; |
164 | - $result['rh'] = round(100*(exp((17.625*$dew)/(243.04+$dew))/exp((17.625*$temp)/(243.04+$temp)))); |
|
164 | + $result['rh'] = round(100*(exp((17.625*$dew)/(243.04 + $dew))/exp((17.625*$temp)/(243.04 + $temp)))); |
|
165 | 165 | } |
166 | 166 | // QNH |
167 | 167 | if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) { |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $result['QNH'] = $matches[2]; |
172 | 172 | } else { |
173 | 173 | // inHg |
174 | - $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
174 | + $result['QNH'] = round(($matches[2]/100)*33.86389, 2); |
|
175 | 175 | } |
176 | 176 | /* |
177 | 177 | $result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100); |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | // Visibility |
193 | 193 | if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
194 | 194 | if (isset($matches[3]) && strlen($matches[3]) > 0) { |
195 | - $result['visibility'] = (float)$matches[3] * 1609.34; |
|
195 | + $result['visibility'] = (float) $matches[3]*1609.34; |
|
196 | 196 | } else { |
197 | 197 | if ($matches[1] == '9999') { |
198 | 198 | $result['visibility'] = '> 10000'; |
199 | 199 | } else { |
200 | - $result['visibility'] = (float)$matches[1]; |
|
200 | + $result['visibility'] = (float) $matches[1]; |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
221 | 221 | elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
222 | 222 | $cloud['type_code'] = $type; |
223 | - $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
223 | + $cloud['level'] = round(((float) $matches[2])*100*0.3048); |
|
224 | 224 | if (isset($matches[3])) $significant = $matches[3]; |
225 | 225 | else $significant = ''; |
226 | 226 | if ($significant == 'CB') $cloud['significant'] = 'Cumulonimbus'; |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | $rvr['runway'] = $matches[1]; |
242 | 242 | $rvr['assessment'] = $matches[2]; |
243 | 243 | $rvr['rvr'] = $matches[3]; |
244 | - $rvr['rvr_max'] = array_key_exists(4,$matches) ? $matches[4] : 0; |
|
245 | - $rvr['unit'] = array_key_exists(5,$matches) ? $matches[5] : ''; |
|
244 | + $rvr['rvr_max'] = array_key_exists(4, $matches) ? $matches[4] : 0; |
|
245 | + $rvr['unit'] = array_key_exists(5, $matches) ? $matches[5] : ''; |
|
246 | 246 | $result['RVR'] = $rvr; |
247 | 247 | } |
248 | 248 | //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
@@ -255,12 +255,12 @@ discard block |
||
255 | 255 | $result['RVR']['friction'] = $matches[5]; |
256 | 256 | } |
257 | 257 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
258 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
259 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
258 | + if (isset($matches[5])) $range = array('exact' => (float) $matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
259 | + else $range = array('exact' => (float) $matches[2], 'unit' => 'M'); |
|
260 | 260 | if (isset($matches[3])) { |
261 | 261 | $range = Array( |
262 | - 'from' => (float)$matches[2], |
|
263 | - 'to' => (float)$matches[4], |
|
262 | + 'from' => (float) $matches[2], |
|
263 | + 'to' => (float) $matches[4], |
|
264 | 264 | 'unit' => $matches[5] ? 'FT' : 'M' |
265 | 265 | ); |
266 | 266 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | try { |
314 | 314 | $sth = $this->db->prepare($query); |
315 | 315 | $sth->execute($query_values); |
316 | - } catch(PDOException $e) { |
|
316 | + } catch (PDOException $e) { |
|
317 | 317 | return "error : ".$e->getMessage(); |
318 | 318 | } |
319 | 319 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -329,19 +329,19 @@ discard block |
||
329 | 329 | * @param String $metar METAR text |
330 | 330 | * @param String $date date of the METAR |
331 | 331 | */ |
332 | - public function addMETAR($location,$metar,$date) { |
|
332 | + public function addMETAR($location, $metar, $date) { |
|
333 | 333 | global $globalDBdriver; |
334 | - $date = date('Y-m-d H:i:s',strtotime($date)); |
|
334 | + $date = date('Y-m-d H:i:s', strtotime($date)); |
|
335 | 335 | if ($globalDBdriver == 'mysql') { |
336 | 336 | $query = "INSERT INTO metar (metar_location,metar_date,metar) VALUES (:location,:date,:metar) ON DUPLICATE KEY UPDATE metar_date = :date, metar = :metar"; |
337 | 337 | } else { |
338 | 338 | $query = "UPDATE metar SET metar_date = :date, metar = :metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);"; |
339 | 339 | } |
340 | - $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
340 | + $query_values = array(':location' => $location, ':date' => $date, ':metar' => utf8_encode($metar)); |
|
341 | 341 | try { |
342 | 342 | $sth = $this->db->prepare($query); |
343 | 343 | $sth->execute($query_values); |
344 | - } catch(PDOException $e) { |
|
344 | + } catch (PDOException $e) { |
|
345 | 345 | return "error : ".$e->getMessage(); |
346 | 346 | } |
347 | 347 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | try { |
357 | 357 | $sth = $this->db->prepare($query); |
358 | 358 | $sth->execute($query_values); |
359 | - } catch(PDOException $e) { |
|
359 | + } catch (PDOException $e) { |
|
360 | 360 | return "error : ".$e->getMessage(); |
361 | 361 | } |
362 | 362 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | try { |
370 | 370 | $sth = $this->db->prepare($query); |
371 | 371 | $sth->execute(); |
372 | - } catch(PDOException $e) { |
|
372 | + } catch (PDOException $e) { |
|
373 | 373 | return "error : ".$e->getMessage(); |
374 | 374 | } |
375 | 375 | } |
@@ -383,29 +383,29 @@ discard block |
||
383 | 383 | date_default_timezone_set("UTC"); |
384 | 384 | $Common = new Common(); |
385 | 385 | if (isset($globalIVAO) && $globalIVAO) { |
386 | - $Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
387 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r"); |
|
386 | + $Common->download('http://wx.ivao.aero/metar.php', dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
387 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt', "r"); |
|
388 | 388 | } else { |
389 | - $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
390 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
|
389 | + $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT', dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
390 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT', "r"); |
|
391 | 391 | } |
392 | 392 | if ($handle) { |
393 | 393 | if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
394 | 394 | $date = ''; |
395 | 395 | if ($globalTransaction) $this->db->beginTransaction(); |
396 | - while(($line = fgets($handle,4096)) !== false) { |
|
397 | - $line = str_replace(array("\r\n","\r", "\n"), '', $line); |
|
398 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
396 | + while (($line = fgets($handle, 4096)) !== false) { |
|
397 | + $line = str_replace(array("\r\n", "\r", "\n"), '', $line); |
|
398 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
399 | 399 | $date = $line; |
400 | 400 | } elseif (trim($line) != '') { |
401 | 401 | if ($date == '') $date = date('Y/m/d H:m'); |
402 | 402 | $pos = 0; |
403 | - $pieces = preg_split('/\s/',$line); |
|
403 | + $pieces = preg_split('/\s/', $line); |
|
404 | 404 | if ($pieces[0] == 'METAR') $pos++; |
405 | 405 | if (strlen($pieces[$pos]) != 4) $pos++; |
406 | 406 | $location = $pieces[$pos]; |
407 | 407 | //if ($location == 'LFLL') echo 'location: '.$location.' - date: '.$date.' - data: '.$line."\n"; |
408 | - echo $this->addMETAR($location,$line,$date); |
|
408 | + echo $this->addMETAR($location, $line, $date); |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | fclose($handle); |
@@ -424,23 +424,23 @@ discard block |
||
424 | 424 | if ($globalMETARurl == '') return array(); |
425 | 425 | date_default_timezone_set("UTC"); |
426 | 426 | $Common = new Common(); |
427 | - $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
427 | + $url = str_replace('{icao}', $icao, $globalMETARurl); |
|
428 | 428 | $cycle = $Common->getData($url); |
429 | 429 | $date = ''; |
430 | - foreach(explode("\n",$cycle) as $line) { |
|
431 | - $line = str_replace(array("\r\n","\r", "\n"), '', $line); |
|
432 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
430 | + foreach (explode("\n", $cycle) as $line) { |
|
431 | + $line = str_replace(array("\r\n", "\r", "\n"), '', $line); |
|
432 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
433 | 433 | $date = $line; |
434 | 434 | } |
435 | 435 | if (trim($line) != '') { |
436 | 436 | if ($date == '') $date = date('Y/m/d H:m'); |
437 | 437 | $pos = 0; |
438 | - $pieces = preg_split('/\s/',$line); |
|
438 | + $pieces = preg_split('/\s/', $line); |
|
439 | 439 | if ($pieces[0] == 'METAR') $pos++; |
440 | 440 | if (strlen($pieces[$pos]) != 4) $pos++; |
441 | 441 | $location = $pieces[$pos]; |
442 | 442 | if (strlen($location == 4)) { |
443 | - $this->addMETAR($location,$line,$date); |
|
443 | + $this->addMETAR($location, $line, $date); |
|
444 | 444 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
445 | 445 | } else return array(); |
446 | 446 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public function parse_xml($url) { |
17 | 17 | $Common = new Common(); |
18 | - $filedata = $Common->getData($url,'get','','','','','','',true); |
|
18 | + $filedata = $Common->getData($url, 'get', '', '', '', '', '', '', true); |
|
19 | 19 | if ($filedata != '' && $filedata !== false) { |
20 | 20 | $xml = simplexml_load_string($filedata); |
21 | 21 | if ($xml !== false) { |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | if ($check_version == '0') { |
87 | 87 | |
88 | 88 | if ($globalDBdriver == 'mysql') { |
89 | - $error .= create_db::import_all_db('../db/'); |
|
89 | + $error .= create_db::import_all_db('../db/'); |
|
90 | 90 | } elseif ($globalDBdriver == 'pgsql') { |
91 | - $error .= create_db::import_all_db('../db/pgsql/'); |
|
91 | + $error .= create_db::import_all_db('../db/pgsql/'); |
|
92 | 92 | } |
93 | 93 | if ($error != '') { |
94 | 94 | $_SESSION['error'] = $error; |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | $_SESSION['install'] = 'populate'; |
99 | 99 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
100 | 100 | } else { |
101 | - $_SESSION['install'] = 'sources'; |
|
102 | - $_SESSION['next'] = 'Insert data in source table'; |
|
101 | + $_SESSION['install'] = 'sources'; |
|
102 | + $_SESSION['next'] = 'Insert data in source table'; |
|
103 | 103 | } |
104 | 104 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
105 | 105 | print json_encode($result); |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database')); |
157 | 157 | } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
158 | 158 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
159 | - $_SESSION['install'] = 'notam'; |
|
160 | - $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
|
161 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
162 | - print json_encode($result); |
|
159 | + $_SESSION['install'] = 'notam'; |
|
160 | + $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
|
161 | + $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
162 | + print json_encode($result); |
|
163 | 163 | /* |
164 | 164 | } elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
165 | 165 | $_SESSION['install'] = 'owner'; |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | print json_encode($result); |
170 | 170 | */ |
171 | 171 | } else { |
172 | - $_SESSION['install'] = 'sources'; |
|
173 | - $_SESSION['next'] = 'Insert data in source table'; |
|
174 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
175 | - print json_encode($result); |
|
172 | + $_SESSION['install'] = 'sources'; |
|
173 | + $_SESSION['next'] = 'Insert data in source table'; |
|
174 | + $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
175 | + print json_encode($result); |
|
176 | 176 | } |
177 | 177 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') { |
178 | 178 | if (!is_writable('tmp')) { |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | $globalDebug = FALSE; |
71 | 71 | $dbroot = $_SESSION['database_root']; |
72 | 72 | $dbrootpass = $_SESSION['database_rootpass']; |
73 | - $error .= create_db::create_database($dbroot,$dbrootpass,$globalDBuser,$globalDBpass,$globalDBname,$globalDBdriver,$globalDBhost); |
|
73 | + $error .= create_db::create_database($dbroot, $dbrootpass, $globalDBuser, $globalDBpass, $globalDBname, $globalDBdriver, $globalDBhost); |
|
74 | 74 | sleep(5); |
75 | 75 | if ($error != '') { |
76 | 76 | $_SESSION['error'] = $error; |
77 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create database')); |
|
78 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database')); |
|
77 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create database')); |
|
78 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Create database')); |
|
79 | 79 | $_SESSION['install'] = 'database_import'; |
80 | 80 | $_SESSION['next'] = 'Create and import tables'; |
81 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
81 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
82 | 82 | print json_encode($result); |
83 | 83 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'database_import') { |
84 | 84 | $globalDebug = FALSE; |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | } |
93 | 93 | if ($error != '') { |
94 | 94 | $_SESSION['error'] = $error; |
95 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
|
96 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
|
95 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create and import tables')); |
|
96 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Create and import tables')); |
|
97 | 97 | if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
98 | 98 | $_SESSION['install'] = 'populate'; |
99 | 99 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
@@ -101,24 +101,24 @@ discard block |
||
101 | 101 | $_SESSION['install'] = 'sources'; |
102 | 102 | $_SESSION['next'] = 'Insert data in source table'; |
103 | 103 | } |
104 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
104 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
105 | 105 | print json_encode($result); |
106 | 106 | } elseif (!is_numeric($check_version)) { |
107 | 107 | $error .= $check_version; |
108 | 108 | $_SESSION['error'] = $error; |
109 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
|
109 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create and import tables')); |
|
110 | 110 | if (!isset($_SESSION['next'])) $_SESSION['next'] = ''; |
111 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
111 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
112 | 112 | print json_encode($result); |
113 | 113 | } else { |
114 | 114 | $error .= update_schema::check_version(true); |
115 | 115 | if ($error != '') { |
116 | 116 | $_SESSION['error'] = $error; |
117 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Update schema if needed')); |
|
118 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
|
117 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Update schema if needed')); |
|
118 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Update schema if needed')); |
|
119 | 119 | $_SESSION['install'] = 'sources'; |
120 | 120 | $_SESSION['next'] = 'Insert data in source table'; |
121 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
121 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
122 | 122 | print json_encode($result); |
123 | 123 | } |
124 | 124 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'waypoints') { |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | $error .= update_db::update_waypoints(); |
128 | 128 | if ($error != '') { |
129 | 129 | $_SESSION['error'] = $error; |
130 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate waypoints database')); |
|
131 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database')); |
|
130 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate waypoints database')); |
|
131 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate waypoints database')); |
|
132 | 132 | /* |
133 | 133 | $_SESSION['install'] = 'airspace'; |
134 | 134 | $_SESSION['next'] = 'Populate airspace table'; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | $_SESSION['install'] = 'countries'; |
147 | 147 | $_SESSION['next'] = 'Populate countries table'; |
148 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
148 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
149 | 149 | print json_encode($result); |
150 | 150 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'countries') { |
151 | 151 | include_once('class.update_db.php'); |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | $error .= update_db::update_countries(); |
154 | 154 | if ($error != '') { |
155 | 155 | $_SESSION['error'] = $error; |
156 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database')); |
|
157 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
|
156 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate countries database')); |
|
157 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate countries database')); |
|
158 | 158 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
159 | 159 | $_SESSION['install'] = 'notam'; |
160 | 160 | $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
161 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
161 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
162 | 162 | print json_encode($result); |
163 | 163 | /* |
164 | 164 | } elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
@@ -171,15 +171,15 @@ discard block |
||
171 | 171 | } else { |
172 | 172 | $_SESSION['install'] = 'sources'; |
173 | 173 | $_SESSION['next'] = 'Insert data in source table'; |
174 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
174 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
175 | 175 | print json_encode($result); |
176 | 176 | } |
177 | 177 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') { |
178 | 178 | if (!is_writable('tmp')) { |
179 | 179 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
180 | 180 | $_SESSION['error'] = $error; |
181 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
182 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
181 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
182 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
183 | 183 | print json_encode($result); |
184 | 184 | } else { |
185 | 185 | include_once('class.update_db.php'); |
@@ -187,19 +187,19 @@ discard block |
||
187 | 187 | $error .= update_db::update_ModeS_fam(); |
188 | 188 | if ($error != '') { |
189 | 189 | $_SESSION['error'] = $error; |
190 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
191 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
190 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
191 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
192 | 192 | $_SESSION['install'] = 'populate_flarm'; |
193 | 193 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM'; |
194 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
194 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
195 | 195 | print json_encode($result); |
196 | 196 | } |
197 | 197 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate_flarm') { |
198 | 198 | if (!is_writable('tmp')) { |
199 | 199 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
200 | 200 | $_SESSION['error'] = $error; |
201 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
202 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
201 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
202 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
203 | 203 | print json_encode($result); |
204 | 204 | } else { |
205 | 205 | include_once('class.update_db.php'); |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | $error .= update_db::update_ModeS_ogn(); |
209 | 209 | if ($error != '') { |
210 | 210 | $_SESSION['error'] = $error; |
211 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
212 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
211 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
212 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
213 | 213 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
214 | 214 | $_SESSION['install'] = 'vatsim'; |
215 | 215 | if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
@@ -228,15 +228,15 @@ discard block |
||
228 | 228 | $_SESSION['install'] = 'routes'; |
229 | 229 | $_SESSION['next'] = 'Populate routes table with externals data'; |
230 | 230 | } |
231 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
231 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
232 | 232 | print json_encode($result); |
233 | 233 | } |
234 | 234 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'routes') { |
235 | 235 | if (!is_writable('tmp')) { |
236 | 236 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
237 | 237 | $_SESSION['error'] = $error; |
238 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
239 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
238 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
239 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
240 | 240 | print json_encode($result); |
241 | 241 | } else { |
242 | 242 | include_once('class.update_db.php'); |
@@ -244,19 +244,19 @@ discard block |
||
244 | 244 | $error .= update_db::update_routes_fam(); |
245 | 245 | if ($error != '') { |
246 | 246 | $_SESSION['error'] = $error; |
247 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate routes table with externals data')); |
|
248 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data')); |
|
247 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate routes table with externals data')); |
|
248 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate routes table with externals data')); |
|
249 | 249 | $_SESSION['install'] = 'translation'; |
250 | 250 | $_SESSION['next'] = 'Populate translation table with externals data'; |
251 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
251 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
252 | 252 | print json_encode($result); |
253 | 253 | } |
254 | 254 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'translation') { |
255 | 255 | if (!is_writable('tmp')) { |
256 | 256 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
257 | 257 | $_SESSION['error'] = $error; |
258 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data')); |
|
259 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
258 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate translation table with externals data')); |
|
259 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
260 | 260 | print json_encode($result); |
261 | 261 | } else { |
262 | 262 | include_once('class.update_db.php'); |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | $error .= update_db::update_translation_fam(); |
265 | 265 | if ($error != '') { |
266 | 266 | $_SESSION['error'] = $error; |
267 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data')); |
|
268 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data')); |
|
267 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate translation table with externals data')); |
|
268 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate translation table with externals data')); |
|
269 | 269 | if ($_SESSION['waypoints'] == 1) { |
270 | 270 | $_SESSION['install'] = 'waypoints'; |
271 | 271 | $_SESSION['next'] = 'Populate waypoints table'; |
@@ -283,15 +283,15 @@ discard block |
||
283 | 283 | $_SESSION['install'] = 'sources'; |
284 | 284 | $_SESSION['next'] = 'Insert data in source table'; |
285 | 285 | } |
286 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
286 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
287 | 287 | print json_encode($result); |
288 | 288 | } |
289 | 289 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'owner') { |
290 | 290 | if (!is_writable('tmp')) { |
291 | 291 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
292 | 292 | $_SESSION['error'] = $error; |
293 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data')); |
|
294 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
293 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate owner table with externals data')); |
|
294 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
295 | 295 | print json_encode($result); |
296 | 296 | } else { |
297 | 297 | include_once('class.update_db.php'); |
@@ -299,19 +299,19 @@ discard block |
||
299 | 299 | $error = update_db::update_owner_fam(); |
300 | 300 | if ($error != '') { |
301 | 301 | $_SESSION['error'] = $error; |
302 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data')); |
|
303 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data')); |
|
302 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate owner table with externals data')); |
|
303 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate owner table with externals data')); |
|
304 | 304 | $_SESSION['install'] = 'sources'; |
305 | 305 | $_SESSION['next'] = 'Insert data in source table'; |
306 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
306 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
307 | 307 | print json_encode($result); |
308 | 308 | } |
309 | 309 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'notam') { |
310 | 310 | if (!is_writable('tmp')) { |
311 | 311 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
312 | 312 | $_SESSION['error'] = $error; |
313 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data')); |
|
314 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
313 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data')); |
|
314 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
315 | 315 | print json_encode($result); |
316 | 316 | } else { |
317 | 317 | include_once('class.update_db.php'); |
@@ -320,13 +320,13 @@ discard block |
||
320 | 320 | $error .= update_db::update_notam(); |
321 | 321 | if ($error != '') { |
322 | 322 | $_SESSION['error'] = $error; |
323 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data')); |
|
324 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data')); |
|
323 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data')); |
|
324 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data')); |
|
325 | 325 | } else { |
326 | 326 | if ($error != '') { |
327 | 327 | $_SESSION['error'] = $error; |
328 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data (no source defined)')); |
|
329 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)')); |
|
328 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data (no source defined)')); |
|
329 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data (no source defined)')); |
|
330 | 330 | } |
331 | 331 | /* |
332 | 332 | if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | */ |
340 | 340 | $_SESSION['install'] = 'sources'; |
341 | 341 | $_SESSION['next'] = 'Insert data in source table'; |
342 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
342 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
343 | 343 | print json_encode($result); |
344 | 344 | //} |
345 | 345 | } |
@@ -376,9 +376,9 @@ discard block |
||
376 | 376 | $Source = new Source(); |
377 | 377 | $Source->deleteAllLocation(); |
378 | 378 | foreach ($sources as $src) { |
379 | - if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png'); |
|
379 | + if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'], $src['latitude'], $src['longitude'], $src['altitude'], $src['city'], $src['country'], $src['source'], 'antenna.png'); |
|
380 | 380 | } |
381 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
|
381 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert data in source table')); |
|
382 | 382 | unset($_SESSION['sources']); |
383 | 383 | } |
384 | 384 | /* |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $_SESSION['install'] = 'finish'; |
404 | 404 | $_SESSION['next'] = 'finish'; |
405 | 405 | } |
406 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
406 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
407 | 407 | print json_encode($result); |
408 | 408 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'vatsim') { |
409 | 409 | include_once('../install/class.create_db.php'); |
@@ -415,48 +415,48 @@ discard block |
||
415 | 415 | $error .= update_db::update_IVAO(); |
416 | 416 | if ($error != '') { |
417 | 417 | $_SESSION['error'] = $error; |
418 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
|
419 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
418 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert IVAO data')); |
|
419 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
420 | 420 | } else { |
421 | 421 | $error .= update_db::update_vatsim(); |
422 | 422 | if ($error != '') { |
423 | 423 | $_SESSION['error'] = $error; |
424 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
|
425 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
424 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data')); |
|
425 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
426 | 426 | } |
427 | 427 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
428 | 428 | $error .= update_db::update_vatsim(); |
429 | 429 | if ($error != '') { |
430 | 430 | $_SESSION['error'] = $error; |
431 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
|
432 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
431 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data')); |
|
432 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
433 | 433 | } elseif (isset($globalIVAO) && $globalIVAO) { |
434 | 434 | if (file_exists('tmp/ivae_feb2013.zip')) { |
435 | 435 | $error .= update_db::update_IVAO(); |
436 | 436 | if ($error != '') { |
437 | 437 | $_SESSION['error'] = $error; |
438 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
|
439 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
438 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert IVAO data')); |
|
439 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
440 | 440 | } else { |
441 | 441 | $error .= update_db::update_vatsim(); |
442 | 442 | if ($error != '') { |
443 | 443 | $_SESSION['error'] = $error; |
444 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data (IVAO not found)')); |
|
445 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)')); |
|
444 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data (IVAO not found)')); |
|
445 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data (IVAO not found)')); |
|
446 | 446 | } |
447 | 447 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
448 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data')); |
|
448 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert phpVMS data')); |
|
449 | 449 | } |
450 | 450 | //$_SESSION['install'] = 'routes'; |
451 | 451 | //$_SESSION['next'] = 'Populate routes table with externals data'; |
452 | 452 | $_SESSION['install'] = 'finish'; |
453 | 453 | $_SESSION['next'] = 'finish'; |
454 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
454 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
455 | 455 | print json_encode($result); |
456 | 456 | } else { |
457 | 457 | //unset($_SESSION['install']); |
458 | 458 | $_SESSION['error'] = 'Unknwon task : '.$_SESSION['install']; |
459 | - $result = array('error' => 'Unknwon task : '.$_SESSION['install'],'done' => $_SESSION['done'],'next' => 'finish','install' => 'finish'); |
|
459 | + $result = array('error' => 'Unknwon task : '.$_SESSION['install'], 'done' => $_SESSION['done'], 'next' => 'finish', 'install' => 'finish'); |
|
460 | 460 | print json_encode($result); |
461 | 461 | } |
462 | 462 | ?> |
463 | 463 | \ No newline at end of file |
@@ -75,7 +75,9 @@ discard block |
||
75 | 75 | if ($error != '') { |
76 | 76 | $_SESSION['error'] = $error; |
77 | 77 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create database')); |
78 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database')); |
|
78 | + } else { |
|
79 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database')); |
|
80 | + } |
|
79 | 81 | $_SESSION['install'] = 'database_import'; |
80 | 82 | $_SESSION['next'] = 'Create and import tables'; |
81 | 83 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -93,7 +95,9 @@ discard block |
||
93 | 95 | if ($error != '') { |
94 | 96 | $_SESSION['error'] = $error; |
95 | 97 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
96 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
|
98 | + } else { |
|
99 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
|
100 | + } |
|
97 | 101 | if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
98 | 102 | $_SESSION['install'] = 'populate'; |
99 | 103 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
@@ -107,7 +111,9 @@ discard block |
||
107 | 111 | $error .= $check_version; |
108 | 112 | $_SESSION['error'] = $error; |
109 | 113 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
110 | - if (!isset($_SESSION['next'])) $_SESSION['next'] = ''; |
|
114 | + if (!isset($_SESSION['next'])) { |
|
115 | + $_SESSION['next'] = ''; |
|
116 | + } |
|
111 | 117 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
112 | 118 | print json_encode($result); |
113 | 119 | } else { |
@@ -115,7 +121,9 @@ discard block |
||
115 | 121 | if ($error != '') { |
116 | 122 | $_SESSION['error'] = $error; |
117 | 123 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Update schema if needed')); |
118 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
|
124 | + } else { |
|
125 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
|
126 | + } |
|
119 | 127 | $_SESSION['install'] = 'sources'; |
120 | 128 | $_SESSION['next'] = 'Insert data in source table'; |
121 | 129 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -128,8 +136,10 @@ discard block |
||
128 | 136 | if ($error != '') { |
129 | 137 | $_SESSION['error'] = $error; |
130 | 138 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate waypoints database')); |
131 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database')); |
|
132 | -/* |
|
139 | + } else { |
|
140 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database')); |
|
141 | + } |
|
142 | + /* |
|
133 | 143 | $_SESSION['install'] = 'airspace'; |
134 | 144 | $_SESSION['next'] = 'Populate airspace table'; |
135 | 145 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -154,7 +164,9 @@ discard block |
||
154 | 164 | if ($error != '') { |
155 | 165 | $_SESSION['error'] = $error; |
156 | 166 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database')); |
157 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
|
167 | + } else { |
|
168 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
|
169 | + } |
|
158 | 170 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
159 | 171 | $_SESSION['install'] = 'notam'; |
160 | 172 | $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
@@ -188,7 +200,9 @@ discard block |
||
188 | 200 | if ($error != '') { |
189 | 201 | $_SESSION['error'] = $error; |
190 | 202 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
191 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
203 | + } else { |
|
204 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
205 | + } |
|
192 | 206 | $_SESSION['install'] = 'populate_flarm'; |
193 | 207 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM'; |
194 | 208 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -209,18 +223,26 @@ discard block |
||
209 | 223 | if ($error != '') { |
210 | 224 | $_SESSION['error'] = $error; |
211 | 225 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM')); |
212 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
226 | + } else { |
|
227 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
228 | + } |
|
213 | 229 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
214 | 230 | $_SESSION['install'] = 'vatsim'; |
215 | - if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
|
216 | - else $_SESSION['next'] = 'Insert VATSIM data'; |
|
231 | + if (file_exists('tmp/ivae_feb2013.zip')) { |
|
232 | + $_SESSION['next'] = 'Insert IVAO data'; |
|
233 | + } else { |
|
234 | + $_SESSION['next'] = 'Insert VATSIM data'; |
|
235 | + } |
|
217 | 236 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
218 | 237 | $_SESSION['install'] = 'vatsim'; |
219 | 238 | $_SESSION['next'] = 'Insert VATSIM data'; |
220 | 239 | } elseif (isset($globalIVAO) && $globalIVAO) { |
221 | 240 | $_SESSION['install'] = 'vatsim'; |
222 | - if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
|
223 | - else $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)'; |
|
241 | + if (file_exists('tmp/ivae_feb2013.zip')) { |
|
242 | + $_SESSION['next'] = 'Insert IVAO data'; |
|
243 | + } else { |
|
244 | + $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)'; |
|
245 | + } |
|
224 | 246 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
225 | 247 | $_SESSION['install'] = 'vatsim'; |
226 | 248 | $_SESSION['next'] = 'Insert phpVMS data'; |
@@ -245,7 +267,9 @@ discard block |
||
245 | 267 | if ($error != '') { |
246 | 268 | $_SESSION['error'] = $error; |
247 | 269 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate routes table with externals data')); |
248 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data')); |
|
270 | + } else { |
|
271 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data')); |
|
272 | + } |
|
249 | 273 | $_SESSION['install'] = 'translation'; |
250 | 274 | $_SESSION['next'] = 'Populate translation table with externals data'; |
251 | 275 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -265,7 +289,9 @@ discard block |
||
265 | 289 | if ($error != '') { |
266 | 290 | $_SESSION['error'] = $error; |
267 | 291 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data')); |
268 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data')); |
|
292 | + } else { |
|
293 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data')); |
|
294 | + } |
|
269 | 295 | if ($_SESSION['waypoints'] == 1) { |
270 | 296 | $_SESSION['install'] = 'waypoints'; |
271 | 297 | $_SESSION['next'] = 'Populate waypoints table'; |
@@ -300,7 +326,9 @@ discard block |
||
300 | 326 | if ($error != '') { |
301 | 327 | $_SESSION['error'] = $error; |
302 | 328 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data')); |
303 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data')); |
|
329 | + } else { |
|
330 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data')); |
|
331 | + } |
|
304 | 332 | $_SESSION['install'] = 'sources'; |
305 | 333 | $_SESSION['next'] = 'Insert data in source table'; |
306 | 334 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -321,12 +349,16 @@ discard block |
||
321 | 349 | if ($error != '') { |
322 | 350 | $_SESSION['error'] = $error; |
323 | 351 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data')); |
324 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data')); |
|
352 | + } else { |
|
353 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data')); |
|
354 | + } |
|
325 | 355 | } else { |
326 | 356 | if ($error != '') { |
327 | 357 | $_SESSION['error'] = $error; |
328 | 358 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data (no source defined)')); |
329 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)')); |
|
359 | + } else { |
|
360 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)')); |
|
361 | + } |
|
330 | 362 | } |
331 | 363 | /* |
332 | 364 | if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
@@ -376,7 +408,9 @@ discard block |
||
376 | 408 | $Source = new Source(); |
377 | 409 | $Source->deleteAllLocation(); |
378 | 410 | foreach ($sources as $src) { |
379 | - if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png'); |
|
411 | + if (isset($src['latitude']) && $src['latitude'] != '') { |
|
412 | + $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png'); |
|
413 | + } |
|
380 | 414 | } |
381 | 415 | $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
382 | 416 | unset($_SESSION['sources']); |
@@ -387,15 +421,21 @@ discard block |
||
387 | 421 | */ |
388 | 422 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
389 | 423 | $_SESSION['install'] = 'vatsim'; |
390 | - if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
|
391 | - else $_SESSION['next'] = 'Insert VATSIM data'; |
|
424 | + if (file_exists('tmp/ivae_feb2013.zip')) { |
|
425 | + $_SESSION['next'] = 'Insert IVAO data'; |
|
426 | + } else { |
|
427 | + $_SESSION['next'] = 'Insert VATSIM data'; |
|
428 | + } |
|
392 | 429 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
393 | 430 | $_SESSION['install'] = 'vatsim'; |
394 | 431 | $_SESSION['next'] = 'Insert VATSIM data'; |
395 | 432 | } elseif (isset($globalIVAO) && $globalIVAO) { |
396 | 433 | $_SESSION['install'] = 'vatsim'; |
397 | - if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
|
398 | - else $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)'; |
|
434 | + if (file_exists('tmp/ivae_feb2013.zip')) { |
|
435 | + $_SESSION['next'] = 'Insert IVAO data'; |
|
436 | + } else { |
|
437 | + $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)'; |
|
438 | + } |
|
399 | 439 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
400 | 440 | $_SESSION['install'] = 'vatsim'; |
401 | 441 | $_SESSION['next'] = 'Insert phpVMS data'; |
@@ -416,33 +456,43 @@ discard block |
||
416 | 456 | if ($error != '') { |
417 | 457 | $_SESSION['error'] = $error; |
418 | 458 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
419 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
459 | + } else { |
|
460 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
461 | + } |
|
420 | 462 | } else { |
421 | 463 | $error .= update_db::update_vatsim(); |
422 | 464 | if ($error != '') { |
423 | 465 | $_SESSION['error'] = $error; |
424 | 466 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
425 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
467 | + } else { |
|
468 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
469 | + } |
|
426 | 470 | } |
427 | 471 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
428 | 472 | $error .= update_db::update_vatsim(); |
429 | 473 | if ($error != '') { |
430 | 474 | $_SESSION['error'] = $error; |
431 | 475 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
432 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
476 | + } else { |
|
477 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
478 | + } |
|
433 | 479 | } elseif (isset($globalIVAO) && $globalIVAO) { |
434 | 480 | if (file_exists('tmp/ivae_feb2013.zip')) { |
435 | 481 | $error .= update_db::update_IVAO(); |
436 | 482 | if ($error != '') { |
437 | 483 | $_SESSION['error'] = $error; |
438 | 484 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
439 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
485 | + } else { |
|
486 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
487 | + } |
|
440 | 488 | } else { |
441 | 489 | $error .= update_db::update_vatsim(); |
442 | 490 | if ($error != '') { |
443 | 491 | $_SESSION['error'] = $error; |
444 | 492 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data (IVAO not found)')); |
445 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)')); |
|
493 | + } else { |
|
494 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)')); |
|
495 | + } |
|
446 | 496 | } |
447 | 497 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
448 | 498 | $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data')); |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | <p> |
189 | 189 | <label for="siteurl">Site directory</label> |
190 | 190 | <?php |
191 | - // Try to detect site directory |
|
192 | - if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
|
191 | + // Try to detect site directory |
|
192 | + if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
|
193 | 193 | if (isset($_SERVER['REQUEST_URI'])) { |
194 | 194 | $URL = $_SERVER['REQUEST_URI']; |
195 | 195 | $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
196 | 196 | } |
197 | - } |
|
197 | + } |
|
198 | 198 | ?> |
199 | 199 | <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
200 | 200 | <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
@@ -373,17 +373,17 @@ discard block |
||
373 | 373 | </tr> |
374 | 374 | |
375 | 375 | <?php |
376 | - if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') { |
|
376 | + if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') { |
|
377 | 377 | ?> |
378 | 378 | <!-- |
379 | 379 | <?php |
380 | - require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
381 | - $Connection = new Connection(); |
|
380 | + require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
381 | + $Connection = new Connection(); |
|
382 | 382 | ?> |
383 | 383 | --> |
384 | 384 | <?php |
385 | 385 | if ($Connection->db != NULL) { |
386 | - if ($Connection->tableExists('source_location')) { |
|
386 | + if ($Connection->tableExists('source_location')) { |
|
387 | 387 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
388 | 388 | $Source = new Source(); |
389 | 389 | //$alllocations = $Source->getAllLocationInfo(); |
@@ -403,9 +403,9 @@ discard block |
||
403 | 403 | |
404 | 404 | <?php |
405 | 405 | } |
406 | - } |
|
406 | + } |
|
407 | + } |
|
407 | 408 | } |
408 | - } |
|
409 | 409 | ?> |
410 | 410 | |
411 | 411 | <tr> |
@@ -515,12 +515,12 @@ discard block |
||
515 | 515 | ?> |
516 | 516 | <tr> |
517 | 517 | <?php |
518 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
518 | + if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
519 | 519 | ?> |
520 | 520 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
521 | 521 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
522 | 522 | <?php |
523 | - } else { |
|
523 | + } else { |
|
524 | 524 | $hostport = explode(':',$source['host']); |
525 | 525 | if (isset($hostport[1])) { |
526 | 526 | $host = $hostport[0]; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | <td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td> |
534 | 534 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php print $port; ?>" /></td> |
535 | 535 | <?php |
536 | - } |
|
536 | + } |
|
537 | 537 | ?> |
538 | 538 | <td> |
539 | 539 | <select name="format[]" id="format"> |
@@ -673,9 +673,9 @@ discard block |
||
673 | 673 | </thead> |
674 | 674 | <tbody> |
675 | 675 | <?php |
676 | - if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) { |
|
676 | + if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) { |
|
677 | 677 | foreach ($globalNewsFeeds as $type => $feedslng) { |
678 | - foreach ($feedslng as $lng => $feeds) { |
|
678 | + foreach ($feedslng as $lng => $feeds) { |
|
679 | 679 | foreach ($feeds as $feed) { |
680 | 680 | ?> |
681 | 681 | <tr> |
@@ -700,9 +700,9 @@ discard block |
||
700 | 700 | |
701 | 701 | <?php |
702 | 702 | } |
703 | - } |
|
703 | + } |
|
704 | + } |
|
704 | 705 | } |
705 | - } |
|
706 | 706 | ?> |
707 | 707 | <tr> |
708 | 708 | <td><input type="url" name="newsurl[]" /></td> |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | <br /> |
1093 | 1093 | <p> |
1094 | 1094 | <?php |
1095 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
1095 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
1096 | 1096 | ?> |
1097 | 1097 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
1098 | 1098 | <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
@@ -1102,11 +1102,11 @@ discard block |
||
1102 | 1102 | <b>The directory cache is not writable, aircraft icon will not be cached</b> |
1103 | 1103 | <?php |
1104 | 1104 | } |
1105 | - } else { |
|
1105 | + } else { |
|
1106 | 1106 | ?> |
1107 | 1107 | <b>PHP GD is not installed, you can't change color of aircraft icon on map</b> |
1108 | 1108 | <?php |
1109 | - } |
|
1109 | + } |
|
1110 | 1110 | ?> |
1111 | 1111 | </p> |
1112 | 1112 | <br /> |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | </p> |
1131 | 1131 | <?php |
1132 | 1132 | require('../footer.php'); |
1133 | - exit; |
|
1133 | + exit; |
|
1134 | 1134 | } |
1135 | 1135 | // ' |
1136 | 1136 | $settings = array(); |
@@ -1221,8 +1221,8 @@ discard block |
||
1221 | 1221 | |
1222 | 1222 | $sources = array(); |
1223 | 1223 | foreach ($source_name as $keys => $name) { |
1224 | - 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]); |
|
1225 | - 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]); |
|
1224 | + 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]); |
|
1225 | + 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]); |
|
1226 | 1226 | } |
1227 | 1227 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1228 | 1228 | |
@@ -1232,13 +1232,13 @@ discard block |
||
1232 | 1232 | |
1233 | 1233 | $newsfeeds = array(); |
1234 | 1234 | foreach($newsurl as $newskey => $url) { |
1235 | - if ($url != '') { |
|
1235 | + if ($url != '') { |
|
1236 | 1236 | $type = $newstype[$newskey]; |
1237 | 1237 | $lng = $newslng[$newskey]; |
1238 | 1238 | if (isset($newsfeeds[$type][$lng])) { |
1239 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1239 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1240 | 1240 | } else $newsfeeds[$type][$lng] = array($url); |
1241 | - } |
|
1241 | + } |
|
1242 | 1242 | } |
1243 | 1243 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
1244 | 1244 | |
@@ -1681,14 +1681,14 @@ discard block |
||
1681 | 1681 | |
1682 | 1682 | // Set some defaults values... |
1683 | 1683 | if (!isset($globalAircraftImageSources)) { |
1684 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1685 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1684 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1685 | + $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | if (!isset($globalSchedulesSources)) { |
1689 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1690 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1691 | - } |
|
1689 | + $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1690 | + $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1691 | + } |
|
1692 | 1692 | |
1693 | 1693 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1694 | 1694 | |
@@ -1736,21 +1736,21 @@ discard block |
||
1736 | 1736 | $popi = false; |
1737 | 1737 | $popw = false; |
1738 | 1738 | foreach ($_SESSION['done'] as $done) { |
1739 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1740 | - if ($done == 'Create database') $pop = true; |
|
1741 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1742 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1743 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1739 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1740 | + if ($done == 'Create database') $pop = true; |
|
1741 | + if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1742 | + if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1743 | + if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1744 | 1744 | } |
1745 | 1745 | if ($pop) { |
1746 | - sleep(5); |
|
1747 | - print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1746 | + sleep(5); |
|
1747 | + print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1748 | 1748 | } else if ($popi) { |
1749 | - sleep(5); |
|
1750 | - print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1749 | + sleep(5); |
|
1750 | + print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1751 | 1751 | } else if ($popw) { |
1752 | - sleep(5); |
|
1753 | - print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1752 | + sleep(5); |
|
1753 | + print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1754 | 1754 | } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
1755 | 1755 | print '</div></ul>'; |
1756 | 1756 | print '<div id="error"></div>'; |
@@ -1816,7 +1816,7 @@ discard block |
||
1816 | 1816 | unset($_COOKIE['install']); |
1817 | 1817 | print '<div class="info column"><ul>'; |
1818 | 1818 | foreach ($_SESSION['done'] as $done) { |
1819 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1819 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1820 | 1820 | } |
1821 | 1821 | print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>'; |
1822 | 1822 | print '</ul></div>'; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | require_once(dirname(__FILE__).'/class.create_db.php'); |
23 | 23 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
24 | 24 | require_once(dirname(__FILE__).'/class.settings.php'); |
25 | -$title="Install"; |
|
25 | +$title = "Install"; |
|
26 | 26 | require(dirname(__FILE__).'/../require/settings.php'); |
27 | 27 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
28 | 28 | require(dirname(__FILE__).'/header.php'); |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | if (!extension_loaded('curl')) { |
94 | 94 | $error[] = "Curl is not loaded."; |
95 | 95 | } |
96 | - if(function_exists('apache_get_modules') ){ |
|
97 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
96 | + if (function_exists('apache_get_modules')) { |
|
97 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
98 | 98 | $error[] = "mod_rewrite is not available."; |
99 | 99 | } |
100 | 100 | /* |
@@ -113,22 +113,22 @@ discard block |
||
113 | 113 | $alllng = $Language->listLocaleDir(); |
114 | 114 | if (count($alllng) != count($availablelng)) { |
115 | 115 | $notavailable = array(); |
116 | - foreach($alllng as $lng) { |
|
116 | + foreach ($alllng as $lng) { |
|
117 | 117 | if (!isset($availablelng[$lng])) $notavailable[] = $lng; |
118 | 118 | } |
119 | - print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
119 | + print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ', $notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | print '<div class="alert alert-info">If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some tables can fail.</div>'; |
123 | 123 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
124 | 124 | if (function_exists('get_headers')) { |
125 | 125 | //$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
126 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'live/geojson?test',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
127 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
126 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'live/geojson?test', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
127 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
128 | 128 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
129 | 129 | } else { |
130 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
131 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
130 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'search', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
131 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
132 | 132 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
133 | 133 | } |
134 | 134 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
209 | 209 | if (isset($_SERVER['REQUEST_URI'])) { |
210 | 210 | $URL = $_SERVER['REQUEST_URI']; |
211 | - $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
|
211 | + $globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL))); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | ?> |
@@ -538,13 +538,13 @@ discard block |
||
538 | 538 | ?> |
539 | 539 | <tr> |
540 | 540 | <?php |
541 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
541 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
542 | 542 | ?> |
543 | 543 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
544 | 544 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
545 | 545 | <?php |
546 | 546 | } else { |
547 | - $hostport = explode(':',$source['host']); |
|
547 | + $hostport = explode(':', $source['host']); |
|
548 | 548 | if (isset($hostport[1])) { |
549 | 549 | $host = $hostport[0]; |
550 | 550 | $port = $hostport[1]; |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | <select name="timezones[]" id="timezones"> |
596 | 596 | <?php |
597 | 597 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
598 | - foreach($timezonelist as $timezones){ |
|
598 | + foreach ($timezonelist as $timezones) { |
|
599 | 599 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
600 | 600 | print '<option selected>'.$timezones.'</option>'; |
601 | 601 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | <select name="timezones[]" id="timezones"> |
652 | 652 | <?php |
653 | 653 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
654 | - foreach($timezonelist as $timezones){ |
|
654 | + foreach ($timezonelist as $timezones) { |
|
655 | 655 | if ($timezones == 'UTC') { |
656 | 656 | print '<option selected>'.$timezones.'</option>'; |
657 | 657 | } else print '<option>'.$timezones.'</option>'; |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | <br /> |
1115 | 1115 | <p> |
1116 | 1116 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1117 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1117 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
1118 | 1118 | </p> |
1119 | 1119 | <br /> |
1120 | 1120 | <p> |
@@ -1176,14 +1176,14 @@ discard block |
||
1176 | 1176 | $error = ''; |
1177 | 1177 | |
1178 | 1178 | if (isset($_POST['dbtype'])) { |
1179 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
1180 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
1181 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
1182 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
1183 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
1184 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
1185 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
1186 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
1179 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
1180 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
1181 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
1182 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
1183 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
1184 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
1185 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
1186 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
1187 | 1187 | |
1188 | 1188 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
1189 | 1189 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -1203,49 +1203,49 @@ discard block |
||
1203 | 1203 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
1204 | 1204 | */ |
1205 | 1205 | |
1206 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
1206 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
1207 | 1207 | |
1208 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
1209 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
1210 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
1211 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
1212 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
1208 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
1209 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
1210 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
1211 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
1212 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
1213 | 1213 | |
1214 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
1215 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
1216 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
1217 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
1218 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
1219 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
1220 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
1221 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
1222 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
1223 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1214 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
1215 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
1216 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
1217 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
1218 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
1219 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
1220 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
1221 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
1222 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
1223 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1224 | 1224 | |
1225 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
1226 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
1227 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
1228 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
1229 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
1230 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
1225 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
1226 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
1227 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
1228 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
1229 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
1230 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
1231 | 1231 | |
1232 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
1233 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
1232 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
1233 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
1234 | 1234 | |
1235 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
1236 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
1237 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
1235 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
1236 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
1237 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
1238 | 1238 | |
1239 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
1239 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
1240 | 1240 | if ($acars == 'acars') { |
1241 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
1241 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
1242 | 1242 | } else { |
1243 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
1243 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1244 | 1244 | } |
1245 | 1245 | |
1246 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1247 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1248 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1246 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1247 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1248 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1249 | 1249 | |
1250 | 1250 | $source_name = $_POST['source_name']; |
1251 | 1251 | $source_latitude = $_POST['source_latitude']; |
@@ -1259,8 +1259,8 @@ discard block |
||
1259 | 1259 | |
1260 | 1260 | $sources = array(); |
1261 | 1261 | foreach ($source_name as $keys => $name) { |
1262 | - 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]); |
|
1263 | - 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]); |
|
1262 | + 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]); |
|
1263 | + 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]); |
|
1264 | 1264 | } |
1265 | 1265 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1266 | 1266 | |
@@ -1269,16 +1269,16 @@ discard block |
||
1269 | 1269 | $newstype = $_POST['newstype']; |
1270 | 1270 | |
1271 | 1271 | $newsfeeds = array(); |
1272 | - foreach($newsurl as $newskey => $url) { |
|
1272 | + foreach ($newsurl as $newskey => $url) { |
|
1273 | 1273 | if ($url != '') { |
1274 | 1274 | $type = $newstype[$newskey]; |
1275 | 1275 | $lng = $newslng[$newskey]; |
1276 | 1276 | if (isset($newsfeeds[$type][$lng])) { |
1277 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1277 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url)); |
|
1278 | 1278 | } else $newsfeeds[$type][$lng] = array($url); |
1279 | 1279 | } |
1280 | 1280 | } |
1281 | - $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
|
1281 | + $settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds)); |
|
1282 | 1282 | |
1283 | 1283 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
1284 | 1284 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1289,28 +1289,28 @@ discard block |
||
1289 | 1289 | $sbsurl = $_POST['sbsurl']; |
1290 | 1290 | */ |
1291 | 1291 | |
1292 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1293 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1294 | - $globalvm = filter_input(INPUT_POST,'globalvm',FILTER_SANITIZE_STRING); |
|
1295 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1296 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1297 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1298 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1299 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1300 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1292 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1293 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1294 | + $globalvm = filter_input(INPUT_POST, 'globalvm', FILTER_SANITIZE_STRING); |
|
1295 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1296 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1297 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1298 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1299 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1300 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1301 | 1301 | |
1302 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1303 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1304 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1305 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1306 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1307 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1308 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1309 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1310 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1311 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1312 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1313 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1302 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1303 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1304 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1305 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1306 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1307 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1308 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1309 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1310 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1311 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1312 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1313 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1314 | 1314 | |
1315 | 1315 | /* |
1316 | 1316 | $globalSBS1Hosts = array(); |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | } |
1327 | 1327 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1328 | 1328 | */ |
1329 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1329 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1330 | 1330 | $host = $_POST['host']; |
1331 | 1331 | $port = $_POST['port']; |
1332 | 1332 | $name = $_POST['name']; |
@@ -1343,115 +1343,115 @@ discard block |
||
1343 | 1343 | else $cov = 'FALSE'; |
1344 | 1344 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1345 | 1345 | else $arch = 'FALSE'; |
1346 | - if (strpos($format[$key],'_callback')) { |
|
1347 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1346 | + if (strpos($format[$key], '_callback')) { |
|
1347 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1348 | 1348 | } elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) { |
1349 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1349 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1350 | 1350 | } |
1351 | 1351 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1352 | 1352 | } |
1353 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1353 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1354 | 1354 | |
1355 | 1355 | /* |
1356 | 1356 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1357 | 1357 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1358 | 1358 | */ |
1359 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1360 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1361 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1359 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1360 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1361 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1362 | 1362 | |
1363 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1364 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1363 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1364 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1365 | 1365 | |
1366 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1367 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1366 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1367 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1368 | 1368 | |
1369 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
1370 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
1369 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
1370 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
1371 | 1371 | |
1372 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1373 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1374 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1375 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1372 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1373 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1374 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1375 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1376 | 1376 | |
1377 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1378 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1379 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1377 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1378 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1379 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1380 | 1380 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1381 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1382 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1381 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1382 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1383 | 1383 | |
1384 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1385 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1386 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1387 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1388 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1389 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1390 | - $minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT); |
|
1391 | - $settings = array_merge($settings,array('globalMinFetch' => $minfetch)); |
|
1392 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1393 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1384 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1385 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1386 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1387 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1388 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1389 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1390 | + $minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT); |
|
1391 | + $settings = array_merge($settings, array('globalMinFetch' => $minfetch)); |
|
1392 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1393 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1394 | 1394 | |
1395 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1396 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1395 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1396 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1397 | 1397 | |
1398 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1399 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1398 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1399 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1400 | 1400 | |
1401 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1401 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1402 | 1402 | if ($archiveyear == "archiveyear") { |
1403 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1403 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1404 | 1404 | } else { |
1405 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1405 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1406 | 1406 | } |
1407 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1408 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1409 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1410 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1407 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1408 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1409 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1410 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1411 | 1411 | |
1412 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1413 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1414 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1415 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1412 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1413 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1414 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1415 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1416 | 1416 | |
1417 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1418 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1419 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1417 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1418 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1419 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1420 | 1420 | |
1421 | 1421 | // Create in settings.php keys not yet configurable if not already here |
1422 | 1422 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1423 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1423 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1424 | 1424 | |
1425 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1425 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1426 | 1426 | if ($resetyearstats == 'resetyearstats') { |
1427 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1427 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1428 | 1428 | } else { |
1429 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1429 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1430 | 1430 | } |
1431 | 1431 | |
1432 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1432 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1433 | 1433 | if ($archive == 'archive') { |
1434 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1434 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1435 | 1435 | } else { |
1436 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1436 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1437 | 1437 | } |
1438 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
1438 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
1439 | 1439 | if ($archiveresults == 'archiveresults') { |
1440 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
1440 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
1441 | 1441 | } else { |
1442 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
1442 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
1443 | 1443 | } |
1444 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1444 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1445 | 1445 | if ($daemon == 'daemon') { |
1446 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1446 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1447 | 1447 | } else { |
1448 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1448 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1449 | 1449 | } |
1450 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1450 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1451 | 1451 | if ($schedules == 'schedules') { |
1452 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1452 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1453 | 1453 | } else { |
1454 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1454 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1455 | 1455 | } |
1456 | 1456 | |
1457 | 1457 | /* |
@@ -1462,290 +1462,290 @@ discard block |
||
1462 | 1462 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1463 | 1463 | } |
1464 | 1464 | */ |
1465 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1466 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1467 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1468 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1469 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1465 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1466 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1467 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1468 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1469 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1470 | 1470 | $va = false; |
1471 | 1471 | if ($globalivao == 'ivao') { |
1472 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1472 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1473 | 1473 | $va = true; |
1474 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1474 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1475 | 1475 | if ($globalvatsim == 'vatsim') { |
1476 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1476 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1477 | 1477 | $va = true; |
1478 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1478 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1479 | 1479 | if ($globalphpvms == 'phpvms') { |
1480 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1480 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1481 | 1481 | $va = true; |
1482 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1482 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1483 | 1483 | if ($globalvam == 'vam') { |
1484 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1484 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1485 | 1485 | $va = true; |
1486 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1486 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1487 | 1487 | if ($va) { |
1488 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1489 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1488 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1489 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1490 | 1490 | if ($globalva == 'va' || $va) { |
1491 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1492 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1491 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1492 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1493 | 1493 | } else { |
1494 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1495 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1496 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1494 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1495 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1496 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1497 | 1497 | } |
1498 | 1498 | if ($globalvm == 'vm') { |
1499 | - $settings = array_merge($settings,array('globalVM' => 'TRUE')); |
|
1499 | + $settings = array_merge($settings, array('globalVM' => 'TRUE')); |
|
1500 | 1500 | } else { |
1501 | - $settings = array_merge($settings,array('globalVM' => 'FALSE')); |
|
1501 | + $settings = array_merge($settings, array('globalVM' => 'FALSE')); |
|
1502 | 1502 | } |
1503 | 1503 | |
1504 | - $mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING); |
|
1504 | + $mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING); |
|
1505 | 1505 | if ($mapoffline == 'mapoffline') { |
1506 | - $settings = array_merge($settings,array('globalMapOffline' => 'TRUE')); |
|
1506 | + $settings = array_merge($settings, array('globalMapOffline' => 'TRUE')); |
|
1507 | 1507 | } else { |
1508 | - $settings = array_merge($settings,array('globalMapOffline' => 'FALSE')); |
|
1508 | + $settings = array_merge($settings, array('globalMapOffline' => 'FALSE')); |
|
1509 | 1509 | } |
1510 | - $globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING); |
|
1510 | + $globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING); |
|
1511 | 1511 | if ($globaloffline == 'globaloffline') { |
1512 | - $settings = array_merge($settings,array('globalOffline' => 'TRUE')); |
|
1512 | + $settings = array_merge($settings, array('globalOffline' => 'TRUE')); |
|
1513 | 1513 | } else { |
1514 | - $settings = array_merge($settings,array('globalOffline' => 'FALSE')); |
|
1514 | + $settings = array_merge($settings, array('globalOffline' => 'FALSE')); |
|
1515 | 1515 | } |
1516 | 1516 | |
1517 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1517 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1518 | 1518 | if ($notam == 'notam') { |
1519 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1519 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1520 | 1520 | } else { |
1521 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1521 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1522 | 1522 | } |
1523 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1523 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1524 | 1524 | if ($owner == 'owner') { |
1525 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1525 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1526 | 1526 | } else { |
1527 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1527 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1528 | 1528 | } |
1529 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1529 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1530 | 1530 | if ($map3d == 'map3d') { |
1531 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1531 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1532 | 1532 | } else { |
1533 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1533 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1534 | 1534 | } |
1535 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1535 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1536 | 1536 | if ($crash == 'crash') { |
1537 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1537 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1538 | 1538 | } else { |
1539 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1539 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1540 | 1540 | } |
1541 | - $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING); |
|
1541 | + $fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING); |
|
1542 | 1542 | if ($fires == 'fires') { |
1543 | - $settings = array_merge($settings,array('globalMapFires' => 'TRUE')); |
|
1543 | + $settings = array_merge($settings, array('globalMapFires' => 'TRUE')); |
|
1544 | 1544 | } else { |
1545 | - $settings = array_merge($settings,array('globalMapFires' => 'FALSE')); |
|
1545 | + $settings = array_merge($settings, array('globalMapFires' => 'FALSE')); |
|
1546 | 1546 | } |
1547 | - $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING); |
|
1547 | + $firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING); |
|
1548 | 1548 | if ($firessupport == 'firessupport') { |
1549 | - $settings = array_merge($settings,array('globalFires' => 'TRUE')); |
|
1549 | + $settings = array_merge($settings, array('globalFires' => 'TRUE')); |
|
1550 | 1550 | } else { |
1551 | - $settings = array_merge($settings,array('globalFires' => 'FALSE')); |
|
1551 | + $settings = array_merge($settings, array('globalFires' => 'FALSE')); |
|
1552 | 1552 | } |
1553 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1553 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1554 | 1554 | if ($mapsatellites == 'mapsatellites') { |
1555 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1555 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1556 | 1556 | } else { |
1557 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1557 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1558 | 1558 | } |
1559 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1559 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1560 | 1560 | if ($map3ddefault == 'map3ddefault') { |
1561 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1561 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1562 | 1562 | } else { |
1563 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1563 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1564 | 1564 | } |
1565 | - $one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING); |
|
1565 | + $one3dmodel = filter_input(INPUT_POST, 'one3dmodel', FILTER_SANITIZE_STRING); |
|
1566 | 1566 | if ($one3dmodel == 'one3dmodel') { |
1567 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE')); |
|
1567 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'TRUE')); |
|
1568 | 1568 | } else { |
1569 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE')); |
|
1569 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'FALSE')); |
|
1570 | 1570 | } |
1571 | - $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING); |
|
1571 | + $map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING); |
|
1572 | 1572 | if ($map3dliveries == 'map3dliveries') { |
1573 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE')); |
|
1573 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE')); |
|
1574 | 1574 | } else { |
1575 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE')); |
|
1575 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE')); |
|
1576 | 1576 | } |
1577 | - $map3dshadows = filter_input(INPUT_POST,'map3dshadows',FILTER_SANITIZE_STRING); |
|
1577 | + $map3dshadows = filter_input(INPUT_POST, 'map3dshadows', FILTER_SANITIZE_STRING); |
|
1578 | 1578 | if ($map3dshadows == 'map3dshadows') { |
1579 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'TRUE')); |
|
1579 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'TRUE')); |
|
1580 | 1580 | } else { |
1581 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'FALSE')); |
|
1581 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'FALSE')); |
|
1582 | 1582 | } |
1583 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1583 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1584 | 1584 | if ($translate == 'translate') { |
1585 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1585 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1586 | 1586 | } else { |
1587 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1587 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1588 | 1588 | } |
1589 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1589 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1590 | 1590 | if ($realairlines == 'realairlines') { |
1591 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1591 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1592 | 1592 | } else { |
1593 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1593 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1594 | 1594 | } |
1595 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1595 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1596 | 1596 | if ($estimation == 'estimation') { |
1597 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1597 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1598 | 1598 | } else { |
1599 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1599 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1600 | 1600 | } |
1601 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1601 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1602 | 1602 | if ($metar == 'metar') { |
1603 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1603 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1604 | 1604 | } else { |
1605 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1605 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1606 | 1606 | } |
1607 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1607 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1608 | 1608 | if ($metarcycle == 'metarcycle') { |
1609 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1609 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1610 | 1610 | } else { |
1611 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1611 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1612 | 1612 | } |
1613 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1613 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1614 | 1614 | if ($fork == 'fork') { |
1615 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1615 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1616 | 1616 | } else { |
1617 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1617 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1620 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1621 | 1621 | if ($colormap == 'colormap') { |
1622 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1622 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1623 | 1623 | } else { |
1624 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1624 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1625 | 1625 | } |
1626 | 1626 | |
1627 | 1627 | if (isset($_POST['aircrafticoncolor'])) { |
1628 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1629 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1628 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1629 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1630 | 1630 | } |
1631 | 1631 | |
1632 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1633 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1632 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1633 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1634 | 1634 | |
1635 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1636 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1637 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1638 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1639 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1640 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1635 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1636 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1637 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1638 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1639 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1640 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1641 | 1641 | |
1642 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1642 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1643 | 1643 | if ($mappopup == 'mappopup') { |
1644 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1644 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1645 | 1645 | } else { |
1646 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1646 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1647 | 1647 | } |
1648 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1648 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1649 | 1649 | if ($airportpopup == 'airportpopup') { |
1650 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1650 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1651 | 1651 | } else { |
1652 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1652 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1653 | 1653 | } |
1654 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1654 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1655 | 1655 | if ($maphistory == 'maphistory') { |
1656 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1656 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1657 | 1657 | } else { |
1658 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1658 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1659 | 1659 | } |
1660 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1660 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1661 | 1661 | if ($maptooltip == 'maptooltip') { |
1662 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1662 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1663 | 1663 | } else { |
1664 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1664 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1665 | 1665 | } |
1666 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1666 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1667 | 1667 | if ($flightroute == 'flightroute') { |
1668 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1668 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1669 | 1669 | } else { |
1670 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1670 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1671 | 1671 | } |
1672 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1672 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1673 | 1673 | if ($flightremainingroute == 'flightremainingroute') { |
1674 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1674 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1675 | 1675 | } else { |
1676 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1676 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1677 | 1677 | } |
1678 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1678 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1679 | 1679 | if ($allflights == 'allflights') { |
1680 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1680 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1681 | 1681 | } else { |
1682 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1682 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1683 | 1683 | } |
1684 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1684 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1685 | 1685 | if ($bbox == 'bbox') { |
1686 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1686 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1687 | 1687 | } else { |
1688 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1688 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1689 | 1689 | } |
1690 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1690 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1691 | 1691 | if ($groundaltitude == 'groundaltitude') { |
1692 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1692 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1693 | 1693 | } else { |
1694 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1694 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1695 | 1695 | } |
1696 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1696 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1697 | 1697 | if ($waypoints == 'waypoints') { |
1698 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1698 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1699 | 1699 | } else { |
1700 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1700 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1701 | 1701 | } |
1702 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1702 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1703 | 1703 | if ($geoid == 'geoid') { |
1704 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1704 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1705 | 1705 | } else { |
1706 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1706 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1707 | 1707 | } |
1708 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1709 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1708 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1709 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1710 | 1710 | |
1711 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1711 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1712 | 1712 | if ($noairlines == 'noairlines') { |
1713 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1713 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1714 | 1714 | } else { |
1715 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1715 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1716 | 1716 | } |
1717 | 1717 | |
1718 | - $tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING); |
|
1718 | + $tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING); |
|
1719 | 1719 | if ($tsk == 'tsk') { |
1720 | - $settings = array_merge($settings,array('globalTSK' => 'TRUE')); |
|
1720 | + $settings = array_merge($settings, array('globalTSK' => 'TRUE')); |
|
1721 | 1721 | } else { |
1722 | - $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
|
1722 | + $settings = array_merge($settings, array('globalTSK' => 'FALSE')); |
|
1723 | 1723 | } |
1724 | - $mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING); |
|
1724 | + $mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING); |
|
1725 | 1725 | if ($mapmatching == 'mapmatching') { |
1726 | - $settings = array_merge($settings,array('globalMapMatching' => 'TRUE')); |
|
1726 | + $settings = array_merge($settings, array('globalMapMatching' => 'TRUE')); |
|
1727 | 1727 | } else { |
1728 | - $settings = array_merge($settings,array('globalMapMatching' => 'FALSE')); |
|
1728 | + $settings = array_merge($settings, array('globalMapMatching' => 'FALSE')); |
|
1729 | 1729 | } |
1730 | - $mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING); |
|
1731 | - $settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1732 | - $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
|
1733 | - $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
|
1730 | + $mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING); |
|
1731 | + $settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1732 | + $graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING); |
|
1733 | + $settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper)); |
|
1734 | 1734 | |
1735 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1735 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1736 | 1736 | |
1737 | 1737 | // Set some defaults values... |
1738 | 1738 | if (!isset($globalAircraftImageSources)) { |
1739 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1740 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1739 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1740 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1741 | 1741 | } |
1742 | 1742 | |
1743 | 1743 | if (!isset($globalSchedulesSources)) { |
1744 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1745 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1744 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1745 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1746 | 1746 | } |
1747 | 1747 | |
1748 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1748 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1749 | 1749 | |
1750 | 1750 | if ($error == '') settings::modify_settings($settings); |
1751 | 1751 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -4,11 +4,19 @@ discard block |
||
4 | 4 | if (isset($_SESSION['error'])) { |
5 | 5 | header('Content-Encoding: none;'); |
6 | 6 | echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.'; |
7 | - if (isset($_SESSION['error'])) unset($_SESSION['error']); |
|
8 | - if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']); |
|
9 | - if (isset($_SESSION['next'])) unset($_SESSION['next']); |
|
10 | - if (isset($_SESSION['install'])) unset($_SESSION['install']); |
|
11 | -} |
|
7 | + if (isset($_SESSION['error'])) { |
|
8 | + unset($_SESSION['error']); |
|
9 | + } |
|
10 | + if (isset($_SESSION['errorlst'])) { |
|
11 | + unset($_SESSION['errorlst']); |
|
12 | + } |
|
13 | + if (isset($_SESSION['next'])) { |
|
14 | + unset($_SESSION['next']); |
|
15 | + } |
|
16 | + if (isset($_SESSION['install'])) { |
|
17 | + unset($_SESSION['install']); |
|
18 | + } |
|
19 | + } |
|
12 | 20 | /* |
13 | 21 | if (isset($_SESSION['errorlst'])) { |
14 | 22 | header('Content-Encoding: none;'); |
@@ -114,7 +122,9 @@ discard block |
||
114 | 122 | if (count($alllng) != count($availablelng)) { |
115 | 123 | $notavailable = array(); |
116 | 124 | foreach($alllng as $lng) { |
117 | - if (!isset($availablelng[$lng])) $notavailable[] = $lng; |
|
125 | + if (!isset($availablelng[$lng])) { |
|
126 | + $notavailable[] = $lng; |
|
127 | + } |
|
118 | 128 | } |
119 | 129 | print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
120 | 130 | } |
@@ -175,31 +185,49 @@ discard block |
||
175 | 185 | </div> |
176 | 186 | <p> |
177 | 187 | <label for="dbhost">Database hostname</label> |
178 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
188 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
189 | + print $globalDBhost; |
|
190 | +} |
|
191 | +?>" /> |
|
179 | 192 | </p> |
180 | 193 | <p> |
181 | 194 | <label for="dbport">Database port</label> |
182 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
195 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
196 | + print $globalDBport; |
|
197 | +} |
|
198 | +?>" /> |
|
183 | 199 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
184 | 200 | </p> |
185 | 201 | <p> |
186 | 202 | <label for="dbname">Database name</label> |
187 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
203 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
204 | + print $globalDBname; |
|
205 | +} |
|
206 | +?>" /> |
|
188 | 207 | </p> |
189 | 208 | <p> |
190 | 209 | <label for="dbuser">Database user</label> |
191 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
210 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
211 | + print $globalDBuser; |
|
212 | +} |
|
213 | +?>" /> |
|
192 | 214 | </p> |
193 | 215 | <p> |
194 | 216 | <label for="dbuserpass">Database user password</label> |
195 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
217 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
218 | + print $globalDBpass; |
|
219 | +} |
|
220 | +?>" /> |
|
196 | 221 | </p> |
197 | 222 | </fieldset> |
198 | 223 | <fieldset id="site"> |
199 | 224 | <legend>Site configuration</legend> |
200 | 225 | <p> |
201 | 226 | <label for="sitename">Site name</label> |
202 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
227 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
228 | + print $globalName; |
|
229 | +} |
|
230 | +?>" /> |
|
203 | 231 | </p> |
204 | 232 | <p> |
205 | 233 | <label for="siteurl">Site directory</label> |
@@ -212,18 +240,27 @@ discard block |
||
212 | 240 | } |
213 | 241 | } |
214 | 242 | ?> |
215 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
243 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
244 | + print $globalURL; |
|
245 | +} |
|
246 | +?>" /> |
|
216 | 247 | <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
217 | 248 | <p class="help-block">Can be empty</p> |
218 | 249 | </p> |
219 | 250 | <p> |
220 | 251 | <label for="timezone">Timezone</label> |
221 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
252 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
253 | + print $globalTimezone; |
|
254 | +} |
|
255 | +?>" /> |
|
222 | 256 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
223 | 257 | </p> |
224 | 258 | <p> |
225 | 259 | <label for="language">Language</label> |
226 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
260 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
261 | + print $globalLanguage; |
|
262 | +} |
|
263 | +?>" /> |
|
227 | 264 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
228 | 265 | </p> |
229 | 266 | </fieldset> |
@@ -243,11 +280,17 @@ discard block |
||
243 | 280 | <div id="mapbox_data"> |
244 | 281 | <p> |
245 | 282 | <label for="mapboxid">Mapbox id</label> |
246 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
283 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
284 | + print $globalMapboxId; |
|
285 | +} |
|
286 | +?>" /> |
|
247 | 287 | </p> |
248 | 288 | <p> |
249 | 289 | <label for="mapboxtoken">Mapbox token</label> |
250 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
290 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
291 | + print $globalMapboxToken; |
|
292 | +} |
|
293 | +?>" /> |
|
251 | 294 | </p> |
252 | 295 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
253 | 296 | </div> |
@@ -255,7 +298,10 @@ discard block |
||
255 | 298 | <div id="google_data"> |
256 | 299 | <p> |
257 | 300 | <label for="googlekey">Google API key</label> |
258 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
301 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
302 | + print $globalGoogleAPIKey; |
|
303 | +} |
|
304 | +?>" /> |
|
259 | 305 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
260 | 306 | </p> |
261 | 307 | </div> |
@@ -263,7 +309,10 @@ discard block |
||
263 | 309 | <div id="bing_data"> |
264 | 310 | <p> |
265 | 311 | <label for="bingkey">Bing Map key</label> |
266 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
312 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
313 | + print $globalBingMapKey; |
|
314 | +} |
|
315 | +?>" /> |
|
267 | 316 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
268 | 317 | </p> |
269 | 318 | </div> |
@@ -271,7 +320,10 @@ discard block |
||
271 | 320 | <div id="mapquest_data"> |
272 | 321 | <p> |
273 | 322 | <label for="mapquestkey">MapQuest key</label> |
274 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
323 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
324 | + print $globalMapQuestKey; |
|
325 | +} |
|
326 | +?>" /> |
|
275 | 327 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
276 | 328 | </p> |
277 | 329 | </div> |
@@ -279,11 +331,17 @@ discard block |
||
279 | 331 | <div id="here_data"> |
280 | 332 | <p> |
281 | 333 | <label for="hereappid">Here App_Id</label> |
282 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
334 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
335 | + print $globalHereappId; |
|
336 | +} |
|
337 | +?>" /> |
|
283 | 338 | </p> |
284 | 339 | <p> |
285 | 340 | <label for="hereappcode">Here App_Code</label> |
286 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
341 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
342 | + print $globalHereappCode; |
|
343 | +} |
|
344 | +?>" /> |
|
287 | 345 | </p> |
288 | 346 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
289 | 347 | </div> |
@@ -291,7 +349,10 @@ discard block |
||
291 | 349 | <div id="openweathermap_data"> |
292 | 350 | <p> |
293 | 351 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
294 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
352 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
353 | + print $globalOpenWeatherMapKey; |
|
354 | +} |
|
355 | +?>" /> |
|
295 | 356 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
296 | 357 | </p> |
297 | 358 | </div> |
@@ -320,42 +381,86 @@ discard block |
||
320 | 381 | <legend>Coverage area</legend> |
321 | 382 | <p> |
322 | 383 | <label for="latitudemax">The maximum latitude (north)</label> |
323 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
384 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
385 | + print $globalLatitudeMax; |
|
386 | +} |
|
387 | +?>" /> |
|
324 | 388 | </p> |
325 | 389 | <p> |
326 | 390 | <label for="latitudemin">The minimum latitude (south)</label> |
327 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
391 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
392 | + print $globalLatitudeMin; |
|
393 | +} |
|
394 | +?>" /> |
|
328 | 395 | </p> |
329 | 396 | <p> |
330 | 397 | <label for="longitudemax">The maximum longitude (west)</label> |
331 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
398 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
399 | + print $globalLongitudeMax; |
|
400 | +} |
|
401 | +?>" /> |
|
332 | 402 | </p> |
333 | 403 | <p> |
334 | 404 | <label for="longitudemin">The minimum longitude (east)</label> |
335 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
405 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
406 | + print $globalLongitudeMin; |
|
407 | +} |
|
408 | +?>" /> |
|
336 | 409 | </p> |
337 | 410 | <p> |
338 | 411 | <label for="latitudecenter">The latitude center</label> |
339 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
412 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
413 | + print $globalCenterLatitude; |
|
414 | +} |
|
415 | +?>" /> |
|
340 | 416 | </p> |
341 | 417 | <p> |
342 | 418 | <label for="longitudecenter">The longitude center</label> |
343 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
419 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
420 | + print $globalCenterLongitude; |
|
421 | +} |
|
422 | +?>" /> |
|
344 | 423 | </p> |
345 | 424 | <p> |
346 | 425 | <label for="livezoom">Default Zoom on live map</label> |
347 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
426 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
427 | + print $globalLiveZoom; |
|
428 | +} else { |
|
429 | + print '9'; |
|
430 | +} |
|
431 | +?>" /> |
|
348 | 432 | </p> |
349 | 433 | <p> |
350 | 434 | <label for="squawk_country">Country for squawk usage</label> |
351 | 435 | <select name="squawk_country" id="squawk_country"> |
352 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
353 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
354 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
355 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
356 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
357 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
358 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
436 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
437 | + print ' selected '; |
|
438 | +} |
|
439 | +?>>UK</option> |
|
440 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
441 | + print ' selected '; |
|
442 | +} |
|
443 | +?>>NZ</option> |
|
444 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
445 | + print ' selected '; |
|
446 | +} |
|
447 | +?>>US</option> |
|
448 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
449 | + print ' selected '; |
|
450 | +} |
|
451 | +?>>AU</option> |
|
452 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
453 | + print ' selected '; |
|
454 | +} |
|
455 | +?>>NL</option> |
|
456 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
457 | + print ' selected '; |
|
458 | +} |
|
459 | +?>>FR</option> |
|
460 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
461 | + print ' selected '; |
|
462 | +} |
|
463 | +?>>TR</option> |
|
359 | 464 | </select> |
360 | 465 | </p> |
361 | 466 | </fieldset> |
@@ -364,15 +469,24 @@ discard block |
||
364 | 469 | <p><i>Only put in DB flights that are inside a circle</i></p> |
365 | 470 | <p> |
366 | 471 | <label for="latitude">Center latitude</label> |
367 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
472 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
473 | + echo $globalDistanceIgnore['latitude']; |
|
474 | +} |
|
475 | +?>" /> |
|
368 | 476 | </p> |
369 | 477 | <p> |
370 | 478 | <label for="longitude">Center longitude</label> |
371 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
479 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
480 | + echo $globalDistanceIgnore['longitude']; |
|
481 | +} |
|
482 | +?>" /> |
|
372 | 483 | </p> |
373 | 484 | <p> |
374 | 485 | <label for="Distance">Distance (in km)</label> |
375 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
486 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
487 | + echo $globalDistanceIgnore['distance']; |
|
488 | +} |
|
489 | +?>" /> |
|
376 | 490 | </p> |
377 | 491 | </fieldset> |
378 | 492 | <fieldset id="sourceloc"> |
@@ -495,11 +609,17 @@ discard block |
||
495 | 609 | <div id="flightaware_data"> |
496 | 610 | <p> |
497 | 611 | <label for="flightawareusername">FlightAware username</label> |
498 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
612 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
613 | + print $globalFlightAwareUsername; |
|
614 | +} |
|
615 | +?>" /> |
|
499 | 616 | </p> |
500 | 617 | <p> |
501 | 618 | <label for="flightawarepassword">FlightAware password/API key</label> |
502 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
619 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
620 | + print $globalFlightAwarePassword; |
|
621 | +} |
|
622 | +?>" /> |
|
503 | 623 | </p> |
504 | 624 | </div> |
505 | 625 | --> |
@@ -541,7 +661,10 @@ discard block |
||
541 | 661 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
542 | 662 | ?> |
543 | 663 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
544 | - <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
664 | + <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) { |
|
665 | + print $source['port']; |
|
666 | +} |
|
667 | +?>" /></td> |
|
545 | 668 | <?php |
546 | 669 | } else { |
547 | 670 | $hostport = explode(':',$source['host']); |
@@ -560,37 +683,118 @@ discard block |
||
560 | 683 | ?> |
561 | 684 | <td> |
562 | 685 | <select name="format[]" id="format"> |
563 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
564 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
565 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
566 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
567 | - <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option> |
|
568 | - <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') print 'selected'; ?>>Planefinder client</option> |
|
569 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
570 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
571 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
572 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
573 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
574 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
575 | - <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option> |
|
576 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
577 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
578 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
579 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
580 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
581 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
582 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
583 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
584 | - <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option> |
|
585 | - <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option> |
|
586 | - <option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') print 'selected'; ?>>Sailaway</option> |
|
686 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
687 | + print 'selected'; |
|
688 | +} |
|
689 | +?>>Auto</option> |
|
690 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
691 | + print 'selected'; |
|
692 | +} |
|
693 | +?>>SBS</option> |
|
694 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
695 | + print 'selected'; |
|
696 | +} |
|
697 | +?>>TSV</option> |
|
698 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
699 | + print 'selected'; |
|
700 | +} |
|
701 | +?>>Raw</option> |
|
702 | + <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') { |
|
703 | + print 'selected'; |
|
704 | +} |
|
705 | +?>>Dump1090 aircraft.json</option> |
|
706 | + <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') { |
|
707 | + print 'selected'; |
|
708 | +} |
|
709 | +?>>Planefinder client</option> |
|
710 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
711 | + print 'selected'; |
|
712 | +} |
|
713 | +?>>APRS</option> |
|
714 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
715 | + print 'selected'; |
|
716 | +} |
|
717 | +?>>Radarcape deltadb.txt</option> |
|
718 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
719 | + print 'selected'; |
|
720 | +} |
|
721 | +?>>Vatsim</option> |
|
722 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
723 | + print 'selected'; |
|
724 | +} |
|
725 | +?>>Virtual Radar Server AircraftList.json</option> |
|
726 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
727 | + print 'selected'; |
|
728 | +} |
|
729 | +?>>Virtual Radar Server TCP</option> |
|
730 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
731 | + print 'selected'; |
|
732 | +} |
|
733 | +?>>phpVMS</option> |
|
734 | + <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
735 | + print 'selected'; |
|
736 | +} |
|
737 | +?>>Virtual Airline Operations System (VAOS)</option> |
|
738 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
739 | + print 'selected'; |
|
740 | +} |
|
741 | +?>>Virtual Airlines Manager</option> |
|
742 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
743 | + print 'selected'; |
|
744 | +} |
|
745 | +?>>IVAO</option> |
|
746 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
747 | + print 'selected'; |
|
748 | +} |
|
749 | +?>>FlightGear Multiplayer</option> |
|
750 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
751 | + print 'selected'; |
|
752 | +} |
|
753 | +?>>FlightGear Singleplayer</option> |
|
754 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
755 | + print 'selected'; |
|
756 | +} |
|
757 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
758 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
759 | + print 'selected'; |
|
760 | +} |
|
761 | +?>>ACARS SBS-3 over TCP</option> |
|
762 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
763 | + print 'selected'; |
|
764 | +} |
|
765 | +?>>NMEA AIS over TCP</option> |
|
766 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
767 | + print 'selected'; |
|
768 | +} |
|
769 | +?>>AirWhere website</option> |
|
770 | + <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') { |
|
771 | + print 'selected'; |
|
772 | +} |
|
773 | +?>>HidnSeek Callback</option> |
|
774 | + <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') { |
|
775 | + print 'selected'; |
|
776 | +} |
|
777 | +?>>Blitzortung</option> |
|
778 | + <option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') { |
|
779 | + print 'selected'; |
|
780 | +} |
|
781 | +?>>Sailaway</option> |
|
587 | 782 | </select> |
588 | 783 | </td> |
589 | 784 | <td> |
590 | - <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
785 | + <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
786 | + print $source['name']; |
|
787 | +} |
|
788 | +?>" /> |
|
591 | 789 | </td> |
592 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
593 | - <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
790 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
791 | + print 'checked'; |
|
792 | +} |
|
793 | +?> /></td> |
|
794 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
795 | + print 'checked'; |
|
796 | +} |
|
797 | +?> /></td> |
|
594 | 798 | <td> |
595 | 799 | <select name="timezones[]" id="timezones"> |
596 | 800 | <?php |
@@ -600,7 +804,9 @@ discard block |
||
600 | 804 | print '<option selected>'.$timezones.'</option>'; |
601 | 805 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
602 | 806 | print '<option selected>'.$timezones.'</option>'; |
603 | - } else print '<option>'.$timezones.'</option>'; |
|
807 | + } else { |
|
808 | + print '<option>'.$timezones.'</option>'; |
|
809 | + } |
|
604 | 810 | } |
605 | 811 | ?> |
606 | 812 | </select> |
@@ -654,7 +860,9 @@ discard block |
||
654 | 860 | foreach($timezonelist as $timezones){ |
655 | 861 | if ($timezones == 'UTC') { |
656 | 862 | print '<option selected>'.$timezones.'</option>'; |
657 | - } else print '<option>'.$timezones.'</option>'; |
|
863 | + } else { |
|
864 | + print '<option>'.$timezones.'</option>'; |
|
865 | + } |
|
658 | 866 | } |
659 | 867 | ?> |
660 | 868 | </select> |
@@ -679,11 +887,17 @@ discard block |
||
679 | 887 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
680 | 888 | <p> |
681 | 889 | <label for="acarshost">ACARS UDP host</label> |
682 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
890 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
891 | + print $globalACARSHost; |
|
892 | +} |
|
893 | +?>" /> |
|
683 | 894 | </p> |
684 | 895 | <p> |
685 | 896 | <label for="acarsport">ACARS UDP port</label> |
686 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
897 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
898 | + print $globalACARSPort; |
|
899 | +} |
|
900 | +?>" /> |
|
687 | 901 | </p> |
688 | 902 | </fieldset> |
689 | 903 | </div> |
@@ -709,17 +923,38 @@ discard block |
||
709 | 923 | <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td> |
710 | 924 | <td> |
711 | 925 | <select name="newslang[]"> |
712 | - <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option> |
|
713 | - <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option> |
|
926 | + <option value="en"<?php if ($lng == 'en') { |
|
927 | + print ' selected'; |
|
928 | +} |
|
929 | +?>>English</option> |
|
930 | + <option value="fr"<?php if ($lng == 'fr') { |
|
931 | + print ' selected'; |
|
932 | +} |
|
933 | +?>>French</option> |
|
714 | 934 | </select> |
715 | 935 | </td> |
716 | 936 | <td> |
717 | 937 | <select name="newstype[]"> |
718 | - <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option> |
|
719 | - <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option> |
|
720 | - <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option> |
|
721 | - <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option> |
|
722 | - <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option> |
|
938 | + <option value="global"<?php if ($type == 'global') { |
|
939 | + print ' selected'; |
|
940 | +} |
|
941 | +?>>Global</option> |
|
942 | + <option value="aircraft"<?php if ($type == 'aircraft') { |
|
943 | + print ' selected'; |
|
944 | +} |
|
945 | +?>>Aircraft</option> |
|
946 | + <option value="marine"<?php if ($type == 'marine') { |
|
947 | + print ' selected'; |
|
948 | +} |
|
949 | +?>>Marine</option> |
|
950 | + <option value="tracker"<?php if ($type == 'tracker') { |
|
951 | + print ' selected'; |
|
952 | +} |
|
953 | +?>>Tracker</option> |
|
954 | + <option value="satellite"<?php if ($type == 'Satellite') { |
|
955 | + print ' selected'; |
|
956 | +} |
|
957 | +?>>Satellite</option> |
|
723 | 958 | </select> |
724 | 959 | </td> |
725 | 960 | <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td> |
@@ -861,13 +1096,19 @@ discard block |
||
861 | 1096 | <div id="schedules_options"> |
862 | 1097 | <p> |
863 | 1098 | <label for="britishairways">British Airways API Key</label> |
864 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
1099 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
1100 | + print $globalBritishAirwaysKey; |
|
1101 | +} |
|
1102 | +?>" /> |
|
865 | 1103 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
866 | 1104 | </p> |
867 | 1105 | <!-- |
868 | 1106 | <p> |
869 | 1107 | <label for="transavia">Transavia Test API Consumer Key</label> |
870 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
1108 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
1109 | + print $globalTransaviaKey; |
|
1110 | +} |
|
1111 | +?>" /> |
|
871 | 1112 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
872 | 1113 | </p> |
873 | 1114 | --> |
@@ -876,10 +1117,16 @@ discard block |
||
876 | 1117 | <b>Lufthansa API Key</b> |
877 | 1118 | <p> |
878 | 1119 | <label for="lufthansakey">Key</label> |
879 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
1120 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
1121 | + print $globalLufthansaKey['key']; |
|
1122 | +} |
|
1123 | +?>" /> |
|
880 | 1124 | </p><p> |
881 | 1125 | <label for="lufthansasecret">Secret</label> |
882 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
1126 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
1127 | + print $globalLufthansaKey['secret']; |
|
1128 | +} |
|
1129 | +?>" /> |
|
883 | 1130 | </p> |
884 | 1131 | </div> |
885 | 1132 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -889,11 +1136,17 @@ discard block |
||
889 | 1136 | <b>FlightAware API Key</b> |
890 | 1137 | <p> |
891 | 1138 | <label for="flightawareusername">Username</label> |
892 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
1139 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
1140 | + print $globalFlightAwareUsername; |
|
1141 | +} |
|
1142 | +?>" /> |
|
893 | 1143 | </p> |
894 | 1144 | <p> |
895 | 1145 | <label for="flightawarepassword">API key</label> |
896 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
1146 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
1147 | + print $globalFlightAwarePassword; |
|
1148 | +} |
|
1149 | +?>" /> |
|
897 | 1150 | </p> |
898 | 1151 | </div> |
899 | 1152 | <p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p> |
@@ -910,10 +1163,22 @@ discard block |
||
910 | 1163 | <p> |
911 | 1164 | <label for="mapmatchingsource">Map Matching source</label> |
912 | 1165 | <select name="mapmatchingsource" id="mapmatchingsource"> |
913 | - <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option> |
|
914 | - <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option> |
|
915 | - <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option> |
|
916 | - <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option> |
|
1166 | + <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) { |
|
1167 | + print 'selected="selected" '; |
|
1168 | +} |
|
1169 | +?>>FlightAirMap Map Matching</option> |
|
1170 | + <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') { |
|
1171 | + print 'selected="selected" '; |
|
1172 | +} |
|
1173 | +?>>GraphHopper</option> |
|
1174 | + <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') { |
|
1175 | + print 'selected="selected" '; |
|
1176 | +} |
|
1177 | +?>>OSMR</option> |
|
1178 | + <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') { |
|
1179 | + print 'selected="selected" '; |
|
1180 | +} |
|
1181 | +?>>Mapbox</option> |
|
917 | 1182 | </select> |
918 | 1183 | <p class="help-block">Mapbox need the API Key defined in map section.</p> |
919 | 1184 | <p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p> |
@@ -921,7 +1186,10 @@ discard block |
||
921 | 1186 | <br /> |
922 | 1187 | <p> |
923 | 1188 | <label for="graphhopper">GraphHopper API Key</label> |
924 | - <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" /> |
|
1189 | + <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) { |
|
1190 | + print $globalGraphHopperKey; |
|
1191 | +} |
|
1192 | +?>" /> |
|
925 | 1193 | <p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p> |
926 | 1194 | </p> |
927 | 1195 | </div> |
@@ -939,7 +1207,10 @@ discard block |
||
939 | 1207 | </p> |
940 | 1208 | <p> |
941 | 1209 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
942 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
1210 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
1211 | + print $globalNOTAMSource; |
|
1212 | +} |
|
1213 | +?>" /> |
|
943 | 1214 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
944 | 1215 | </p> |
945 | 1216 | <br /> |
@@ -955,14 +1226,20 @@ discard block |
||
955 | 1226 | <div id="metarsrc"> |
956 | 1227 | <p> |
957 | 1228 | <label for="metarsource">URL of your METAR source</label> |
958 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
1229 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
1230 | + print $globalMETARurl; |
|
1231 | +} |
|
1232 | +?>" /> |
|
959 | 1233 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
960 | 1234 | </p> |
961 | 1235 | </div> |
962 | 1236 | <br /> |
963 | 1237 | <p> |
964 | 1238 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
965 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
1239 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
1240 | + print $globalBitlyAccessToken; |
|
1241 | +} |
|
1242 | +?>" /> |
|
966 | 1243 | </p> |
967 | 1244 | <br /> |
968 | 1245 | <p> |
@@ -978,11 +1255,26 @@ discard block |
||
978 | 1255 | <p> |
979 | 1256 | <label for="geoid_source">Geoid Source</label> |
980 | 1257 | <select name="geoid_source" id="geoid_source"> |
981 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
982 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
983 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
984 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
985 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
1258 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
1259 | + print ' selected="selected"'; |
|
1260 | +} |
|
1261 | +?>>EGM96 15' (2.1MB)</option> |
|
1262 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
1263 | + print ' selected="selected"'; |
|
1264 | +} |
|
1265 | +?>>EGM96 5' (19MB)</option> |
|
1266 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
1267 | + print ' selected="selected"'; |
|
1268 | +} |
|
1269 | +?>>EGM2008 5' (19MB)</option> |
|
1270 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
1271 | + print ' selected="selected"'; |
|
1272 | +} |
|
1273 | +?>>EGM2008 2.5' (75MB)</option> |
|
1274 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
1275 | + print ' selected="selected"'; |
|
1276 | +} |
|
1277 | +?>>EGM2008 1' (470MB)</option> |
|
986 | 1278 | </select> |
987 | 1279 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
988 | 1280 | </p> |
@@ -1004,7 +1296,12 @@ discard block |
||
1004 | 1296 | </p> |
1005 | 1297 | <p> |
1006 | 1298 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
1007 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" /> |
|
1299 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
1300 | + print $globalArchiveMonths; |
|
1301 | +} else { |
|
1302 | + echo '1'; |
|
1303 | +} |
|
1304 | +?>" /> |
|
1008 | 1305 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
1009 | 1306 | </p> |
1010 | 1307 | <p> |
@@ -1014,12 +1311,22 @@ discard block |
||
1014 | 1311 | </p> |
1015 | 1312 | <p> |
1016 | 1313 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
1017 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" /> |
|
1314 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
1315 | + print $globalArchiveKeepMonths; |
|
1316 | +} else { |
|
1317 | + echo '1'; |
|
1318 | +} |
|
1319 | +?>" /> |
|
1018 | 1320 | <p class="help-block">0 to disable</p> |
1019 | 1321 | </p> |
1020 | 1322 | <p> |
1021 | 1323 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
1022 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" /> |
|
1324 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
1325 | + print $globalArchiveKeepTrackMonths; |
|
1326 | +} else { |
|
1327 | + echo '1'; |
|
1328 | +} |
|
1329 | +?>" /> |
|
1023 | 1330 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
1024 | 1331 | </p> |
1025 | 1332 | <br /> |
@@ -1029,7 +1336,12 @@ discard block |
||
1029 | 1336 | <p class="help-block">Uncheck if the script is running as cron job. You should always run it as daemon when it's possible.</p> |
1030 | 1337 | <div id="cronends"> |
1031 | 1338 | <label for="cronend">Run script for xx seconds</label> |
1032 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
1339 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
1340 | + print $globalCronEnd; |
|
1341 | +} else { |
|
1342 | + print '0'; |
|
1343 | +} |
|
1344 | +?>" /> |
|
1033 | 1345 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
1034 | 1346 | </div> |
1035 | 1347 | </p> |
@@ -1082,20 +1394,40 @@ discard block |
||
1082 | 1394 | <br /> |
1083 | 1395 | <p> |
1084 | 1396 | <label for="refresh">Show flights detected since xxx seconds</label> |
1085 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
1397 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
1398 | + echo $globalLiveInterval; |
|
1399 | +} else { |
|
1400 | + echo '200'; |
|
1401 | +} |
|
1402 | +?>" /> |
|
1086 | 1403 | </p> |
1087 | 1404 | <p> |
1088 | 1405 | <label for="maprefresh">Live map refresh (in seconds)</label> |
1089 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
1406 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
1407 | + echo $globalMapRefresh; |
|
1408 | +} else { |
|
1409 | + echo '30'; |
|
1410 | +} |
|
1411 | +?>" /> |
|
1090 | 1412 | </p> |
1091 | 1413 | <p> |
1092 | 1414 | <label for="mapidle">Map idle timeout (in minutes)</label> |
1093 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
1415 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
1416 | + echo $globalMapIdleTimeout; |
|
1417 | +} else { |
|
1418 | + echo '30'; |
|
1419 | +} |
|
1420 | +?>" /> |
|
1094 | 1421 | <p class="help-block">0 to disable</p> |
1095 | 1422 | </p> |
1096 | 1423 | <p> |
1097 | 1424 | <label for="minfetch">HTTP/file source fetch every xxx seconds</label> |
1098 | - <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" /> |
|
1425 | + <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) { |
|
1426 | + echo $globalMinFetch; |
|
1427 | +} else { |
|
1428 | + echo '20'; |
|
1429 | +} |
|
1430 | +?>" /> |
|
1099 | 1431 | </p> |
1100 | 1432 | <p> |
1101 | 1433 | <label for="bbox">Only display flights that we can see on screen (bounding box)</label> |
@@ -1109,12 +1441,20 @@ discard block |
||
1109 | 1441 | <br /> |
1110 | 1442 | <p> |
1111 | 1443 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
1112 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
1444 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
1445 | + echo $globalClosestMinDist; |
|
1446 | +} else { |
|
1447 | + echo '50'; |
|
1448 | +} |
|
1449 | +?>" /> |
|
1113 | 1450 | </p> |
1114 | 1451 | <br /> |
1115 | 1452 | <p> |
1116 | 1453 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1117 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1454 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
1455 | + echo $globalAircraftSize; |
|
1456 | +} |
|
1457 | +?>" /> |
|
1118 | 1458 | </p> |
1119 | 1459 | <br /> |
1120 | 1460 | <p> |
@@ -1133,7 +1473,12 @@ discard block |
||
1133 | 1473 | if (extension_loaded('gd') && function_exists('gd_info')) { |
1134 | 1474 | ?> |
1135 | 1475 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
1136 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
1476 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
1477 | + echo $globalAircraftIconColor; |
|
1478 | +} else { |
|
1479 | + echo '1a3151'; |
|
1480 | +} |
|
1481 | +?>" /> |
|
1137 | 1482 | <?php |
1138 | 1483 | if (!is_writable('../cache')) { |
1139 | 1484 | ?> |
@@ -1151,14 +1496,27 @@ discard block |
||
1151 | 1496 | <p> |
1152 | 1497 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
1153 | 1498 | <div class="range"> |
1154 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
1155 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
1499 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
1500 | + echo $globalAirportZoom; |
|
1501 | +} else { |
|
1502 | + echo '7'; |
|
1503 | +} |
|
1504 | +?>" /> |
|
1505 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
1506 | + echo $globalAirportZoom; |
|
1507 | +} else { |
|
1508 | + echo '7'; |
|
1509 | +} |
|
1510 | +?></output> |
|
1156 | 1511 | </div> |
1157 | 1512 | </p> |
1158 | 1513 | <br /> |
1159 | 1514 | <p> |
1160 | 1515 | <label for="customcss">Custom CSS web path</label> |
1161 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
1516 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
1517 | + echo $globalCustomCSS; |
|
1518 | +} |
|
1519 | +?>" /> |
|
1162 | 1520 | </p> |
1163 | 1521 | </fieldset> |
1164 | 1522 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -1185,8 +1543,12 @@ discard block |
||
1185 | 1543 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
1186 | 1544 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
1187 | 1545 | |
1188 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
1189 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1546 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
1547 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
1548 | + } |
|
1549 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
1550 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1551 | + } |
|
1190 | 1552 | |
1191 | 1553 | $_SESSION['database_root'] = $dbroot; |
1192 | 1554 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -1254,15 +1616,23 @@ discard block |
||
1254 | 1616 | $source_city = $_POST['source_city']; |
1255 | 1617 | $source_country = $_POST['source_country']; |
1256 | 1618 | $source_ref = $_POST['source_ref']; |
1257 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
1258 | - else $source_id = array(); |
|
1619 | + if (isset($source_id)) { |
|
1620 | + $source_id = $_POST['source_id']; |
|
1621 | + } else { |
|
1622 | + $source_id = array(); |
|
1623 | + } |
|
1259 | 1624 | |
1260 | 1625 | $sources = array(); |
1261 | 1626 | foreach ($source_name as $keys => $name) { |
1262 | - 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]); |
|
1263 | - 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]); |
|
1627 | + if (isset($source_id[$keys])) { |
|
1628 | + $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]); |
|
1629 | + } else { |
|
1630 | + $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]); |
|
1631 | + } |
|
1632 | + } |
|
1633 | + if (count($sources) > 0) { |
|
1634 | + $_SESSION['sources'] = $sources; |
|
1264 | 1635 | } |
1265 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
1266 | 1636 | |
1267 | 1637 | $newsurl = $_POST['newsurl']; |
1268 | 1638 | $newslng = $_POST['newslang']; |
@@ -1275,7 +1645,9 @@ discard block |
||
1275 | 1645 | $lng = $newslng[$newskey]; |
1276 | 1646 | if (isset($newsfeeds[$type][$lng])) { |
1277 | 1647 | $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
1278 | - } else $newsfeeds[$type][$lng] = array($url); |
|
1648 | + } else { |
|
1649 | + $newsfeeds[$type][$lng] = array($url); |
|
1650 | + } |
|
1279 | 1651 | } |
1280 | 1652 | } |
1281 | 1653 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
@@ -1300,17 +1672,29 @@ discard block |
||
1300 | 1672 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
1301 | 1673 | |
1302 | 1674 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
1303 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1304 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1675 | + if ($globalaircraft == 'aircraft') { |
|
1676 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1677 | + } else { |
|
1678 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1679 | + } |
|
1305 | 1680 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
1306 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1307 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1681 | + if ($globaltracker == 'tracker') { |
|
1682 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1683 | + } else { |
|
1684 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1685 | + } |
|
1308 | 1686 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
1309 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1310 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1687 | + if ($globalmarine == 'marine') { |
|
1688 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1689 | + } else { |
|
1690 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1691 | + } |
|
1311 | 1692 | $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
1312 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1313 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1693 | + if ($globalsatellite == 'satellite') { |
|
1694 | + $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1695 | + } else { |
|
1696 | + $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1697 | + } |
|
1314 | 1698 | |
1315 | 1699 | /* |
1316 | 1700 | $globalSBS1Hosts = array(); |
@@ -1332,23 +1716,37 @@ discard block |
||
1332 | 1716 | $name = $_POST['name']; |
1333 | 1717 | $format = $_POST['format']; |
1334 | 1718 | $timezones = $_POST['timezones']; |
1335 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
1336 | - else $sourcestats = array(); |
|
1337 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
1338 | - else $noarchive = array(); |
|
1719 | + if (isset($_POST['sourcestats'])) { |
|
1720 | + $sourcestats = $_POST['sourcestats']; |
|
1721 | + } else { |
|
1722 | + $sourcestats = array(); |
|
1723 | + } |
|
1724 | + if (isset($_POST['noarchive'])) { |
|
1725 | + $noarchive = $_POST['noarchive']; |
|
1726 | + } else { |
|
1727 | + $noarchive = array(); |
|
1728 | + } |
|
1339 | 1729 | $gSources = array(); |
1340 | 1730 | $forcepilots = false; |
1341 | 1731 | foreach ($host as $key => $h) { |
1342 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
1343 | - else $cov = 'FALSE'; |
|
1344 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
1345 | - else $arch = 'FALSE'; |
|
1732 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
1733 | + $cov = 'TRUE'; |
|
1734 | + } else { |
|
1735 | + $cov = 'FALSE'; |
|
1736 | + } |
|
1737 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
1738 | + $arch = 'TRUE'; |
|
1739 | + } else { |
|
1740 | + $arch = 'FALSE'; |
|
1741 | + } |
|
1346 | 1742 | if (strpos($format[$key],'_callback')) { |
1347 | 1743 | $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
1348 | 1744 | } elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) { |
1349 | 1745 | $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
1350 | 1746 | } |
1351 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
1747 | + if ($format[$key] == 'airwhere') { |
|
1748 | + $forcepilots = true; |
|
1749 | + } |
|
1352 | 1750 | } |
1353 | 1751 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
1354 | 1752 | |
@@ -1379,7 +1777,9 @@ discard block |
||
1379 | 1777 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
1380 | 1778 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1381 | 1779 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
1382 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1780 | + } else { |
|
1781 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1782 | + } |
|
1383 | 1783 | |
1384 | 1784 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
1385 | 1785 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1420,7 +1820,9 @@ discard block |
||
1420 | 1820 | |
1421 | 1821 | // Create in settings.php keys not yet configurable if not already here |
1422 | 1822 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1423 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1823 | + if (!isset($globalDebug)) { |
|
1824 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1825 | + } |
|
1424 | 1826 | |
1425 | 1827 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
1426 | 1828 | if ($resetyearstats == 'resetyearstats') { |
@@ -1463,37 +1865,56 @@ discard block |
||
1463 | 1865 | } |
1464 | 1866 | */ |
1465 | 1867 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
1466 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1467 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1468 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1469 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1868 | + if ($globalsbs == 'sbs') { |
|
1869 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1870 | + } else { |
|
1871 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1872 | + } |
|
1873 | + if ($globalaprs == 'aprs') { |
|
1874 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1875 | + } else { |
|
1876 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1877 | + } |
|
1470 | 1878 | $va = false; |
1471 | 1879 | if ($globalivao == 'ivao') { |
1472 | 1880 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
1473 | 1881 | $va = true; |
1474 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1882 | + } else { |
|
1883 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1884 | + } |
|
1475 | 1885 | if ($globalvatsim == 'vatsim') { |
1476 | 1886 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
1477 | 1887 | $va = true; |
1478 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1888 | + } else { |
|
1889 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1890 | + } |
|
1479 | 1891 | if ($globalphpvms == 'phpvms') { |
1480 | 1892 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
1481 | 1893 | $va = true; |
1482 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1894 | + } else { |
|
1895 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1896 | + } |
|
1483 | 1897 | if ($globalvam == 'vam') { |
1484 | 1898 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
1485 | 1899 | $va = true; |
1486 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1900 | + } else { |
|
1901 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1902 | + } |
|
1487 | 1903 | if ($va) { |
1488 | 1904 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
1489 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1905 | + } else { |
|
1906 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1907 | + } |
|
1490 | 1908 | if ($globalva == 'va' || $va) { |
1491 | 1909 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
1492 | 1910 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
1493 | 1911 | } else { |
1494 | 1912 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
1495 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1496 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1913 | + if ($forcepilots) { |
|
1914 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1915 | + } else { |
|
1916 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1917 | + } |
|
1497 | 1918 | } |
1498 | 1919 | if ($globalvm == 'vm') { |
1499 | 1920 | $settings = array_merge($settings,array('globalVM' => 'TRUE')); |
@@ -1732,7 +2153,9 @@ discard block |
||
1732 | 2153 | $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
1733 | 2154 | $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
1734 | 2155 | |
1735 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
2156 | + if (!isset($globalTransaction)) { |
|
2157 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
2158 | + } |
|
1736 | 2159 | |
1737 | 2160 | // Set some defaults values... |
1738 | 2161 | if (!isset($globalAircraftImageSources)) { |
@@ -1747,15 +2170,23 @@ discard block |
||
1747 | 2170 | |
1748 | 2171 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1749 | 2172 | |
1750 | - if ($error == '') settings::modify_settings($settings); |
|
1751 | - if ($error == '') settings::comment_settings($settings_comment); |
|
2173 | + if ($error == '') { |
|
2174 | + settings::modify_settings($settings); |
|
2175 | + } |
|
2176 | + if ($error == '') { |
|
2177 | + settings::comment_settings($settings_comment); |
|
2178 | + } |
|
1752 | 2179 | if ($error != '') { |
1753 | 2180 | print '<div class="info column">'.$error.'</div>'; |
1754 | 2181 | require('../footer.php'); |
1755 | 2182 | exit; |
1756 | 2183 | } else { |
1757 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
1758 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
2184 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
2185 | + $_SESSION['waypoints'] = 1; |
|
2186 | + } |
|
2187 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
2188 | + $_SESSION['owner'] = 1; |
|
2189 | + } |
|
1759 | 2190 | if (isset($_POST['createdb'])) { |
1760 | 2191 | $_SESSION['install'] = 'database_create'; |
1761 | 2192 | } else { |
@@ -1792,10 +2223,18 @@ discard block |
||
1792 | 2223 | $popw = false; |
1793 | 2224 | foreach ($_SESSION['done'] as $done) { |
1794 | 2225 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
1795 | - if ($done == 'Create database') $pop = true; |
|
1796 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1797 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1798 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
2226 | + if ($done == 'Create database') { |
|
2227 | + $pop = true; |
|
2228 | + } |
|
2229 | + if ($_SESSION['install'] == 'database_create') { |
|
2230 | + $pop = true; |
|
2231 | + } |
|
2232 | + if ($_SESSION['install'] == 'database_import') { |
|
2233 | + $popi = true; |
|
2234 | + } |
|
2235 | + if ($_SESSION['install'] == 'waypoints') { |
|
2236 | + $popw = true; |
|
2237 | + } |
|
1799 | 2238 | } |
1800 | 2239 | if ($pop) { |
1801 | 2240 | sleep(5); |
@@ -1806,7 +2245,9 @@ discard block |
||
1806 | 2245 | } else if ($popw) { |
1807 | 2246 | sleep(5); |
1808 | 2247 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
1809 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
2248 | + } else { |
|
2249 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
2250 | + } |
|
1810 | 2251 | print '</div></ul>'; |
1811 | 2252 | print '<div id="error"></div>'; |
1812 | 2253 | /* foreach ($_SESSION['done'] as $done) { |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | require_once(dirname(__FILE__).'/class.Source.php'); |
8 | 8 | |
9 | 9 | class TrackerImport { |
10 | - private $all_tracked = array(); |
|
11 | - private $last_delete_hourly = 0; |
|
12 | - private $last_delete = 0; |
|
13 | - private $stats = array(); |
|
14 | - private $tmd = 0; |
|
15 | - private $source_location = array(); |
|
16 | - public $db = null; |
|
17 | - public $nb = 0; |
|
10 | + private $all_tracked = array(); |
|
11 | + private $last_delete_hourly = 0; |
|
12 | + private $last_delete = 0; |
|
13 | + private $stats = array(); |
|
14 | + private $tmd = 0; |
|
15 | + private $source_location = array(); |
|
16 | + public $db = null; |
|
17 | + public $nb = 0; |
|
18 | 18 | |
19 | - public function __construct($dbc = null) { |
|
19 | + public function __construct($dbc = null) { |
|
20 | 20 | global $globalBeta; |
21 | 21 | $Connection = new Connection($dbc); |
22 | 22 | $this->db = $Connection->db(); |
@@ -38,50 +38,50 @@ discard block |
||
38 | 38 | } |
39 | 39 | } |
40 | 40 | */ |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | - public function checkAll() { |
|
43 | + public function checkAll() { |
|
44 | 44 | global $globalDebug; |
45 | 45 | if ($globalDebug) echo "Update last seen tracked data...\n"; |
46 | 46 | foreach ($this->all_tracked as $key => $flight) { |
47 | - if (isset($this->all_tracked[$key]['id'])) { |
|
47 | + if (isset($this->all_tracked[$key]['id'])) { |
|
48 | 48 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
49 | - $Tracker = new Tracker($this->db); |
|
50 | - $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
51 | - } |
|
49 | + $Tracker = new Tracker($this->db); |
|
50 | + $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
51 | + } |
|
52 | + } |
|
52 | 53 | } |
53 | - } |
|
54 | 54 | |
55 | - public function del() { |
|
55 | + public function del() { |
|
56 | 56 | global $globalDebug; |
57 | 57 | // Delete old infos |
58 | 58 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
59 | 59 | foreach ($this->all_tracked as $key => $flight) { |
60 | - if (isset($flight['lastupdate'])) { |
|
61 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
62 | - if (isset($this->all_tracked[$key]['id'])) { |
|
63 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
60 | + if (isset($flight['lastupdate'])) { |
|
61 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
62 | + if (isset($this->all_tracked[$key]['id'])) { |
|
63 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
64 | 64 | /* |
65 | 65 | $TrackerLive = new TrackerLive(); |
66 | 66 | $TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); |
67 | 67 | $TrackerLive->db = null; |
68 | 68 | */ |
69 | - //$real_arrival = $this->arrival($key); |
|
70 | - $Tracker = new Tracker($this->db); |
|
71 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
69 | + //$real_arrival = $this->arrival($key); |
|
70 | + $Tracker = new Tracker($this->db); |
|
71 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
72 | 72 | $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
73 | 73 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
74 | 74 | } |
75 | 75 | // Put in archive |
76 | 76 | // $Tracker->db = null; |
77 | - } |
|
78 | - unset($this->all_tracked[$key]); |
|
79 | - } |
|
80 | - } |
|
81 | - } |
|
82 | - } |
|
77 | + } |
|
78 | + unset($this->all_tracked[$key]); |
|
79 | + } |
|
80 | + } |
|
81 | + } |
|
82 | + } |
|
83 | 83 | |
84 | - public function add($line) { |
|
84 | + public function add($line) { |
|
85 | 85 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; |
86 | 86 | if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChangeTracker = '0.015'; |
87 | 87 | date_default_timezone_set('UTC'); |
@@ -90,47 +90,47 @@ discard block |
||
90 | 90 | |
91 | 91 | // SBS format is CSV format |
92 | 92 | if(is_array($line) && isset($line['ident'])) { |
93 | - //print_r($line); |
|
94 | - if (isset($line['ident'])) { |
|
93 | + //print_r($line); |
|
94 | + if (isset($line['ident'])) { |
|
95 | 95 | |
96 | 96 | |
97 | 97 | // Increment message number |
98 | 98 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
99 | - $current_date = date('Y-m-d'); |
|
100 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
101 | - else $source = ''; |
|
102 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
103 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
104 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
105 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
106 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
99 | + $current_date = date('Y-m-d'); |
|
100 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
101 | + else $source = ''; |
|
102 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
103 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
104 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
105 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
106 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
110 | 110 | $Common = new Common(); |
111 | - if (!isset($line['id'])) $id = trim($line['ident']); |
|
112 | - else $id = trim($line['id']); |
|
111 | + if (!isset($line['id'])) $id = trim($line['ident']); |
|
112 | + else $id = trim($line['id']); |
|
113 | 113 | |
114 | 114 | if (!isset($this->all_tracked[$id])) { |
115 | - $this->all_tracked[$id] = array(); |
|
116 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
117 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
118 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
119 | - if (!isset($line['id'])) { |
|
115 | + $this->all_tracked[$id] = array(); |
|
116 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
117 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
118 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
119 | + if (!isset($line['id'])) { |
|
120 | 120 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
121 | 121 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
122 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
123 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
122 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
123 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
127 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
|
127 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
|
128 | 128 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
129 | - } else { |
|
129 | + } else { |
|
130 | 130 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
131 | 131 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
132 | 132 | return ''; |
133 | - } |
|
133 | + } |
|
134 | 134 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
135 | 135 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
136 | 136 | return ''; |
@@ -147,38 +147,38 @@ discard block |
||
147 | 147 | |
148 | 148 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
149 | 149 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
150 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
151 | - if ($this->all_tracked[$id]['addedTracker'] == 1) { |
|
150 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
151 | + if ($this->all_tracked[$id]['addedTracker'] == 1) { |
|
152 | 152 | $timeelapsed = microtime(true); |
153 | - $Tracker = new Tracker($this->db); |
|
154 | - $fromsource = NULL; |
|
155 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
153 | + $Tracker = new Tracker($this->db); |
|
154 | + $fromsource = NULL; |
|
155 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
156 | 156 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
157 | 157 | $Tracker->db = null; |
158 | 158 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
159 | - } |
|
160 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
159 | + } |
|
160 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | if (isset($line['speed']) && $line['speed'] != '') { |
164 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
164 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
166 | 166 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
167 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
168 | - if ($distance > 100 && $distance < 10000) { |
|
167 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
168 | + if ($distance > 100 && $distance < 10000) { |
|
169 | 169 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
170 | 170 | $speed = $speed*3.6; |
171 | 171 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
172 | 172 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
173 | - } |
|
173 | + } |
|
174 | 174 | } |
175 | 175 | |
176 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
178 | - else unset($timediff); |
|
179 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
176 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
177 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
178 | + else unset($timediff); |
|
179 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
180 | 180 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
181 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
|
181 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
|
182 | 182 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
183 | 183 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
184 | 184 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -192,30 +192,30 @@ discard block |
||
192 | 192 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
193 | 193 | $this->tmd = 0; |
194 | 194 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
195 | - } |
|
195 | + } |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
199 | 199 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
200 | 200 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
201 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
202 | - $dataFound = true; |
|
203 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
201 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
202 | + $dataFound = true; |
|
203 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
204 | 204 | } |
205 | 205 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
206 | 206 | } |
207 | 207 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
208 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
208 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
209 | 209 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
210 | 210 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
211 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
212 | - $dataFound = true; |
|
213 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
211 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
212 | + $dataFound = true; |
|
213 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
214 | 214 | } |
215 | 215 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
216 | 216 | } |
217 | 217 | |
218 | - } else if ($globalDebug && $timediff > 20) { |
|
218 | + } else if ($globalDebug && $timediff > 20) { |
|
219 | 219 | $this->tmd = $this->tmd + 1; |
220 | 220 | if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) { |
221 | 221 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
@@ -223,131 +223,131 @@ discard block |
||
223 | 223 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
224 | 224 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
225 | 225 | } |
226 | - } |
|
226 | + } |
|
227 | 227 | } |
228 | 228 | if (isset($line['last_update']) && $line['last_update'] != '') { |
229 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
230 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
229 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
230 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
231 | 231 | } |
232 | 232 | if (isset($line['format_source']) && $line['format_source'] != '') { |
233 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
233 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
234 | 234 | } |
235 | 235 | if (isset($line['source_name']) && $line['source_name'] != '') { |
236 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
236 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
237 | 237 | } |
238 | 238 | if (isset($line['comment']) && $line['comment'] != '') { |
239 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
240 | - //$dataFound = true; |
|
239 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
240 | + //$dataFound = true; |
|
241 | 241 | } |
242 | 242 | if (isset($line['type']) && $line['type'] != '') { |
243 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
244 | - //$dataFound = true; |
|
243 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
244 | + //$dataFound = true; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | if (isset($line['altitude']) && $line['altitude'] != '') { |
248 | - //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
248 | + //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
249 | 249 | if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
250 | 250 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
251 | 251 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
252 | 252 | //$dataFound = true; |
253 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
253 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
257 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
257 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | if (isset($line['heading']) && $line['heading'] != '') { |
261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
263 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
264 | - //$dataFound = true; |
|
261 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
263 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
264 | + //$dataFound = true; |
|
265 | 265 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
266 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
267 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
266 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
267 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
268 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
270 | 270 | } |
271 | 271 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
272 | 272 | |
273 | 273 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
274 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
275 | - if ($this->all_tracked[$id]['addedTracker'] == 0) { |
|
276 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
277 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
274 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
275 | + if ($this->all_tracked[$id]['addedTracker'] == 0) { |
|
276 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
277 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
278 | 278 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
279 | 279 | $timeelapsed = microtime(true); |
280 | 280 | $TrackerLive = new TrackerLive($this->db); |
281 | 281 | if (isset($line['id'])) { |
282 | - $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
|
283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
282 | + $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
|
283 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
284 | 284 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
285 | - $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
|
286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
285 | + $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
|
286 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
287 | 287 | } else $recent_ident = ''; |
288 | 288 | $TrackerLive->db=null; |
289 | 289 | |
290 | 290 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
291 | 291 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
292 | - } else { |
|
292 | + } else { |
|
293 | 293 | $recent_ident = ''; |
294 | 294 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
295 | - } |
|
296 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
297 | - if($recent_ident == "") |
|
298 | - { |
|
295 | + } |
|
296 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
297 | + if($recent_ident == "") |
|
298 | + { |
|
299 | 299 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
300 | 300 | //adds the spotter data for the archive |
301 | - $highlight = ''; |
|
302 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
303 | - $timeelapsed = microtime(true); |
|
304 | - $Tracker = new Tracker($this->db); |
|
305 | - $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
306 | - $Tracker->db = null; |
|
307 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
301 | + $highlight = ''; |
|
302 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
303 | + $timeelapsed = microtime(true); |
|
304 | + $Tracker = new Tracker($this->db); |
|
305 | + $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
306 | + $Tracker->db = null; |
|
307 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
308 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
309 | 309 | |
310 | 310 | |
311 | - // Add source stat in DB |
|
312 | - $Stats = new Stats($this->db); |
|
313 | - if (!empty($this->stats)) { |
|
311 | + // Add source stat in DB |
|
312 | + $Stats = new Stats($this->db); |
|
313 | + if (!empty($this->stats)) { |
|
314 | 314 | if ($globalDebug) echo 'Add source stats : '; |
315 | - foreach($this->stats as $date => $data) { |
|
316 | - foreach($data as $source => $sourced) { |
|
317 | - //print_r($sourced); |
|
318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
320 | - if (isset($sourced['msg'])) { |
|
321 | - if (time() - $sourced['msg']['date'] > 10) { |
|
322 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
323 | - echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
324 | - unset($this->stats[$date][$source]['msg']); |
|
325 | - } |
|
326 | - } |
|
327 | - } |
|
328 | - if ($date != date('Y-m-d')) { |
|
329 | - unset($this->stats[$date]); |
|
330 | - } |
|
331 | - } |
|
332 | - if ($globalDebug) echo 'Done'."\n"; |
|
315 | + foreach($this->stats as $date => $data) { |
|
316 | + foreach($data as $source => $sourced) { |
|
317 | + //print_r($sourced); |
|
318 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
320 | + if (isset($sourced['msg'])) { |
|
321 | + if (time() - $sourced['msg']['date'] > 10) { |
|
322 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
323 | + echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
324 | + unset($this->stats[$date][$source]['msg']); |
|
325 | + } |
|
326 | + } |
|
327 | + } |
|
328 | + if ($date != date('Y-m-d')) { |
|
329 | + unset($this->stats[$date]); |
|
330 | + } |
|
331 | + } |
|
332 | + if ($globalDebug) echo 'Done'."\n"; |
|
333 | 333 | |
334 | - } |
|
335 | - $Stats->db = null; |
|
334 | + } |
|
335 | + $Stats->db = null; |
|
336 | 336 | |
337 | - $this->del(); |
|
337 | + $this->del(); |
|
338 | 338 | //$ignoreImport = false; |
339 | 339 | $this->all_tracked[$id]['addedTracker'] = 1; |
340 | 340 | //print_r($this->all_tracked[$id]); |
341 | 341 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
342 | - if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
343 | - //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
344 | - $TrackerLive = new TrackerLive($this->db); |
|
345 | - $TrackerLive->deleteLiveTrackerData(); |
|
346 | - $TrackerLive->db=null; |
|
347 | - if ($globalDebug) echo " Done\n"; |
|
348 | - $this->last_delete = time(); |
|
342 | + if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
343 | + //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
344 | + $TrackerLive = new TrackerLive($this->db); |
|
345 | + $TrackerLive->deleteLiveTrackerData(); |
|
346 | + $TrackerLive->db=null; |
|
347 | + if ($globalDebug) echo " Done\n"; |
|
348 | + $this->last_delete = time(); |
|
349 | 349 | } |
350 | - } else { |
|
350 | + } else { |
|
351 | 351 | $this->all_tracked[$id]['id'] = $recent_ident; |
352 | 352 | $this->all_tracked[$id]['addedTracker'] = 1; |
353 | 353 | if (isset($globalDaemon) && !$globalDaemon) { |
@@ -356,16 +356,16 @@ discard block |
||
356 | 356 | $Tracker->db = null; |
357 | 357 | } |
358 | 358 | |
359 | - } |
|
359 | + } |
|
360 | 360 | } |
361 | - } |
|
362 | - //adds the spotter LIVE data |
|
363 | - if ($globalDebug) { |
|
361 | + } |
|
362 | + //adds the spotter LIVE data |
|
363 | + if ($globalDebug) { |
|
364 | 364 | echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Altitude : '.$this->all_tracked[$id]['altitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
365 | - } |
|
366 | - $ignoreImport = false; |
|
365 | + } |
|
366 | + $ignoreImport = false; |
|
367 | 367 | |
368 | - if (!$ignoreImport) { |
|
368 | + if (!$ignoreImport) { |
|
369 | 369 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
370 | 370 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
371 | 371 | $timeelapsed = microtime(true); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | if ($stats_heading == 16) $stats_heading = 0; |
404 | 404 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
405 | 405 | for ($i=0;$i<=15;$i++) { |
406 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
406 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
407 | 407 | } |
408 | 408 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
409 | 409 | } else { |
@@ -416,11 +416,11 @@ discard block |
||
416 | 416 | //var_dump($this->stats); |
417 | 417 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
418 | 418 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
419 | - end($this->stats[$current_date][$source]['hist']); |
|
420 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
419 | + end($this->stats[$current_date][$source]['hist']); |
|
420 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
421 | 421 | } else $mini = 0; |
422 | 422 | for ($i=$mini;$i<=$distance;$i+=10) { |
423 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
423 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
424 | 424 | } |
425 | 425 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
426 | 426 | } else { |
@@ -436,22 +436,22 @@ discard block |
||
436 | 436 | |
437 | 437 | |
438 | 438 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
439 | - if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
440 | - $TrackerLive = new TrackerLive($this->db); |
|
441 | - $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
442 | - $TrackerLive->db = null; |
|
443 | - //TrackerLive->deleteLiveTrackerData(); |
|
444 | - if ($globalDebug) echo " Done\n"; |
|
445 | - $this->last_delete_hourly = time(); |
|
439 | + if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
440 | + $TrackerLive = new TrackerLive($this->db); |
|
441 | + $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
442 | + $TrackerLive->db = null; |
|
443 | + //TrackerLive->deleteLiveTrackerData(); |
|
444 | + if ($globalDebug) echo " Done\n"; |
|
445 | + $this->last_delete_hourly = time(); |
|
446 | 446 | } |
447 | 447 | |
448 | - } |
|
449 | - //$ignoreImport = false; |
|
448 | + } |
|
449 | + //$ignoreImport = false; |
|
450 | 450 | } |
451 | 451 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
452 | 452 | if ($send) return $this->all_tracked[$id]; |
453 | - } |
|
453 | + } |
|
454 | + } |
|
454 | 455 | } |
455 | - } |
|
456 | 456 | } |
457 | 457 | ?> |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if (isset($this->all_tracked[$key]['id'])) { |
48 | 48 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
49 | 49 | $Tracker = new Tracker($this->db); |
50 | - $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
50 | + $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
59 | 59 | foreach ($this->all_tracked as $key => $flight) { |
60 | 60 | if (isset($flight['lastupdate'])) { |
61 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
61 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
62 | 62 | if (isset($this->all_tracked[$key]['id'])) { |
63 | 63 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
64 | 64 | /* |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | //$real_arrival = $this->arrival($key); |
70 | 70 | $Tracker = new Tracker($this->db); |
71 | 71 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
72 | - $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
|
72 | + $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed']); |
|
73 | 73 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
74 | 74 | } |
75 | 75 | // Put in archive |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $send = false; |
90 | 90 | |
91 | 91 | // SBS format is CSV format |
92 | - if(is_array($line) && isset($line['ident'])) { |
|
92 | + if (is_array($line) && isset($line['ident'])) { |
|
93 | 93 | //print_r($line); |
94 | 94 | if (isset($line['ident'])) { |
95 | 95 | |
@@ -113,33 +113,33 @@ discard block |
||
113 | 113 | |
114 | 114 | if (!isset($this->all_tracked[$id])) { |
115 | 115 | $this->all_tracked[$id] = array(); |
116 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
117 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
118 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
116 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedTracker' => 0)); |
|
117 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '')); |
|
118 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
119 | 119 | if (!isset($line['id'])) { |
120 | 120 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
121 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
122 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
121 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
122 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); |
|
123 | 123 | if ($globalAllTracked !== FALSE) $dataFound = true; |
124 | 124 | } |
125 | 125 | |
126 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
126 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
127 | 127 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
128 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
128 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
129 | 129 | } else { |
130 | 130 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
131 | 131 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
132 | 132 | return ''; |
133 | 133 | } |
134 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
134 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
135 | 135 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
136 | 136 | return ''; |
137 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
137 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
138 | 138 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
139 | 139 | return ''; |
140 | 140 | } elseif (!isset($line['datetime'])) { |
141 | 141 | date_default_timezone_set('UTC'); |
142 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
142 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
143 | 143 | } else { |
144 | 144 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
145 | 145 | return ''; |
@@ -147,38 +147,38 @@ discard block |
||
147 | 147 | |
148 | 148 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
149 | 149 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
150 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
150 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
151 | 151 | if ($this->all_tracked[$id]['addedTracker'] == 1) { |
152 | 152 | $timeelapsed = microtime(true); |
153 | 153 | $Tracker = new Tracker($this->db); |
154 | 154 | $fromsource = NULL; |
155 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
155 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
156 | 156 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
157 | 157 | $Tracker->db = null; |
158 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
158 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
159 | 159 | } |
160 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
160 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | if (isset($line['speed']) && $line['speed'] != '') { |
164 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
164 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed']))); |
|
165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
166 | 166 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
167 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
167 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
168 | 168 | if ($distance > 100 && $distance < 10000) { |
169 | 169 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
170 | 170 | $speed = $speed*3.6; |
171 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
171 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed))); |
|
172 | 172 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | 176 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
177 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
178 | 178 | else unset($timediff); |
179 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
179 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) { |
|
180 | 180 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
181 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
|
181 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'], 0.08)) { |
|
182 | 182 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
183 | 183 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
184 | 184 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
187 | 187 | $timeelapsed = microtime(true); |
188 | 188 | $Tracker = new Tracker($this->db); |
189 | - $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
189 | + $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
190 | 190 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
191 | 191 | $Tracker->db = null; |
192 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
192 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
193 | 193 | $this->tmd = 0; |
194 | 194 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
195 | 195 | } |
@@ -197,75 +197,75 @@ discard block |
||
197 | 197 | |
198 | 198 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
199 | 199 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
200 | - if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
200 | + if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
201 | 201 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
202 | 202 | $dataFound = true; |
203 | 203 | $this->all_tracked[$id]['time_last_coord'] = time(); |
204 | 204 | } |
205 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
205 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
206 | 206 | } |
207 | 207 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
208 | 208 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
209 | 209 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
210 | - if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
210 | + if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
211 | 211 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
212 | 212 | $dataFound = true; |
213 | 213 | $this->all_tracked[$id]['time_last_coord'] = time(); |
214 | 214 | } |
215 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
215 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | } else if ($globalDebug && $timediff > 20) { |
219 | 219 | $this->tmd = $this->tmd + 1; |
220 | 220 | if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) { |
221 | 221 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
222 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
223 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
222 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
223 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
224 | 224 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
225 | 225 | } |
226 | 226 | } |
227 | 227 | } |
228 | 228 | if (isset($line['last_update']) && $line['last_update'] != '') { |
229 | 229 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
230 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
230 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
231 | 231 | } |
232 | 232 | if (isset($line['format_source']) && $line['format_source'] != '') { |
233 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
233 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
234 | 234 | } |
235 | 235 | if (isset($line['source_name']) && $line['source_name'] != '') { |
236 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
236 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
237 | 237 | } |
238 | 238 | if (isset($line['comment']) && $line['comment'] != '') { |
239 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
239 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('comment' => $line['comment'])); |
|
240 | 240 | //$dataFound = true; |
241 | 241 | } |
242 | 242 | if (isset($line['type']) && $line['type'] != '') { |
243 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
243 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
244 | 244 | //$dataFound = true; |
245 | 245 | } |
246 | 246 | |
247 | 247 | if (isset($line['altitude']) && $line['altitude'] != '') { |
248 | 248 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
249 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
|
251 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
|
249 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude' => $line['altitude'])); |
|
251 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude_real' => $line['altitude'])); |
|
252 | 252 | //$dataFound = true; |
253 | 253 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
254 | 254 | } |
255 | 255 | |
256 | 256 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
257 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
257 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | if (isset($line['heading']) && $line['heading'] != '') { |
261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
263 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
261 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
263 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
264 | 264 | //$dataFound = true; |
265 | 265 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
266 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
267 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
266 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
267 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); |
|
268 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | 269 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
270 | 270 | } |
271 | 271 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -273,54 +273,54 @@ discard block |
||
273 | 273 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
274 | 274 | $this->all_tracked[$id]['lastupdate'] = time(); |
275 | 275 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
276 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
276 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
277 | 277 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
278 | 278 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
279 | 279 | $timeelapsed = microtime(true); |
280 | 280 | $TrackerLive = new TrackerLive($this->db); |
281 | 281 | if (isset($line['id'])) { |
282 | 282 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
283 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
284 | 284 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
285 | 285 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
286 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
287 | 287 | } else $recent_ident = ''; |
288 | - $TrackerLive->db=null; |
|
288 | + $TrackerLive->db = null; |
|
289 | 289 | |
290 | 290 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
291 | 291 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
292 | 292 | } else { |
293 | 293 | $recent_ident = ''; |
294 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
294 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
295 | 295 | } |
296 | 296 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
297 | - if($recent_ident == "") |
|
297 | + if ($recent_ident == "") |
|
298 | 298 | { |
299 | 299 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
300 | 300 | //adds the spotter data for the archive |
301 | 301 | $highlight = ''; |
302 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
302 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
303 | 303 | $timeelapsed = microtime(true); |
304 | 304 | $Tracker = new Tracker($this->db); |
305 | - $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
305 | + $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']); |
|
306 | 306 | $Tracker->db = null; |
307 | 307 | if ($globalDebug && isset($result)) echo $result."\n"; |
308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
308 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
309 | 309 | |
310 | 310 | |
311 | 311 | // Add source stat in DB |
312 | 312 | $Stats = new Stats($this->db); |
313 | 313 | if (!empty($this->stats)) { |
314 | 314 | if ($globalDebug) echo 'Add source stats : '; |
315 | - foreach($this->stats as $date => $data) { |
|
316 | - foreach($data as $source => $sourced) { |
|
315 | + foreach ($this->stats as $date => $data) { |
|
316 | + foreach ($data as $source => $sourced) { |
|
317 | 317 | //print_r($sourced); |
318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
318 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_tracker', $date); |
|
319 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_tracker', $date); |
|
320 | 320 | if (isset($sourced['msg'])) { |
321 | 321 | if (time() - $sourced['msg']['date'] > 10) { |
322 | 322 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
323 | - echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
323 | + echo $Stats->addStatSource($nbmsg, $source, 'msg_tracker', $date); |
|
324 | 324 | unset($this->stats[$date][$source]['msg']); |
325 | 325 | } |
326 | 326 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
344 | 344 | $TrackerLive = new TrackerLive($this->db); |
345 | 345 | $TrackerLive->deleteLiveTrackerData(); |
346 | - $TrackerLive->db=null; |
|
346 | + $TrackerLive->db = null; |
|
347 | 347 | if ($globalDebug) echo " Done\n"; |
348 | 348 | $this->last_delete = time(); |
349 | 349 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $this->all_tracked[$id]['addedTracker'] = 1; |
353 | 353 | if (isset($globalDaemon) && !$globalDaemon) { |
354 | 354 | $Tracker = new Tracker($this->db); |
355 | - $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['altitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
|
355 | + $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']); |
|
356 | 356 | $Tracker->db = null; |
357 | 357 | } |
358 | 358 | |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | $ignoreImport = false; |
367 | 367 | |
368 | 368 | if (!$ignoreImport) { |
369 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
369 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
370 | 370 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
371 | 371 | $timeelapsed = microtime(true); |
372 | 372 | $TrackerLive = new TrackerLive($this->db); |
373 | - $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
373 | + $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
374 | 374 | $TrackerLive->db = null; |
375 | 375 | $this->all_tracked[$id]['putinarchive'] = false; |
376 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
376 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
377 | 377 | |
378 | 378 | // Put statistics in $this->stats variable |
379 | 379 | |
@@ -390,19 +390,19 @@ discard block |
||
390 | 390 | $latitude = $globalCenterLatitude; |
391 | 391 | $longitude = $globalCenterLongitude; |
392 | 392 | } |
393 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
393 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
394 | 394 | } else { |
395 | 395 | $latitude = $this->source_location[$source]['latitude']; |
396 | 396 | $longitude = $this->source_location[$source]['longitude']; |
397 | 397 | } |
398 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
398 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
399 | 399 | //$stats_heading = $stats_heading%22.5; |
400 | 400 | $stats_heading = round($stats_heading/22.5); |
401 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
401 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
402 | 402 | $current_date = date('Y-m-d'); |
403 | 403 | if ($stats_heading == 16) $stats_heading = 0; |
404 | 404 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
405 | - for ($i=0;$i<=15;$i++) { |
|
405 | + for ($i = 0; $i <= 15; $i++) { |
|
406 | 406 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
407 | 407 | } |
408 | 408 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
418 | 418 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
419 | 419 | end($this->stats[$current_date][$source]['hist']); |
420 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
420 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
421 | 421 | } else $mini = 0; |
422 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
422 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
423 | 423 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
424 | 424 | } |
425 | 425 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | $this->all_tracked[$id]['lastupdate'] = time(); |
432 | 432 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
433 | 433 | if ($globalDebug) echo $result."\n"; |
434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
434 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
435 | 435 | //$this->del(); |
436 | 436 | |
437 | 437 |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | |
43 | 43 | public function checkAll() { |
44 | 44 | global $globalDebug; |
45 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
45 | + if ($globalDebug) { |
|
46 | + echo "Update last seen tracked data...\n"; |
|
47 | + } |
|
46 | 48 | foreach ($this->all_tracked as $key => $flight) { |
47 | 49 | if (isset($this->all_tracked[$key]['id'])) { |
48 | 50 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
@@ -55,12 +57,16 @@ discard block |
||
55 | 57 | public function del() { |
56 | 58 | global $globalDebug; |
57 | 59 | // Delete old infos |
58 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
60 | + if ($globalDebug) { |
|
61 | + echo 'Delete old values and update latest data...'."\n"; |
|
62 | + } |
|
59 | 63 | foreach ($this->all_tracked as $key => $flight) { |
60 | 64 | if (isset($flight['lastupdate'])) { |
61 | 65 | if ($flight['lastupdate'] < (time()-3000)) { |
62 | 66 | if (isset($this->all_tracked[$key]['id'])) { |
63 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
67 | + if ($globalDebug) { |
|
68 | + echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
69 | + } |
|
64 | 70 | /* |
65 | 71 | $TrackerLive = new TrackerLive(); |
66 | 72 | $TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); |
@@ -70,7 +76,9 @@ discard block |
||
70 | 76 | $Tracker = new Tracker($this->db); |
71 | 77 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
72 | 78 | $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
73 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
79 | + if ($globalDebug && $result != 'success') { |
|
80 | + echo '!!! ERROR : '.$result."\n"; |
|
81 | + } |
|
74 | 82 | } |
75 | 83 | // Put in archive |
76 | 84 | // $Tracker->db = null; |
@@ -83,7 +91,9 @@ discard block |
||
83 | 91 | |
84 | 92 | public function add($line) { |
85 | 93 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; |
86 | - if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChangeTracker = '0.015'; |
|
94 | + if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') { |
|
95 | + $globalCoordMinChangeTracker = '0.015'; |
|
96 | + } |
|
87 | 97 | date_default_timezone_set('UTC'); |
88 | 98 | $dataFound = false; |
89 | 99 | $send = false; |
@@ -97,19 +107,29 @@ discard block |
||
97 | 107 | // Increment message number |
98 | 108 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
99 | 109 | $current_date = date('Y-m-d'); |
100 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
101 | - else $source = ''; |
|
102 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
110 | + if (isset($line['source_name'])) { |
|
111 | + $source = $line['source_name']; |
|
112 | + } else { |
|
113 | + $source = ''; |
|
114 | + } |
|
115 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
116 | + $source = $line['format_source']; |
|
117 | + } |
|
103 | 118 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
104 | 119 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
105 | 120 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
106 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
121 | + } else { |
|
122 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
123 | + } |
|
107 | 124 | } |
108 | 125 | |
109 | 126 | |
110 | 127 | $Common = new Common(); |
111 | - if (!isset($line['id'])) $id = trim($line['ident']); |
|
112 | - else $id = trim($line['id']); |
|
128 | + if (!isset($line['id'])) { |
|
129 | + $id = trim($line['ident']); |
|
130 | + } else { |
|
131 | + $id = trim($line['id']); |
|
132 | + } |
|
113 | 133 | |
114 | 134 | if (!isset($this->all_tracked[$id])) { |
115 | 135 | $this->all_tracked[$id] = array(); |
@@ -117,31 +137,46 @@ discard block |
||
117 | 137 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
118 | 138 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
119 | 139 | if (!isset($line['id'])) { |
120 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
140 | + if (!isset($globalDaemon)) { |
|
141 | + $globalDaemon = TRUE; |
|
142 | + } |
|
121 | 143 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
122 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
123 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
144 | + } else { |
|
145 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
146 | + } |
|
147 | + if ($globalAllTracked !== FALSE) { |
|
148 | + $dataFound = true; |
|
149 | + } |
|
124 | 150 | } |
125 | 151 | |
126 | 152 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
127 | 153 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
128 | 154 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
129 | 155 | } else { |
130 | - if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
131 | - elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
156 | + if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
157 | + echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
158 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
159 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
160 | + } |
|
132 | 161 | return ''; |
133 | 162 | } |
134 | 163 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
135 | - if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
164 | + if ($globalDebug) { |
|
165 | + echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
166 | + } |
|
136 | 167 | return ''; |
137 | 168 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
138 | - if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
169 | + if ($globalDebug) { |
|
170 | + echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
171 | + } |
|
139 | 172 | return ''; |
140 | 173 | } elseif (!isset($line['datetime'])) { |
141 | 174 | date_default_timezone_set('UTC'); |
142 | 175 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
143 | 176 | } else { |
144 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
177 | + if ($globalDebug) { |
|
178 | + echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
179 | + } |
|
145 | 180 | return ''; |
146 | 181 | } |
147 | 182 | |
@@ -153,11 +188,17 @@ discard block |
||
153 | 188 | $Tracker = new Tracker($this->db); |
154 | 189 | $fromsource = NULL; |
155 | 190 | $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
156 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
191 | + if ($globalDebug && $result != 'success') { |
|
192 | + echo '!!! ERROR : '.$result."\n"; |
|
193 | + } |
|
157 | 194 | $Tracker->db = null; |
158 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
195 | + if ($globalDebugTimeElapsed) { |
|
196 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
197 | + } |
|
198 | + } |
|
199 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
200 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
159 | 201 | } |
160 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
161 | 202 | } |
162 | 203 | |
163 | 204 | if (isset($line['speed']) && $line['speed'] != '') { |
@@ -168,14 +209,21 @@ discard block |
||
168 | 209 | if ($distance > 100 && $distance < 10000) { |
169 | 210 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
170 | 211 | $speed = $speed*3.6; |
171 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
172 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
|
212 | + if ($speed < 1000) { |
|
213 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
214 | + } |
|
215 | + if ($globalDebug) { |
|
216 | + echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
|
217 | + } |
|
173 | 218 | } |
174 | 219 | } |
175 | 220 | |
176 | 221 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
178 | - else unset($timediff); |
|
222 | + if (isset($this->all_tracked[$id]['time_last_coord'])) { |
|
223 | + $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
224 | + } else { |
|
225 | + unset($timediff); |
|
226 | + } |
|
179 | 227 | if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
180 | 228 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
181 | 229 | if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
@@ -183,20 +231,30 @@ discard block |
||
183 | 231 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
184 | 232 | $this->all_tracked[$id]['putinarchive'] = true; |
185 | 233 | |
186 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
234 | + if ($globalDebug) { |
|
235 | + echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
236 | + } |
|
187 | 237 | $timeelapsed = microtime(true); |
188 | 238 | $Tracker = new Tracker($this->db); |
189 | 239 | $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
190 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
240 | + if (!empty($all_country)) { |
|
241 | + $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
242 | + } |
|
191 | 243 | $Tracker->db = null; |
192 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
244 | + if ($globalDebugTimeElapsed) { |
|
245 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
246 | + } |
|
193 | 247 | $this->tmd = 0; |
194 | - if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
248 | + if ($globalDebug) { |
|
249 | + echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
250 | + } |
|
195 | 251 | } |
196 | 252 | } |
197 | 253 | |
198 | 254 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
199 | - if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
255 | + if (!isset($this->all_tracked[$id]['archive_latitude'])) { |
|
256 | + $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
257 | + } |
|
200 | 258 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
201 | 259 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
202 | 260 | $dataFound = true; |
@@ -205,8 +263,12 @@ discard block |
||
205 | 263 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
206 | 264 | } |
207 | 265 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
208 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
209 | - if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
266 | + if ($line['longitude'] > 180) { |
|
267 | + $line['longitude'] = $line['longitude'] - 360; |
|
268 | + } |
|
269 | + if (!isset($this->all_tracked[$id]['archive_longitude'])) { |
|
270 | + $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
271 | + } |
|
210 | 272 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
211 | 273 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
212 | 274 | $dataFound = true; |
@@ -226,7 +288,9 @@ discard block |
||
226 | 288 | } |
227 | 289 | } |
228 | 290 | if (isset($line['last_update']) && $line['last_update'] != '') { |
229 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
291 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) { |
|
292 | + $dataFound = true; |
|
293 | + } |
|
230 | 294 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
231 | 295 | } |
232 | 296 | if (isset($line['format_source']) && $line['format_source'] != '') { |
@@ -246,7 +310,9 @@ discard block |
||
246 | 310 | |
247 | 311 | if (isset($line['altitude']) && $line['altitude'] != '') { |
248 | 312 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
249 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
313 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) { |
|
314 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
315 | + } |
|
250 | 316 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
251 | 317 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
252 | 318 | //$dataFound = true; |
@@ -258,15 +324,21 @@ discard block |
||
258 | 324 | } |
259 | 325 | |
260 | 326 | if (isset($line['heading']) && $line['heading'] != '') { |
261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
327 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) { |
|
328 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
329 | + } |
|
262 | 330 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
263 | 331 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
264 | 332 | //$dataFound = true; |
265 | 333 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
266 | 334 | $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
267 | 335 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
336 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) { |
|
337 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
338 | + } |
|
339 | + if ($globalDebug) { |
|
340 | + echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
341 | + } |
|
270 | 342 | } |
271 | 343 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
272 | 344 | |
@@ -275,20 +347,31 @@ discard block |
||
275 | 347 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
276 | 348 | if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
277 | 349 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
278 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
350 | + if ($globalDebug) { |
|
351 | + echo "Check if aircraft is already in DB..."; |
|
352 | + } |
|
279 | 353 | $timeelapsed = microtime(true); |
280 | 354 | $TrackerLive = new TrackerLive($this->db); |
281 | 355 | if (isset($line['id'])) { |
282 | 356 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
357 | + if ($globalDebugTimeElapsed) { |
|
358 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
359 | + } |
|
284 | 360 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
285 | 361 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
287 | - } else $recent_ident = ''; |
|
362 | + if ($globalDebugTimeElapsed) { |
|
363 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
364 | + } |
|
365 | + } else { |
|
366 | + $recent_ident = ''; |
|
367 | + } |
|
288 | 368 | $TrackerLive->db=null; |
289 | 369 | |
290 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
291 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
370 | + if ($globalDebug && $recent_ident == '') { |
|
371 | + echo " Not in DB.\n"; |
|
372 | + } elseif ($globalDebug && $recent_ident != '') { |
|
373 | + echo " Already in DB.\n"; |
|
374 | + } |
|
292 | 375 | } else { |
293 | 376 | $recent_ident = ''; |
294 | 377 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
@@ -296,27 +379,41 @@ discard block |
||
296 | 379 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
297 | 380 | if($recent_ident == "") |
298 | 381 | { |
299 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
382 | + if ($globalDebug) { |
|
383 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
384 | + } |
|
300 | 385 | //adds the spotter data for the archive |
301 | 386 | $highlight = ''; |
302 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
387 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
388 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
389 | + } |
|
303 | 390 | $timeelapsed = microtime(true); |
304 | 391 | $Tracker = new Tracker($this->db); |
305 | 392 | $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
306 | 393 | $Tracker->db = null; |
307 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
394 | + if ($globalDebug && isset($result)) { |
|
395 | + echo $result."\n"; |
|
396 | + } |
|
397 | + if ($globalDebugTimeElapsed) { |
|
398 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
399 | + } |
|
309 | 400 | |
310 | 401 | |
311 | 402 | // Add source stat in DB |
312 | 403 | $Stats = new Stats($this->db); |
313 | 404 | if (!empty($this->stats)) { |
314 | - if ($globalDebug) echo 'Add source stats : '; |
|
405 | + if ($globalDebug) { |
|
406 | + echo 'Add source stats : '; |
|
407 | + } |
|
315 | 408 | foreach($this->stats as $date => $data) { |
316 | 409 | foreach($data as $source => $sourced) { |
317 | 410 | //print_r($sourced); |
318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
411 | + if (isset($sourced['polar'])) { |
|
412 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
413 | + } |
|
414 | + if (isset($sourced['hist'])) { |
|
415 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
416 | + } |
|
320 | 417 | if (isset($sourced['msg'])) { |
321 | 418 | if (time() - $sourced['msg']['date'] > 10) { |
322 | 419 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -329,7 +426,9 @@ discard block |
||
329 | 426 | unset($this->stats[$date]); |
330 | 427 | } |
331 | 428 | } |
332 | - if ($globalDebug) echo 'Done'."\n"; |
|
429 | + if ($globalDebug) { |
|
430 | + echo 'Done'."\n"; |
|
431 | + } |
|
333 | 432 | |
334 | 433 | } |
335 | 434 | $Stats->db = null; |
@@ -339,12 +438,16 @@ discard block |
||
339 | 438 | $this->all_tracked[$id]['addedTracker'] = 1; |
340 | 439 | //print_r($this->all_tracked[$id]); |
341 | 440 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
342 | - if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
441 | + if ($globalDebug) { |
|
442 | + echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
443 | + } |
|
343 | 444 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
344 | 445 | $TrackerLive = new TrackerLive($this->db); |
345 | 446 | $TrackerLive->deleteLiveTrackerData(); |
346 | 447 | $TrackerLive->db=null; |
347 | - if ($globalDebug) echo " Done\n"; |
|
448 | + if ($globalDebug) { |
|
449 | + echo " Done\n"; |
|
450 | + } |
|
348 | 451 | $this->last_delete = time(); |
349 | 452 | } |
350 | 453 | } else { |
@@ -367,19 +470,25 @@ discard block |
||
367 | 470 | |
368 | 471 | if (!$ignoreImport) { |
369 | 472 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
370 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
473 | + if ($globalDebug) { |
|
474 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
475 | + } |
|
371 | 476 | $timeelapsed = microtime(true); |
372 | 477 | $TrackerLive = new TrackerLive($this->db); |
373 | 478 | $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
374 | 479 | $TrackerLive->db = null; |
375 | 480 | $this->all_tracked[$id]['putinarchive'] = false; |
376 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
481 | + if ($globalDebugTimeElapsed) { |
|
482 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
483 | + } |
|
377 | 484 | |
378 | 485 | // Put statistics in $this->stats variable |
379 | 486 | |
380 | 487 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
381 | 488 | $source = $this->all_tracked[$id]['source_name']; |
382 | - if ($source == '') $source = $this->all_tracked[$id]['format_source']; |
|
489 | + if ($source == '') { |
|
490 | + $source = $this->all_tracked[$id]['format_source']; |
|
491 | + } |
|
383 | 492 | if (!isset($this->source_location[$source])) { |
384 | 493 | $Location = new Source($this->db); |
385 | 494 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -400,7 +509,9 @@ discard block |
||
400 | 509 | $stats_heading = round($stats_heading/22.5); |
401 | 510 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
402 | 511 | $current_date = date('Y-m-d'); |
403 | - if ($stats_heading == 16) $stats_heading = 0; |
|
512 | + if ($stats_heading == 16) { |
|
513 | + $stats_heading = 0; |
|
514 | + } |
|
404 | 515 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
405 | 516 | for ($i=0;$i<=15;$i++) { |
406 | 517 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -418,7 +529,9 @@ discard block |
||
418 | 529 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
419 | 530 | end($this->stats[$current_date][$source]['hist']); |
420 | 531 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
421 | - } else $mini = 0; |
|
532 | + } else { |
|
533 | + $mini = 0; |
|
534 | + } |
|
422 | 535 | for ($i=$mini;$i<=$distance;$i+=10) { |
423 | 536 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
424 | 537 | } |
@@ -429,19 +542,29 @@ discard block |
||
429 | 542 | } |
430 | 543 | |
431 | 544 | $this->all_tracked[$id]['lastupdate'] = time(); |
432 | - if ($this->all_tracked[$id]['putinarchive']) $send = true; |
|
433 | - if ($globalDebug) echo $result."\n"; |
|
434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
545 | + if ($this->all_tracked[$id]['putinarchive']) { |
|
546 | + $send = true; |
|
547 | + } |
|
548 | + if ($globalDebug) { |
|
549 | + echo $result."\n"; |
|
550 | + } |
|
551 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
552 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
553 | + } |
|
435 | 554 | //$this->del(); |
436 | 555 | |
437 | 556 | |
438 | 557 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
439 | - if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
558 | + if ($globalDebug) { |
|
559 | + echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
560 | + } |
|
440 | 561 | $TrackerLive = new TrackerLive($this->db); |
441 | 562 | $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
442 | 563 | $TrackerLive->db = null; |
443 | 564 | //TrackerLive->deleteLiveTrackerData(); |
444 | - if ($globalDebug) echo " Done\n"; |
|
565 | + if ($globalDebug) { |
|
566 | + echo " Done\n"; |
|
567 | + } |
|
445 | 568 | $this->last_delete_hourly = time(); |
446 | 569 | } |
447 | 570 | |
@@ -449,7 +572,9 @@ discard block |
||
449 | 572 | //$ignoreImport = false; |
450 | 573 | } |
451 | 574 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
452 | - if ($send) return $this->all_tracked[$id]; |
|
575 | + if ($send) { |
|
576 | + return $this->all_tracked[$id]; |
|
577 | + } |
|
453 | 578 | } |
454 | 579 | } |
455 | 580 | } |
@@ -14,35 +14,35 @@ discard block |
||
14 | 14 | if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline'; |
15 | 15 | |
16 | 16 | if (isset($_GET['3d'])) { |
17 | - setcookie('MapFormat','3d'); |
|
17 | + setcookie('MapFormat', '3d'); |
|
18 | 18 | } else if (isset($_GET['2d'])) { |
19 | - setcookie('MapFormat','2d'); |
|
19 | + setcookie('MapFormat', '2d'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
23 | - $tsk = filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); |
|
23 | + $tsk = filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | if (isset($_POST['archive'])) { |
27 | - setcookie('archive','true'); |
|
28 | - setcookie('archive_begin',strtotime($_POST['start_date'])); |
|
29 | - setcookie('archive_end',strtotime($_POST['end_date'])); |
|
30 | - setcookie('archive_speed',$_POST['archivespeed']); |
|
27 | + setcookie('archive', 'true'); |
|
28 | + setcookie('archive_begin', strtotime($_POST['start_date'])); |
|
29 | + setcookie('archive_end', strtotime($_POST['end_date'])); |
|
30 | + setcookie('archive_speed', $_POST['archivespeed']); |
|
31 | 31 | } |
32 | 32 | if (isset($_POST['noarchive'])) { |
33 | - setcookie('archive','false',-1); |
|
34 | - setcookie('archive_begin','',-1); |
|
35 | - setcookie('archive_end','',-1); |
|
36 | - setcookie('archive_speed','',-1); |
|
33 | + setcookie('archive', 'false', -1); |
|
34 | + setcookie('archive_begin', '', -1); |
|
35 | + setcookie('archive_end', '', -1); |
|
36 | + setcookie('archive_speed', '', -1); |
|
37 | 37 | } |
38 | 38 | // When button "Remove all filters" is clicked |
39 | 39 | if (isset($_POST['removefilters'])) { |
40 | - $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
|
41 | - return strpos($key,'filter_') === 0; |
|
40 | + $allfilters = array_filter(array_keys($_COOKIE), function($key) { |
|
41 | + return strpos($key, 'filter_') === 0; |
|
42 | 42 | }); |
43 | 43 | foreach ($allfilters as $filt) { |
44 | 44 | unset($_COOKIE[$filt]); |
45 | - setcookie($filt,null,-1); |
|
45 | + setcookie($filt, null, -1); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | ?> |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
265 | 265 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
266 | 266 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
267 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
267 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
268 | 268 | <?php |
269 | 269 | if (!isset($type) || $type == 'aircraft') { |
270 | 270 | ?> |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
338 | 338 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
339 | 339 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
340 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
340 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
341 | 341 | <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
342 | 342 | <?php |
343 | 343 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -742,8 +742,8 @@ discard block |
||
742 | 742 | ?> |
743 | 743 | <div class="search"> |
744 | 744 | <form action="<?php print $globalURL; ?>/search" method="get"> |
745 | - <!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>--> |
|
746 | - <input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != ""){ print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
745 | + <!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>--> |
|
746 | + <input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != "") { print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
747 | 747 | </form> |
748 | 748 | </div> |
749 | 749 | <div class="social"> |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | print '</div>'; |
762 | 762 | } |
763 | 763 | |
764 | -if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
764 | +if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
765 | 765 | ?> |
766 | 766 | <div class="top-header clear" role="main"> |
767 | 767 | <?php |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | </div> |
775 | 775 | <?php |
776 | 776 | } |
777 | -if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
|
777 | +if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false)) |
|
778 | 778 | { |
779 | 779 | ?> |
780 | 780 | <div class="top-header clear" role="main"> |
@@ -787,15 +787,15 @@ discard block |
||
787 | 787 | var zoom = 13; |
788 | 788 | //create the map |
789 | 789 | <?php |
790 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
790 | + if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
791 | 791 | ?> |
792 | 792 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
793 | 793 | <?php |
794 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
794 | + } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) { |
|
795 | 795 | ?> |
796 | 796 | map = L.map('map', { zoomControl:true }); |
797 | 797 | <?php |
798 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
798 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
799 | 799 | ?> |
800 | 800 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
801 | 801 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
804 | 804 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
805 | 805 | <?php |
806 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
806 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
807 | 807 | ?> |
808 | 808 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
809 | 809 | <?php |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | // When button "Remove all filters" is clicked |
39 | 39 | if (isset($_POST['removefilters'])) { |
40 | 40 | $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
41 | - return strpos($key,'filter_') === 0; |
|
41 | + return strpos($key,'filter_') === 0; |
|
42 | 42 | }); |
43 | 43 | foreach ($allfilters as $filt) { |
44 | 44 | unset($_COOKIE[$filt]); |
@@ -404,34 +404,34 @@ discard block |
||
404 | 404 | |
405 | 405 | <ul class="nav navbar-nav"> |
406 | 406 | <?php |
407 | - if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) { |
|
407 | + if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) { |
|
408 | 408 | ?> |
409 | 409 | <li><a href="<?php print $globalURL; ?>/news"><?php echo _("News"); ?></a></li> |
410 | 410 | <?php |
411 | - } |
|
411 | + } |
|
412 | 412 | ?> |
413 | 413 | |
414 | 414 | <?php |
415 | - $sub = false; |
|
416 | - if ( |
|
415 | + $sub = false; |
|
416 | + if ( |
|
417 | 417 | ( |
418 | - (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
418 | + (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
419 | 419 | ) || |
420 | 420 | ( |
421 | - isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
421 | + isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
422 | 422 | ) || |
423 | 423 | ( |
424 | - isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
424 | + isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
425 | 425 | ) || |
426 | 426 | ( |
427 | - isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE)) |
|
427 | + isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE)) |
|
428 | 428 | ) |
429 | - ) { |
|
429 | + ) { |
|
430 | 430 | $sub = true; |
431 | - } |
|
431 | + } |
|
432 | 432 | ?> |
433 | 433 | <?php |
434 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
434 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
435 | 435 | ?> |
436 | 436 | <li class="dropdown"> |
437 | 437 | <?php |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | <ul class="dropdown-menu multi-level"> |
443 | 443 | <li class="dropdown-submenu"> |
444 | 444 | <?php |
445 | - } |
|
445 | + } |
|
446 | 446 | ?> |
447 | 447 | <?php |
448 | 448 | if (isset($globalNewsFeeds['aircraft']) && !empty($globalNewsFeeds['aircraft'])) { |
@@ -457,25 +457,25 @@ discard block |
||
457 | 457 | <ul class="dropdown-menu"> |
458 | 458 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li> |
459 | 459 | <?php |
460 | - if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
460 | + if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
461 | 461 | ?> |
462 | 462 | <li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li> |
463 | 463 | <?php |
464 | - } |
|
464 | + } |
|
465 | 465 | ?> |
466 | 466 | <li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li> |
467 | 467 | <?php |
468 | - if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
468 | + if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
469 | 469 | ?> |
470 | 470 | <li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li> |
471 | 471 | <?php |
472 | - } |
|
473 | - if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
472 | + } |
|
473 | + if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
474 | 474 | |
475 | 475 | ?> |
476 | 476 | <li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li> |
477 | 477 | <?php |
478 | - } |
|
478 | + } |
|
479 | 479 | ?> |
480 | 480 | <li><hr /></li> |
481 | 481 | <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li> |
@@ -483,43 +483,43 @@ discard block |
||
483 | 483 | <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li> |
484 | 484 | <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li> |
485 | 485 | <?php |
486 | - if ($globalACARS) { |
|
487 | - if (isset($globalDemo) && $globalDemo) { |
|
488 | - ?> |
|
486 | + if ($globalACARS) { |
|
487 | + if (isset($globalDemo) && $globalDemo) { |
|
488 | + ?> |
|
489 | 489 | <li><hr /></li> |
490 | 490 | <li><i><?php echo _('ACARS data not available publicly'); ?></i></li> |
491 | 491 | <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li> |
492 | 492 | <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li> |
493 | 493 | <?php |
494 | - } else { |
|
495 | - ?> |
|
494 | + } else { |
|
495 | + ?> |
|
496 | 496 | <li><hr /></li> |
497 | 497 | <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li> |
498 | 498 | <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li> |
499 | 499 | <?php |
500 | - } |
|
501 | - } |
|
502 | - ?> |
|
500 | + } |
|
501 | + } |
|
502 | + ?> |
|
503 | 503 | <?php |
504 | - if (isset($globalAccidents) && $globalAccidents) { |
|
505 | - ?> |
|
504 | + if (isset($globalAccidents) && $globalAccidents) { |
|
505 | + ?> |
|
506 | 506 | <li><hr /></li> |
507 | 507 | <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li> |
508 | 508 | <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li> |
509 | 509 | <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li> |
510 | 510 | <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li> |
511 | 511 | <?php |
512 | - } |
|
513 | - ?> |
|
512 | + } |
|
513 | + ?> |
|
514 | 514 | <li><hr /></li> |
515 | 515 | <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li> |
516 | 516 | <?php |
517 | 517 | if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) { |
518 | - ?> |
|
518 | + ?> |
|
519 | 519 | <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li> |
520 | 520 | <?php |
521 | 521 | } |
522 | - ?> |
|
522 | + ?> |
|
523 | 523 | </ul> |
524 | 524 | </li> |
525 | 525 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
@@ -546,14 +546,14 @@ discard block |
||
546 | 546 | </ul> |
547 | 547 | <?php |
548 | 548 | } |
549 | - } |
|
549 | + } |
|
550 | 550 | ?> |
551 | 551 | <?php |
552 | - if (isset($globalMarine) && $globalMarine) { |
|
552 | + if (isset($globalMarine) && $globalMarine) { |
|
553 | 553 | ?> |
554 | 554 | <li class="dropdown"> |
555 | 555 | <?php |
556 | - if ($sub) { |
|
556 | + if ($sub) { |
|
557 | 557 | ?> |
558 | 558 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Marines"); ?> <b class="caret"></b></a> |
559 | 559 | <ul class="dropdown-menu multi-level"> |
@@ -587,14 +587,14 @@ discard block |
||
587 | 587 | } |
588 | 588 | ?> |
589 | 589 | <?php |
590 | - } |
|
590 | + } |
|
591 | 591 | ?> |
592 | 592 | <?php |
593 | - if (isset($globalTracker) && $globalTracker) { |
|
593 | + if (isset($globalTracker) && $globalTracker) { |
|
594 | 594 | ?> |
595 | 595 | <li class="dropdown"> |
596 | 596 | <?php |
597 | - if ($sub) { |
|
597 | + if ($sub) { |
|
598 | 598 | ?> |
599 | 599 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a> |
600 | 600 | <ul class="dropdown-menu multi-level"> |
@@ -628,14 +628,14 @@ discard block |
||
628 | 628 | } |
629 | 629 | ?> |
630 | 630 | <?php |
631 | - } |
|
631 | + } |
|
632 | 632 | ?> |
633 | 633 | <?php |
634 | - if (isset($globalSatellite) && $globalSatellite) { |
|
634 | + if (isset($globalSatellite) && $globalSatellite) { |
|
635 | 635 | ?> |
636 | 636 | <li class="dropdown"> |
637 | 637 | <?php |
638 | - if ($sub) { |
|
638 | + if ($sub) { |
|
639 | 639 | ?> |
640 | 640 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Satellites"); ?> <b class="caret"></b></a> |
641 | 641 | <ul class="dropdown-menu multi-level"> |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | } |
672 | 672 | ?> |
673 | 673 | <?php |
674 | - } |
|
674 | + } |
|
675 | 675 | ?> |
676 | 676 | |
677 | 677 | <li class="dropdown"> |
@@ -680,12 +680,12 @@ discard block |
||
680 | 680 | <li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li> |
681 | 681 | <li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li> |
682 | 682 | <?php |
683 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
683 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
684 | 684 | ?> |
685 | 685 | <li><hr /></li> |
686 | 686 | <li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li> |
687 | 687 | <?php |
688 | - } |
|
688 | + } |
|
689 | 689 | ?> |
690 | 690 | <?php if (isset($globalContribute) && $globalContribute) { ?> |
691 | 691 | <li><hr /></li> |
@@ -709,13 +709,13 @@ discard block |
||
709 | 709 | <form> |
710 | 710 | <select class="selectpicker" data-width="120px" onchange="language(this);"> |
711 | 711 | <?php |
712 | - foreach ($alllang as $key => $lang) { |
|
713 | - print '<option value="'.$key.'"'; |
|
714 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
715 | - if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (βeta)</option>'; |
|
716 | - else print '>'.$lang[0].'</option>'; |
|
717 | - } |
|
718 | - ?> |
|
712 | + foreach ($alllang as $key => $lang) { |
|
713 | + print '<option value="'.$key.'"'; |
|
714 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
715 | + if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (βeta)</option>'; |
|
716 | + else print '>'.$lang[0].'</option>'; |
|
717 | + } |
|
718 | + ?> |
|
719 | 719 | </select> |
720 | 720 | </form> |
721 | 721 | </div> |
@@ -748,18 +748,18 @@ discard block |
||
748 | 748 | ?> |
749 | 749 | <div class="top-header clear" role="main"> |
750 | 750 | <?php |
751 | - if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
751 | + if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
752 | 752 | ?> |
753 | 753 | <div id="archive-map"></div> |
754 | 754 | <?php |
755 | - } |
|
755 | + } |
|
756 | 756 | ?> |
757 | 757 | </div> |
758 | 758 | <?php |
759 | 759 | } |
760 | 760 | if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
761 | 761 | { |
762 | - ?> |
|
762 | + ?> |
|
763 | 763 | <div class="top-header clear" role="main"> |
764 | 764 | <div id="map"></div> |
765 | 765 | <link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" /> |
@@ -770,15 +770,15 @@ discard block |
||
770 | 770 | var zoom = 13; |
771 | 771 | //create the map |
772 | 772 | <?php |
773 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
773 | + if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
774 | 774 | ?> |
775 | 775 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
776 | 776 | <?php |
777 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
777 | + } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
778 | 778 | ?> |
779 | 779 | map = L.map('map', { zoomControl:true }); |
780 | 780 | <?php |
781 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
781 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
782 | 782 | ?> |
783 | 783 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
784 | 784 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -786,22 +786,22 @@ discard block |
||
786 | 786 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
787 | 787 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
788 | 788 | <?php |
789 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
789 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
790 | 790 | ?> |
791 | 791 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
792 | 792 | <?php |
793 | - } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
793 | + } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
794 | 794 | ?> |
795 | 795 | map = L.map('map', { zoomControl:true }); |
796 | 796 | <?php |
797 | - } |
|
797 | + } |
|
798 | 798 | ?> |
799 | 799 | //initialize the layer group for the aircrft markers |
800 | 800 | var layer_data = L.layerGroup(); |
801 | 801 | |
802 | 802 | //a few title layers |
803 | 803 | <?php |
804 | - if ($globalMapProvider == 'Mapbox') { |
|
804 | + if ($globalMapProvider == 'Mapbox') { |
|
805 | 805 | ?> |
806 | 806 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
807 | 807 | maxZoom: 18, |
@@ -812,14 +812,14 @@ discard block |
||
812 | 812 | token : '<?php print $globalMapboxToken; ?>' |
813 | 813 | }).addTo(map); |
814 | 814 | <?php |
815 | - } elseif ($globalMapProvider == 'Mapbox-GL') { |
|
815 | + } elseif ($globalMapProvider == 'Mapbox-GL') { |
|
816 | 816 | ?> |
817 | 817 | L.mapboxGL({ |
818 | 818 | accessToken: '<?php print $globalMapboxToken; ?>', |
819 | 819 | style: 'mapbox://styles/mapbox/bright-v8' |
820 | 820 | }).addTo(map); |
821 | 821 | <?php |
822 | - } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
822 | + } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
823 | 823 | ?> |
824 | 824 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { |
825 | 825 | maxZoom: 18, |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>' |
829 | 829 | }).addTo(map); |
830 | 830 | <?php |
831 | - } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
831 | + } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
832 | 832 | ?> |
833 | 833 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', { |
834 | 834 | maxZoom: 18, |
@@ -837,27 +837,27 @@ discard block |
||
837 | 837 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"' |
838 | 838 | }).addTo(map); |
839 | 839 | <?php |
840 | - } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
840 | + } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
841 | 841 | ?> |
842 | 842 | var googleLayer = new L.Google('ROADMAP'); |
843 | 843 | map.addLayer(googleLayer); |
844 | 844 | <?php |
845 | - } elseif ($globalMapProvider == 'Google-Satellite') { |
|
845 | + } elseif ($globalMapProvider == 'Google-Satellite') { |
|
846 | 846 | ?> |
847 | 847 | var googleLayer = new L.Google('SATELLITE'); |
848 | 848 | map.addLayer(googleLayer); |
849 | 849 | <?php |
850 | - } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
850 | + } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
851 | 851 | ?> |
852 | 852 | var googleLayer = new L.Google('HYBRID'); |
853 | 853 | map.addLayer(googleLayer); |
854 | 854 | <?php |
855 | - } elseif ($globalMapProvider == 'Google-Terrain') { |
|
855 | + } elseif ($globalMapProvider == 'Google-Terrain') { |
|
856 | 856 | ?> |
857 | 857 | var googleLayer = new L.Google('Terrain'); |
858 | 858 | map.addLayer(googleLayer); |
859 | 859 | <?php |
860 | - } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
860 | + } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
861 | 861 | $customid = $globalMapProvider; |
862 | 862 | ?> |
863 | 863 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
868 | 868 | }).addTo(map); |
869 | 869 | <?php |
870 | - } elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) { |
|
870 | + } elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) { |
|
871 | 871 | ?> |
872 | 872 | var center = map.getCenter(); |
873 | 873 | map.options.crs = L.CRS.EPSG4326; |
@@ -882,8 +882,8 @@ discard block |
||
882 | 882 | attribution: 'Natural Earth' |
883 | 883 | }).addTo(map); |
884 | 884 | <?php |
885 | - //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
886 | - } else { |
|
885 | + //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
886 | + } else { |
|
887 | 887 | ?> |
888 | 888 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
889 | 889 | maxZoom: 18, |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | }).addTo(map); |
893 | 893 | |
894 | 894 | <?php |
895 | - } |
|
895 | + } |
|
896 | 896 | ?> |
897 | 897 | </script> |
898 | 898 | </div> |
@@ -6,12 +6,19 @@ discard block |
||
6 | 6 | //gets the page file and stores it in a variable |
7 | 7 | $file_path = pathinfo($_SERVER['SCRIPT_NAME']); |
8 | 8 | $current_page = $file_path['filename']; |
9 | -if ($globalTimezone == '') $globalTimezone = 'UTC'; |
|
9 | +if ($globalTimezone == '') { |
|
10 | + $globalTimezone = 'UTC'; |
|
11 | +} |
|
10 | 12 | date_default_timezone_set($globalTimezone); |
11 | -if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType']; |
|
12 | -else $MapType = $globalMapProvider; |
|
13 | +if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') { |
|
14 | + $MapType = $_COOKIE['MapType']; |
|
15 | +} else { |
|
16 | + $MapType = $globalMapProvider; |
|
17 | +} |
|
13 | 18 | |
14 | -if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline'; |
|
19 | +if (isset($globalMapOffline) && $globalMapOffline) { |
|
20 | + $MapType = 'offline'; |
|
21 | +} |
|
15 | 22 | |
16 | 23 | if (isset($_GET['3d'])) { |
17 | 24 | setcookie('MapFormat','3d'); |
@@ -204,7 +211,10 @@ discard block |
||
204 | 211 | <?php |
205 | 212 | } else { |
206 | 213 | ?> |
207 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) print '&tsk='.$tsk; ?>"></script> |
|
214 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) { |
|
215 | + print '&tsk='.$tsk; |
|
216 | +} |
|
217 | +?>"></script> |
|
208 | 218 | <?php |
209 | 219 | } |
210 | 220 | if (!isset($globalAircraft) || $globalAircraft) { |
@@ -244,7 +254,13 @@ discard block |
||
244 | 254 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
245 | 255 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
246 | 256 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
247 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
257 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) { |
|
258 | + print '&latitude='.$latitude; |
|
259 | +} |
|
260 | +?><?php if(isset($longitude)) { |
|
261 | + print '&longitude='.$longitude; |
|
262 | +} |
|
263 | +?>&<?php print time(); ?>"></script> |
|
248 | 264 | <?php |
249 | 265 | if (!isset($type) || $type == 'aircraft') { |
250 | 266 | ?> |
@@ -317,7 +333,13 @@ discard block |
||
317 | 333 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
318 | 334 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
319 | 335 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
320 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
336 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) { |
|
337 | + print '&latitude='.$latitude; |
|
338 | +} |
|
339 | +?><?php if(isset($longitude)) { |
|
340 | + print '&longitude='.$longitude; |
|
341 | +} |
|
342 | +?>&<?php print time(); ?>"></script> |
|
321 | 343 | <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
322 | 344 | <?php |
323 | 345 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -398,7 +420,12 @@ discard block |
||
398 | 420 | <span class="icon-bar"></span> |
399 | 421 | </button> |
400 | 422 | <a href="<?php print $globalURL; ?>/search" class="navbar-toggle search"><i class="fa fa-search"></i></a> |
401 | - <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
423 | + <a class="navbar-brand" href="<?php if ($globalURL == '') { |
|
424 | + print '/'; |
|
425 | +} else { |
|
426 | + print $globalURL; |
|
427 | +} |
|
428 | +?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
402 | 429 | </div> |
403 | 430 | <div class="collapse navbar-collapse"> |
404 | 431 | |
@@ -453,7 +480,10 @@ discard block |
||
453 | 480 | } |
454 | 481 | ?> |
455 | 482 | |
456 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
483 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
484 | + echo 'right-'; |
|
485 | +} |
|
486 | +?>caret"></b></a> |
|
457 | 487 | <ul class="dropdown-menu"> |
458 | 488 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li> |
459 | 489 | <?php |
@@ -524,8 +554,14 @@ discard block |
||
524 | 554 | </li> |
525 | 555 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
526 | 556 | <li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li> |
527 | - <li class="dropdown<?php if ($sub) echo '-submenu'; ?>"> |
|
528 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
557 | + <li class="dropdown<?php if ($sub) { |
|
558 | + echo '-submenu'; |
|
559 | +} |
|
560 | +?>"> |
|
561 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) { |
|
562 | + echo 'right-'; |
|
563 | +} |
|
564 | +?>caret"></b></a> |
|
529 | 565 | <ul class="dropdown-menu"> |
530 | 566 | <li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li> |
531 | 567 | <li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li> |
@@ -569,7 +605,10 @@ discard block |
||
569 | 605 | <?php |
570 | 606 | } |
571 | 607 | ?> |
572 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
608 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
609 | + echo 'right-'; |
|
610 | +} |
|
611 | +?>caret"></b></a> |
|
573 | 612 | <ul class="dropdown-menu"> |
574 | 613 | <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li> |
575 | 614 | <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -610,7 +649,10 @@ discard block |
||
610 | 649 | <?php |
611 | 650 | } |
612 | 651 | ?> |
613 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
652 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
653 | + echo 'right-'; |
|
654 | +} |
|
655 | +?>caret"></b></a> |
|
614 | 656 | <ul class="dropdown-menu"> |
615 | 657 | <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li> |
616 | 658 | <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -653,7 +695,10 @@ discard block |
||
653 | 695 | ?> |
654 | 696 | |
655 | 697 | <!-- |
656 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
698 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
699 | + echo 'right-'; |
|
700 | +} |
|
701 | +?>caret"></b></a> |
|
657 | 702 | <ul class="dropdown-menu"> |
658 | 703 | <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li> |
659 | 704 | <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -711,9 +756,14 @@ discard block |
||
711 | 756 | <?php |
712 | 757 | foreach ($alllang as $key => $lang) { |
713 | 758 | print '<option value="'.$key.'"'; |
714 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
715 | - if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (βeta)</option>'; |
|
716 | - else print '>'.$lang[0].'</option>'; |
|
759 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) { |
|
760 | + print ' selected '; |
|
761 | + } |
|
762 | + if ($lang[0] == 'Deutsch') { |
|
763 | + print '>'.$lang[0].' (βeta)</option>'; |
|
764 | + } else { |
|
765 | + print '>'.$lang[0].'</option>'; |
|
766 | + } |
|
717 | 767 | } |
718 | 768 | ?> |
719 | 769 | </select> |
@@ -861,9 +911,24 @@ discard block |
||
861 | 911 | $customid = $globalMapProvider; |
862 | 912 | ?> |
863 | 913 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
864 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
865 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
866 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
914 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
915 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
916 | +} else { |
|
917 | + print '18'; |
|
918 | +} |
|
919 | +?>, |
|
920 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
921 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
922 | +} else { |
|
923 | + print '0'; |
|
924 | +} |
|
925 | +?>, |
|
926 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
927 | + print 'false'; |
|
928 | +} else { |
|
929 | + print 'true'; |
|
930 | +} |
|
931 | +?>, |
|
867 | 932 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
868 | 933 | }).addTo(map); |
869 | 934 | <?php |
@@ -878,7 +943,12 @@ discard block |
||
878 | 943 | maxZoom: 5, |
879 | 944 | tms : true, |
880 | 945 | zindex : 3, |
881 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
946 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
947 | + print 'false'; |
|
948 | +} else { |
|
949 | + print 'true'; |
|
950 | +} |
|
951 | +?>, |
|
882 | 952 | attribution: 'Natural Earth' |
883 | 953 | }).addTo(map); |
884 | 954 | <?php |
@@ -901,4 +971,7 @@ discard block |
||
901 | 971 | |
902 | 972 | ?> |
903 | 973 | |
904 | -<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear"> |
|
974 | +<section class="container main-content <?php if (strtolower($current_page) == 'index') { |
|
975 | + print 'index '; |
|
976 | +} |
|
977 | +?>clear"> |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | $gpx .= '<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpsies="http://www.gpsies.com/GPX/1/0" creator="GPSies http://www.gpsies.com - Sendl.-O&apos;sch-heim" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.gpsies.com/GPX/1/0 http://www.gpsies.com/gpsies.xsd">'; |
45 | 45 | $gpx .= '<trk>'; |
46 | 46 | $gpx .= '<trkseg>'; |
47 | - foreach($spotter_history_array as $spotter_data) { |
|
48 | - $gpx .= '<trkpt lat="'.sprintf("%.8f",$spotter_data['latitude']).'" lon="'.sprintf("%.8f",$spotter_data['longitude']).'">'; |
|
49 | - if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>'; |
|
50 | - $gpx .= '<time>'.date("Y-m-d\TH:i:s\Z",strtotime($spotter_data['date'])).'</time>'; |
|
47 | + foreach ($spotter_history_array as $spotter_data) { |
|
48 | + $gpx .= '<trkpt lat="'.sprintf("%.8f", $spotter_data['latitude']).'" lon="'.sprintf("%.8f", $spotter_data['longitude']).'">'; |
|
49 | + if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f", $spotter_data['altitude']).'</ele>'; |
|
50 | + $gpx .= '<time>'.date("Y-m-d\TH:i:s\Z", strtotime($spotter_data['date'])).'</time>'; |
|
51 | 51 | $gpx .= '</trkpt>'; |
52 | 52 | } |
53 | 53 | $gpx .= '</trkseg>'; |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | global $globalMapMatchingMaxPts, $globalTrackMatchingAppKey, $globalTrackMatchingAppId; |
85 | 85 | if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100; |
86 | 86 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
87 | - if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
87 | + if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
88 | 88 | $data = $this->create_gpx($spotter_history_array); |
89 | 89 | $url = 'https://test.roadmatching.com/rest/mapmatch/?app_id='.$globalTrackMatchingAppId.'&app_key='.$globalTrackMatchingAppKey.'&output.waypoints=true'; |
90 | 90 | $Common = new Common(); |
91 | - $matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml','Accept: application/json')); |
|
92 | - $matching = json_decode($matching,true); |
|
91 | + $matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml', 'Accept: application/json')); |
|
92 | + $matching = json_decode($matching, true); |
|
93 | 93 | if (isset($matching['diary']['entries'][0]['route']['links'])) { |
94 | 94 | $spotter_history_array = array(); |
95 | 95 | foreach ($matching['diary']['entries'][0]['route']['links'] as $match) { |
96 | 96 | if (isset($match['wpts'])) { |
97 | 97 | foreach ($match['wpts'] as $coord) { |
98 | - $spotter_history_array[] = array('longitude' => $coord['x'],'latitude' => $coord['y']); |
|
98 | + $spotter_history_array[] = array('longitude' => $coord['x'], 'latitude' => $coord['y']); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
@@ -115,22 +115,22 @@ discard block |
||
115 | 115 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
116 | 116 | $spotter_history_initial_array = array(); |
117 | 117 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
118 | - $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
119 | - $spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts); |
|
118 | + $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
119 | + $spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts); |
|
120 | 120 | } |
121 | 121 | $data = $this->create_gpx($spotter_history_array); |
122 | 122 | $url = 'https://graphhopper.com/api/1/match?vehicle=car&points_encoded=0&instructions=false&key='.$globalGraphHopperKey; |
123 | 123 | $Common = new Common(); |
124 | - $matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml')); |
|
125 | - $matching = json_decode($matching,true); |
|
124 | + $matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml')); |
|
125 | + $matching = json_decode($matching, true); |
|
126 | 126 | if (isset($matching['paths'][0]['points']['coordinates'])) { |
127 | 127 | $spotter_history_array = array(); |
128 | 128 | foreach ($matching['paths'][0]['points']['coordinates'] as $match) { |
129 | 129 | $coord = $match; |
130 | - $spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]); |
|
130 | + $spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]); |
|
131 | 131 | } |
132 | 132 | } |
133 | - $spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array); |
|
133 | + $spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array); |
|
134 | 134 | $spotter_history_array[0]['mapmatching_engine'] = 'graphhopper'; |
135 | 135 | return $spotter_history_array; |
136 | 136 | } |
@@ -146,23 +146,23 @@ discard block |
||
146 | 146 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
147 | 147 | $spotter_history_initial_array = array(); |
148 | 148 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
149 | - $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
150 | - $spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts); |
|
149 | + $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
150 | + $spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts); |
|
151 | 151 | } |
152 | 152 | $data = $this->create_gpx($spotter_history_array); |
153 | 153 | $url = 'https://mapmatching.flightairmap.com/api/1/match?vehicle=car&points_encoded=0&instructions=false'; |
154 | 154 | //$url = 'https://mapmatching.flightairmap.com/api/1/match?vehicle=car&points_encoded=0'; |
155 | 155 | $Common = new Common(); |
156 | - $matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml')); |
|
157 | - $matching = json_decode($matching,true); |
|
156 | + $matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml')); |
|
157 | + $matching = json_decode($matching, true); |
|
158 | 158 | if (isset($matching['paths'][0]['points']['coordinates'])) { |
159 | 159 | $spotter_history_array = array(); |
160 | 160 | foreach ($matching['paths'][0]['points']['coordinates'] as $match) { |
161 | 161 | $coord = $match; |
162 | - $spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]); |
|
162 | + $spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]); |
|
163 | 163 | } |
164 | 164 | } |
165 | - $spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array); |
|
165 | + $spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array); |
|
166 | 166 | $spotter_history_array[0]['mapmatching_engine'] = 'fam'; |
167 | 167 | return $spotter_history_array; |
168 | 168 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
179 | 179 | $spotter_history_initial_array = array(); |
180 | 180 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
181 | - $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
182 | - $spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts); |
|
181 | + $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
182 | + $spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts); |
|
183 | 183 | } |
184 | 184 | $coord = ''; |
185 | 185 | $ts = ''; |
@@ -195,15 +195,15 @@ discard block |
||
195 | 195 | $url = 'https://router.project-osrm.org/match/v1/driving/'.$coord.'?timestamps='.$ts.'&overview=full&geometries=geojson&tidy=true&gaps=ignore'; |
196 | 196 | $Common = new Common(); |
197 | 197 | $matching = $Common->getData($url); |
198 | - $matching = json_decode($matching,true); |
|
198 | + $matching = json_decode($matching, true); |
|
199 | 199 | if (isset($matching['matchings'][0]['geometry']['coordinates'])) { |
200 | 200 | $spotter_history_array = array(); |
201 | 201 | foreach ($matching['matchings'][0]['geometry']['coordinates'] as $match) { |
202 | 202 | $coord = $match; |
203 | - $spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]); |
|
203 | + $spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]); |
|
204 | 204 | } |
205 | 205 | } |
206 | - $spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array); |
|
206 | + $spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array); |
|
207 | 207 | $spotter_history_array[0]['mapmatching_engine'] = 'osmr'; |
208 | 208 | return $spotter_history_array; |
209 | 209 | } |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | if (count($spotter_history_array) < 2) return $spotter_history_array; |
220 | 220 | $spotter_history_initial_array = array(); |
221 | 221 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
222 | - $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
223 | - $spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts); |
|
222 | + $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts); |
|
223 | + $spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts); |
|
224 | 224 | } |
225 | 225 | $coord = ''; |
226 | 226 | $ts = ''; |
@@ -237,15 +237,15 @@ discard block |
||
237 | 237 | $url = 'https://api.mapbox.com/matching/v5/mapbox/driving/'.$coord.'?access_token='.$globalMapboxToken.'×tamps='.$ts.'&overview=full&tidy=true&geometries=geojson'; |
238 | 238 | $Common = new Common(); |
239 | 239 | $matching = $Common->getData($url); |
240 | - $matching = json_decode($matching,true); |
|
240 | + $matching = json_decode($matching, true); |
|
241 | 241 | if (isset($matching['matchings'][0]['geometry']['coordinates'])) { |
242 | 242 | $spotter_history_array = array(); |
243 | 243 | foreach ($matching['matchings'][0]['geometry']['coordinates'] as $match) { |
244 | 244 | $coord = $match; |
245 | - $spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]); |
|
245 | + $spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]); |
|
246 | 246 | } |
247 | 247 | } |
248 | - $spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array); |
|
248 | + $spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array); |
|
249 | 249 | $spotter_history_array[0]['mapmatching_engine'] = 'mapbox'; |
250 | 250 | return $spotter_history_array; |
251 | 251 | } |
@@ -46,7 +46,9 @@ discard block |
||
46 | 46 | $gpx .= '<trkseg>'; |
47 | 47 | foreach($spotter_history_array as $spotter_data) { |
48 | 48 | $gpx .= '<trkpt lat="'.sprintf("%.8f",$spotter_data['latitude']).'" lon="'.sprintf("%.8f",$spotter_data['longitude']).'">'; |
49 | - if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>'; |
|
49 | + if (isset($spotter_data['altitude'])) { |
|
50 | + $gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>'; |
|
51 | + } |
|
50 | 52 | $gpx .= '<time>'.date("Y-m-d\TH:i:s\Z",strtotime($spotter_data['date'])).'</time>'; |
51 | 53 | $gpx .= '</trkpt>'; |
52 | 54 | } |
@@ -82,9 +84,15 @@ discard block |
||
82 | 84 | |
83 | 85 | public function TrackMatching($spotter_history_array) { |
84 | 86 | global $globalMapMatchingMaxPts, $globalTrackMatchingAppKey, $globalTrackMatchingAppId; |
85 | - if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100; |
|
86 | - if (count($spotter_history_array) < 2) return $spotter_history_array; |
|
87 | - if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
87 | + if (!isset($globalMapMatchingMaxPts)) { |
|
88 | + $globalMapMatchingMaxPts = 100; |
|
89 | + } |
|
90 | + if (count($spotter_history_array) < 2) { |
|
91 | + return $spotter_history_array; |
|
92 | + } |
|
93 | + if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
|
94 | + $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
|
95 | + } |
|
88 | 96 | $data = $this->create_gpx($spotter_history_array); |
89 | 97 | $url = 'https://test.roadmatching.com/rest/mapmatch/?app_id='.$globalTrackMatchingAppId.'&app_key='.$globalTrackMatchingAppKey.'&output.waypoints=true'; |
90 | 98 | $Common = new Common(); |
@@ -111,8 +119,12 @@ discard block |
||
111 | 119 | */ |
112 | 120 | public function GraphHopper($spotter_history_array) { |
113 | 121 | global $globalMapMatchingMaxPts, $globalGraphHopperKey; |
114 | - if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100; |
|
115 | - if (count($spotter_history_array) < 2) return $spotter_history_array; |
|
122 | + if (!isset($globalMapMatchingMaxPts)) { |
|
123 | + $globalMapMatchingMaxPts = 100; |
|
124 | + } |
|
125 | + if (count($spotter_history_array) < 2) { |
|
126 | + return $spotter_history_array; |
|
127 | + } |
|
116 | 128 | $spotter_history_initial_array = array(); |
117 | 129 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
118 | 130 | $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
@@ -142,8 +154,12 @@ discard block |
||
142 | 154 | */ |
143 | 155 | public function FAMMapMatching($spotter_history_array) { |
144 | 156 | global $globalMapMatchingMaxPts, $globalGraphHopperKey; |
145 | - if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100; |
|
146 | - if (count($spotter_history_array) < 2) return $spotter_history_array; |
|
157 | + if (!isset($globalMapMatchingMaxPts)) { |
|
158 | + $globalMapMatchingMaxPts = 100; |
|
159 | + } |
|
160 | + if (count($spotter_history_array) < 2) { |
|
161 | + return $spotter_history_array; |
|
162 | + } |
|
147 | 163 | $spotter_history_initial_array = array(); |
148 | 164 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
149 | 165 | $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
@@ -174,8 +190,12 @@ discard block |
||
174 | 190 | */ |
175 | 191 | public function osmr($spotter_history_array) { |
176 | 192 | global $globalMapMatchingMaxPts; |
177 | - if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 50; |
|
178 | - if (count($spotter_history_array) < 2) return $spotter_history_array; |
|
193 | + if (!isset($globalMapMatchingMaxPts)) { |
|
194 | + $globalMapMatchingMaxPts = 50; |
|
195 | + } |
|
196 | + if (count($spotter_history_array) < 2) { |
|
197 | + return $spotter_history_array; |
|
198 | + } |
|
179 | 199 | $spotter_history_initial_array = array(); |
180 | 200 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
181 | 201 | $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
@@ -185,11 +205,17 @@ discard block |
||
185 | 205 | $ts = ''; |
186 | 206 | $rd = ''; |
187 | 207 | foreach ($spotter_history_array as $spotter_data) { |
188 | - if ($coord != '') $coord .= ';'; |
|
208 | + if ($coord != '') { |
|
209 | + $coord .= ';'; |
|
210 | + } |
|
189 | 211 | $coord .= $spotter_data['longitude'].','.$spotter_data['latitude']; |
190 | - if ($ts != '') $ts .= ';'; |
|
212 | + if ($ts != '') { |
|
213 | + $ts .= ';'; |
|
214 | + } |
|
191 | 215 | $ts .= strtotime($spotter_data['date']); |
192 | - if ($rd != '') $rd .= ';'; |
|
216 | + if ($rd != '') { |
|
217 | + $rd .= ';'; |
|
218 | + } |
|
193 | 219 | $rd .= '20'; |
194 | 220 | } |
195 | 221 | $url = 'https://router.project-osrm.org/match/v1/driving/'.$coord.'?timestamps='.$ts.'&overview=full&geometries=geojson&tidy=true&gaps=ignore'; |
@@ -215,8 +241,12 @@ discard block |
||
215 | 241 | */ |
216 | 242 | public function mapbox($spotter_history_array) { |
217 | 243 | global $globalMapMatchingMaxPts, $globalMapboxToken; |
218 | - if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 60; |
|
219 | - if (count($spotter_history_array) < 2) return $spotter_history_array; |
|
244 | + if (!isset($globalMapMatchingMaxPts)) { |
|
245 | + $globalMapMatchingMaxPts = 60; |
|
246 | + } |
|
247 | + if (count($spotter_history_array) < 2) { |
|
248 | + return $spotter_history_array; |
|
249 | + } |
|
220 | 250 | $spotter_history_initial_array = array(); |
221 | 251 | if (count($spotter_history_array) > $globalMapMatchingMaxPts) { |
222 | 252 | $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts); |
@@ -226,11 +256,17 @@ discard block |
||
226 | 256 | $ts = ''; |
227 | 257 | $rd = ''; |
228 | 258 | foreach ($spotter_history_array as $spotter_data) { |
229 | - if ($coord != '') $coord .= ';'; |
|
259 | + if ($coord != '') { |
|
260 | + $coord .= ';'; |
|
261 | + } |
|
230 | 262 | $coord .= $spotter_data['longitude'].','.$spotter_data['latitude']; |
231 | - if ($ts != '') $ts .= ';'; |
|
263 | + if ($ts != '') { |
|
264 | + $ts .= ';'; |
|
265 | + } |
|
232 | 266 | $ts .= strtotime($spotter_data['date']); |
233 | - if ($rd != '') $rd .= ';'; |
|
267 | + if ($rd != '') { |
|
268 | + $rd .= ';'; |
|
269 | + } |
|
234 | 270 | $rd .= '20'; |
235 | 271 | } |
236 | 272 | //$url = 'https://api.mapbox.com/matching/v5/mapbox/driving/'.$coord.'?access_token='.$globalMapboxToken.'×tamps='.$ts.'&overview=full&tidy=true&geometries=geojson&radiuses='.$rd; |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | require_once('header.php'); |
8 | 8 | |
9 | 9 | //calculuation for the pagination |
10 | -if(!isset($_GET['limit'])) |
|
10 | +if (!isset($_GET['limit'])) |
|
11 | 11 | { |
12 | 12 | $limit_start = 0; |
13 | 13 | $limit_end = 28; |
14 | 14 | $absolute_difference = 28; |
15 | 15 | } else { |
16 | 16 | $limit_explode = explode(",", $_GET['limit']); |
17 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
18 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
17 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
18 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
19 | 19 | if (!ctype_digit(strval($limit_start)) || !ctype_digit(strval($limit_end))) { |
20 | 20 | $limit_start = 0; |
21 | 21 | $limit_end = 25; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | print '<div class="column">'; |
40 | 40 | print '<p>'._("The view below shows all aircraft that have been selected to have some sort of special characteristic about them, such as unique liveries, destinations etc.").'</p>'; |
41 | 41 | |
42 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
42 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
43 | 43 | if ($sort != '') { |
44 | 44 | $spotter_array = $Spotter->getSpotterDataByHighlight($limit_start.",".$absolute_difference, $sort); |
45 | 45 | } else { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if (!empty($spotter_array)) |
49 | 49 | { |
50 | 50 | print '<div class="dispay-view">'; |
51 | - foreach($spotter_array as $spotter_item) |
|
51 | + foreach ($spotter_array as $spotter_item) |
|
52 | 52 | { |
53 | 53 | if (isset($spotter_item['image']) && $spotter_item['image'] != "") |
54 | 54 | { |