@@ -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 |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | try { |
15 | 15 | $sth = $Connection->db->prepare($query); |
16 | 16 | $sth->execute(); |
17 | - } catch(PDOException $e) { |
|
17 | + } catch (PDOException $e) { |
|
18 | 18 | return "error : ".$e->getMessage()."\n"; |
19 | 19 | } |
20 | 20 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
21 | - $Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']); |
|
21 | + $Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | try { |
51 | 51 | $sth = $Connection->db->prepare($query); |
52 | 52 | $sth->execute(); |
53 | - } catch(PDOException $e) { |
|
53 | + } catch (PDOException $e) { |
|
54 | 54 | return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
55 | 55 | } |
56 | 56 | // Copy schedules data to routes table |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | try { |
61 | 61 | $sth = $Connection->db->prepare($query); |
62 | 62 | $sth->execute(); |
63 | - } catch(PDOException $e) { |
|
63 | + } catch (PDOException $e) { |
|
64 | 64 | return "error (delete schedule table) : ".$e->getMessage()."\n"; |
65 | 65 | } |
66 | 66 | // Add source column |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | try { |
69 | 69 | $sth = $Connection->db->prepare($query); |
70 | 70 | $sth->execute(); |
71 | - } catch(PDOException $e) { |
|
71 | + } catch (PDOException $e) { |
|
72 | 72 | return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n"; |
73 | 73 | } |
74 | 74 | // Delete unused column |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | try { |
77 | 77 | $sth = $Connection->db->prepare($query); |
78 | 78 | $sth->execute(); |
79 | - } catch(PDOException $e) { |
|
79 | + } catch (PDOException $e) { |
|
80 | 80 | return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n"; |
81 | 81 | } |
82 | 82 | // Add ModeS column |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | try { |
85 | 85 | $sth = $Connection->db->prepare($query); |
86 | 86 | $sth->execute(); |
87 | - } catch(PDOException $e) { |
|
87 | + } catch (PDOException $e) { |
|
88 | 88 | return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n"; |
89 | 89 | } |
90 | 90 | $query = "ALTER TABLE `spotter_live` ADD `ModeS` VARCHAR(255)"; |
91 | 91 | try { |
92 | 92 | $sth = $Connection->db->prepare($query); |
93 | 93 | $sth->execute(); |
94 | - } catch(PDOException $e) { |
|
94 | + } catch (PDOException $e) { |
|
95 | 95 | return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n"; |
96 | 96 | } |
97 | 97 | // Add auto_increment for aircraft_modes |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | try { |
100 | 100 | $sth = $Connection->db->prepare($query); |
101 | 101 | $sth->execute(); |
102 | - } catch(PDOException $e) { |
|
102 | + } catch (PDOException $e) { |
|
103 | 103 | return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n"; |
104 | 104 | } |
105 | 105 | $error = ''; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | try { |
111 | 111 | $sth = $Connection->db->prepare($query); |
112 | 112 | $sth->execute(); |
113 | - } catch(PDOException $e) { |
|
113 | + } catch (PDOException $e) { |
|
114 | 114 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
115 | 115 | } |
116 | 116 | return $error; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | try { |
124 | 124 | $sth = $Connection->db->prepare($query); |
125 | 125 | $sth->execute(); |
126 | - } catch(PDOException $e) { |
|
126 | + } catch (PDOException $e) { |
|
127 | 127 | return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
128 | 128 | } |
129 | 129 | $error = ''; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | try { |
135 | 135 | $sth = $Connection->db->prepare($query); |
136 | 136 | $sth->execute(); |
137 | - } catch(PDOException $e) { |
|
137 | + } catch (PDOException $e) { |
|
138 | 138 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
139 | 139 | } |
140 | 140 | return $error; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | try { |
148 | 148 | $sth = $Connection->db->prepare($query); |
149 | 149 | $sth->execute(); |
150 | - } catch(PDOException $e) { |
|
150 | + } catch (PDOException $e) { |
|
151 | 151 | return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n"; |
152 | 152 | } |
153 | 153 | // Add image_source_website column to spotter_image |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | try { |
156 | 156 | $sth = $Connection->db->prepare($query); |
157 | 157 | $sth->execute(); |
158 | - } catch(PDOException $e) { |
|
158 | + } catch (PDOException $e) { |
|
159 | 159 | return "error (add new columns to spotter_image) : ".$e->getMessage()."\n"; |
160 | 160 | } |
161 | 161 | $error = ''; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | try { |
165 | 165 | $sth = $Connection->db->prepare($query); |
166 | 166 | $sth->execute(); |
167 | - } catch(PDOException $e) { |
|
167 | + } catch (PDOException $e) { |
|
168 | 168 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
169 | 169 | } |
170 | 170 | return $error; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | try { |
183 | 183 | $sth = $Connection->db->prepare($query); |
184 | 184 | $sth->execute(); |
185 | - } catch(PDOException $e) { |
|
185 | + } catch (PDOException $e) { |
|
186 | 186 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
187 | 187 | } |
188 | 188 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | try { |
197 | 197 | $sth = $Connection->db->prepare($query); |
198 | 198 | $sth->execute(); |
199 | - } catch(PDOException $e) { |
|
199 | + } catch (PDOException $e) { |
|
200 | 200 | return "error (add new columns to translation) : ".$e->getMessage()."\n"; |
201 | 201 | } |
202 | 202 | // Add aircraft_shadow column to aircraft |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | try { |
205 | 205 | $sth = $Connection->db->prepare($query); |
206 | 206 | $sth->execute(); |
207 | - } catch(PDOException $e) { |
|
207 | + } catch (PDOException $e) { |
|
208 | 208 | return "error (add new column to aircraft) : ".$e->getMessage()."\n"; |
209 | 209 | } |
210 | 210 | // Add aircraft_shadow column to spotter_live |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | try { |
213 | 213 | $sth = $Connection->db->prepare($query); |
214 | 214 | $sth->execute(); |
215 | - } catch(PDOException $e) { |
|
215 | + } catch (PDOException $e) { |
|
216 | 216 | return "error (add new column to spotter_live) : ".$e->getMessage()."\n"; |
217 | 217 | } |
218 | 218 | $error = ''; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | try { |
226 | 226 | $sth = $Connection->db->prepare($query); |
227 | 227 | $sth->execute(); |
228 | - } catch(PDOException $e) { |
|
228 | + } catch (PDOException $e) { |
|
229 | 229 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
230 | 230 | } |
231 | 231 | return $error; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | private static function update_from_6() { |
235 | 235 | $Connection = new Connection(); |
236 | - if (!$Connection->indexExists('spotter_output','flightaware_id')) { |
|
236 | + if (!$Connection->indexExists('spotter_output', 'flightaware_id')) { |
|
237 | 237 | $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id); |
238 | 238 | ALTER TABLE spotter_output ADD INDEX(date); |
239 | 239 | ALTER TABLE spotter_output ADD INDEX(ident); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | try { |
251 | 251 | $sth = $Connection->db->prepare($query); |
252 | 252 | $sth->execute(); |
253 | - } catch(PDOException $e) { |
|
253 | + } catch (PDOException $e) { |
|
254 | 254 | return "error (add some indexes) : ".$e->getMessage()."\n"; |
255 | 255 | } |
256 | 256 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | try { |
266 | 266 | $sth = $Connection->db->prepare($query); |
267 | 267 | $sth->execute(); |
268 | - } catch(PDOException $e) { |
|
268 | + } catch (PDOException $e) { |
|
269 | 269 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
270 | 270 | } |
271 | 271 | return $error; |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | private static function update_from_7() { |
275 | 275 | global $globalDBname, $globalDBdriver; |
276 | 276 | $Connection = new Connection(); |
277 | - $query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
277 | + $query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
278 | 278 | ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;"; |
279 | 279 | try { |
280 | 280 | $sth = $Connection->db->prepare($query); |
281 | 281 | $sth->execute(); |
282 | - } catch(PDOException $e) { |
|
282 | + } catch (PDOException $e) { |
|
283 | 283 | return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
284 | 284 | } |
285 | 285 | if ($globalDBdriver == 'mysql') { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | try { |
288 | 288 | $sth = $Connection->db->prepare($query); |
289 | 289 | $sth->execute(); |
290 | - } catch(PDOException $e) { |
|
290 | + } catch (PDOException $e) { |
|
291 | 291 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
292 | 292 | } |
293 | 293 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -299,15 +299,15 @@ discard block |
||
299 | 299 | DROP TABLE spotter_archive; |
300 | 300 | RENAME TABLE copy TO spotter_archive;"; |
301 | 301 | } else { |
302 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
302 | + $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
303 | 303 | } |
304 | 304 | } else { |
305 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
305 | + $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
306 | 306 | } |
307 | 307 | try { |
308 | 308 | $sth = $Connection->db->prepare($query); |
309 | 309 | $sth->execute(); |
310 | - } catch(PDOException $e) { |
|
310 | + } catch (PDOException $e) { |
|
311 | 311 | return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n"; |
312 | 312 | } |
313 | 313 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | try { |
321 | 321 | $sth = $Connection->db->prepare($query); |
322 | 322 | $sth->execute(); |
323 | - } catch(PDOException $e) { |
|
323 | + } catch (PDOException $e) { |
|
324 | 324 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
325 | 325 | } |
326 | 326 | return $error; |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | try { |
340 | 340 | $sth = $Connection->db->prepare($query); |
341 | 341 | $sth->execute(); |
342 | - } catch(PDOException $e) { |
|
342 | + } catch (PDOException $e) { |
|
343 | 343 | return "error (insert last_update values) : ".$e->getMessage()."\n"; |
344 | 344 | } |
345 | 345 | $query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'"; |
346 | 346 | try { |
347 | 347 | $sth = $Connection->db->prepare($query); |
348 | 348 | $sth->execute(); |
349 | - } catch(PDOException $e) { |
|
349 | + } catch (PDOException $e) { |
|
350 | 350 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
351 | 351 | } |
352 | 352 | return $error; |
@@ -354,12 +354,12 @@ discard block |
||
354 | 354 | |
355 | 355 | private static function update_from_9() { |
356 | 356 | $Connection = new Connection(); |
357 | - $query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
357 | + $query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
358 | 358 | ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;"; |
359 | 359 | try { |
360 | 360 | $sth = $Connection->db->prepare($query); |
361 | 361 | $sth->execute(); |
362 | - } catch(PDOException $e) { |
|
362 | + } catch (PDOException $e) { |
|
363 | 363 | return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
364 | 364 | } |
365 | 365 | $error = ''; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | try { |
372 | 372 | $sth = $Connection->db->prepare($query); |
373 | 373 | $sth->execute(); |
374 | - } catch(PDOException $e) { |
|
374 | + } catch (PDOException $e) { |
|
375 | 375 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
376 | 376 | } |
377 | 377 | return $error; |
@@ -379,11 +379,11 @@ discard block |
||
379 | 379 | |
380 | 380 | private static function update_from_10() { |
381 | 381 | $Connection = new Connection(); |
382 | - $query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
382 | + $query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
383 | 383 | try { |
384 | 384 | $sth = $Connection->db->prepare($query); |
385 | 385 | $sth->execute(); |
386 | - } catch(PDOException $e) { |
|
386 | + } catch (PDOException $e) { |
|
387 | 387 | return "error (add new enum to ATC table) : ".$e->getMessage()."\n"; |
388 | 388 | } |
389 | 389 | $error = ''; |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | try { |
402 | 402 | $sth = $Connection->db->prepare($query); |
403 | 403 | $sth->execute(); |
404 | - } catch(PDOException $e) { |
|
404 | + } catch (PDOException $e) { |
|
405 | 405 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
406 | 406 | } |
407 | 407 | return $error; |
@@ -410,18 +410,18 @@ discard block |
||
410 | 410 | private static function update_from_11() { |
411 | 411 | global $globalDBdriver, $globalDBname; |
412 | 412 | $Connection = new Connection(); |
413 | - $query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
413 | + $query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
414 | 414 | try { |
415 | 415 | $sth = $Connection->db->prepare($query); |
416 | 416 | $sth->execute(); |
417 | - } catch(PDOException $e) { |
|
417 | + } catch (PDOException $e) { |
|
418 | 418 | return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n"; |
419 | 419 | } |
420 | - $query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
420 | + $query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
421 | 421 | try { |
422 | 422 | $sth = $Connection->db->prepare($query); |
423 | 423 | $sth->execute(); |
424 | - } catch(PDOException $e) { |
|
424 | + } catch (PDOException $e) { |
|
425 | 425 | return "error (format_source column to spotter_live) : ".$e->getMessage()."\n"; |
426 | 426 | } |
427 | 427 | if ($globalDBdriver == 'mysql') { |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | try { |
430 | 430 | $sth = $Connection->db->prepare($query); |
431 | 431 | $sth->execute(); |
432 | - } catch(PDOException $e) { |
|
432 | + } catch (PDOException $e) { |
|
433 | 433 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
434 | 434 | } |
435 | 435 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -441,15 +441,15 @@ discard block |
||
441 | 441 | DROP TABLE spotter_archive; |
442 | 442 | RENAME TABLE copy TO spotter_archive;"; |
443 | 443 | } else { |
444 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
444 | + $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
445 | 445 | } |
446 | 446 | } else { |
447 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
447 | + $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
448 | 448 | } |
449 | 449 | try { |
450 | 450 | $sth = $Connection->db->prepare($query); |
451 | 451 | $sth->execute(); |
452 | - } catch(PDOException $e) { |
|
452 | + } catch (PDOException $e) { |
|
453 | 453 | return "error (add columns to spotter_archive) : ".$e->getMessage()."\n"; |
454 | 454 | } |
455 | 455 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | try { |
460 | 460 | $sth = $Connection->db->prepare($query); |
461 | 461 | $sth->execute(); |
462 | - } catch(PDOException $e) { |
|
462 | + } catch (PDOException $e) { |
|
463 | 463 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
464 | 464 | } |
465 | 465 | return $error; |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | try { |
488 | 488 | $sth = $Connection->db->prepare($query); |
489 | 489 | $sth->execute(); |
490 | - } catch(PDOException $e) { |
|
490 | + } catch (PDOException $e) { |
|
491 | 491 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
492 | 492 | } |
493 | 493 | return $error; |
@@ -495,12 +495,12 @@ discard block |
||
495 | 495 | |
496 | 496 | private static function update_from_13() { |
497 | 497 | $Connection = new Connection(); |
498 | - if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) { |
|
499 | - $query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
498 | + if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) { |
|
499 | + $query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
500 | 500 | try { |
501 | 501 | $sth = $Connection->db->prepare($query); |
502 | 502 | $sth->execute(); |
503 | - } catch(PDOException $e) { |
|
503 | + } catch (PDOException $e) { |
|
504 | 504 | return "error (update spotter_archive_output) : ".$e->getMessage()."\n"; |
505 | 505 | } |
506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | try { |
510 | 510 | $sth = $Connection->db->prepare($query); |
511 | 511 | $sth->execute(); |
512 | - } catch(PDOException $e) { |
|
512 | + } catch (PDOException $e) { |
|
513 | 513 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
514 | 514 | } |
515 | 515 | return $error; |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | try { |
528 | 528 | $sth = $Connection->db->prepare($query); |
529 | 529 | $sth->execute(); |
530 | - } catch(PDOException $e) { |
|
530 | + } catch (PDOException $e) { |
|
531 | 531 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
532 | 532 | } |
533 | 533 | return $error; |
@@ -538,11 +538,11 @@ discard block |
||
538 | 538 | $Connection = new Connection(); |
539 | 539 | $error = ''; |
540 | 540 | // Add tables |
541 | - $query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
541 | + $query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
542 | 542 | try { |
543 | 543 | $sth = $Connection->db->prepare($query); |
544 | 544 | $sth->execute(); |
545 | - } catch(PDOException $e) { |
|
545 | + } catch (PDOException $e) { |
|
546 | 546 | return "error (update stats) : ".$e->getMessage()."\n"; |
547 | 547 | } |
548 | 548 | if ($error != '') return $error; |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | try { |
551 | 551 | $sth = $Connection->db->prepare($query); |
552 | 552 | $sth->execute(); |
553 | - } catch(PDOException $e) { |
|
553 | + } catch (PDOException $e) { |
|
554 | 554 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
555 | 555 | } |
556 | 556 | return $error; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | try { |
572 | 572 | $sth = $Connection->db->prepare($query); |
573 | 573 | $sth->execute(); |
574 | - } catch(PDOException $e) { |
|
574 | + } catch (PDOException $e) { |
|
575 | 575 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
576 | 576 | } |
577 | 577 | return $error; |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | try { |
590 | 590 | $sth = $Connection->db->prepare($query); |
591 | 591 | $sth->execute(); |
592 | - } catch(PDOException $e) { |
|
592 | + } catch (PDOException $e) { |
|
593 | 593 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
594 | 594 | } |
595 | 595 | return $error; |
@@ -598,12 +598,12 @@ discard block |
||
598 | 598 | $Connection = new Connection(); |
599 | 599 | $error = ''; |
600 | 600 | // Modify stats_airport table |
601 | - if (!$Connection->checkColumnName('stats_airport','airport_name')) { |
|
601 | + if (!$Connection->checkColumnName('stats_airport', 'airport_name')) { |
|
602 | 602 | $query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)"; |
603 | 603 | try { |
604 | 604 | $sth = $Connection->db->prepare($query); |
605 | 605 | $sth->execute(); |
606 | - } catch(PDOException $e) { |
|
606 | + } catch (PDOException $e) { |
|
607 | 607 | return "error (update stats) : ".$e->getMessage()."\n"; |
608 | 608 | } |
609 | 609 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | try { |
613 | 613 | $sth = $Connection->db->prepare($query); |
614 | 614 | $sth->execute(); |
615 | - } catch(PDOException $e) { |
|
615 | + } catch (PDOException $e) { |
|
616 | 616 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
617 | 617 | } |
618 | 618 | return $error; |
@@ -629,73 +629,73 @@ discard block |
||
629 | 629 | try { |
630 | 630 | $sth = $Connection->db->prepare($query); |
631 | 631 | $sth->execute(); |
632 | - } catch(PDOException $e) { |
|
632 | + } catch (PDOException $e) { |
|
633 | 633 | return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n"; |
634 | 634 | } |
635 | 635 | $query = "alter table spotter_archive add spotter_archive_id INT(11)"; |
636 | 636 | try { |
637 | 637 | $sth = $Connection->db->prepare($query); |
638 | 638 | $sth->execute(); |
639 | - } catch(PDOException $e) { |
|
639 | + } catch (PDOException $e) { |
|
640 | 640 | return "error (add id again on spotter_archive) : ".$e->getMessage()."\n"; |
641 | 641 | } |
642 | - if (!$Connection->checkColumnName('spotter_archive','over_country')) { |
|
642 | + if (!$Connection->checkColumnName('spotter_archive', 'over_country')) { |
|
643 | 643 | // Add column over_country |
644 | 644 | $query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
645 | 645 | try { |
646 | 646 | $sth = $Connection->db->prepare($query); |
647 | 647 | $sth->execute(); |
648 | - } catch(PDOException $e) { |
|
648 | + } catch (PDOException $e) { |
|
649 | 649 | return "error (add over_country) : ".$e->getMessage()."\n"; |
650 | 650 | } |
651 | 651 | } |
652 | - if (!$Connection->checkColumnName('spotter_live','over_country')) { |
|
652 | + if (!$Connection->checkColumnName('spotter_live', 'over_country')) { |
|
653 | 653 | // Add column over_country |
654 | 654 | $query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
655 | 655 | try { |
656 | 656 | $sth = $Connection->db->prepare($query); |
657 | 657 | $sth->execute(); |
658 | - } catch(PDOException $e) { |
|
658 | + } catch (PDOException $e) { |
|
659 | 659 | return "error (add over_country) : ".$e->getMessage()."\n"; |
660 | 660 | } |
661 | 661 | } |
662 | - if (!$Connection->checkColumnName('spotter_output','source_name')) { |
|
662 | + if (!$Connection->checkColumnName('spotter_output', 'source_name')) { |
|
663 | 663 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
664 | 664 | $query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
665 | 665 | try { |
666 | 666 | $sth = $Connection->db->prepare($query); |
667 | 667 | $sth->execute(); |
668 | - } catch(PDOException $e) { |
|
668 | + } catch (PDOException $e) { |
|
669 | 669 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
670 | 670 | } |
671 | 671 | } |
672 | - if (!$Connection->checkColumnName('spotter_live','source_name')) { |
|
672 | + if (!$Connection->checkColumnName('spotter_live', 'source_name')) { |
|
673 | 673 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
674 | 674 | $query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
675 | 675 | try { |
676 | 676 | $sth = $Connection->db->prepare($query); |
677 | 677 | $sth->execute(); |
678 | - } catch(PDOException $e) { |
|
678 | + } catch (PDOException $e) { |
|
679 | 679 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
680 | 680 | } |
681 | 681 | } |
682 | - if (!$Connection->checkColumnName('spotter_archive_output','source_name')) { |
|
682 | + if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) { |
|
683 | 683 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
684 | 684 | $query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
685 | 685 | try { |
686 | 686 | $sth = $Connection->db->prepare($query); |
687 | 687 | $sth->execute(); |
688 | - } catch(PDOException $e) { |
|
688 | + } catch (PDOException $e) { |
|
689 | 689 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
690 | 690 | } |
691 | 691 | } |
692 | - if (!$Connection->checkColumnName('spotter_archive','source_name')) { |
|
692 | + if (!$Connection->checkColumnName('spotter_archive', 'source_name')) { |
|
693 | 693 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
694 | 694 | $query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;"; |
695 | 695 | try { |
696 | 696 | $sth = $Connection->db->prepare($query); |
697 | 697 | $sth->execute(); |
698 | - } catch(PDOException $e) { |
|
698 | + } catch (PDOException $e) { |
|
699 | 699 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
700 | 700 | } |
701 | 701 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | try { |
705 | 705 | $sth = $Connection->db->prepare($query); |
706 | 706 | $sth->execute(); |
707 | - } catch(PDOException $e) { |
|
707 | + } catch (PDOException $e) { |
|
708 | 708 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
709 | 709 | } |
710 | 710 | return $error; |
@@ -719,13 +719,13 @@ discard block |
||
719 | 719 | $error .= create_db::import_file('../db/airlines.sql'); |
720 | 720 | if ($error != '') return 'Import airlines.sql : '.$error; |
721 | 721 | } |
722 | - if (!$Connection->checkColumnName('aircraft_modes','type_flight')) { |
|
722 | + if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) { |
|
723 | 723 | // Add column over_country |
724 | 724 | $query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;"; |
725 | 725 | try { |
726 | 726 | $sth = $Connection->db->prepare($query); |
727 | 727 | $sth->execute(); |
728 | - } catch(PDOException $e) { |
|
728 | + } catch (PDOException $e) { |
|
729 | 729 | return "error (add over_country) : ".$e->getMessage()."\n"; |
730 | 730 | } |
731 | 731 | } |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | try { |
742 | 742 | $sth = $Connection->db->prepare($query); |
743 | 743 | $sth->execute(); |
744 | - } catch(PDOException $e) { |
|
744 | + } catch (PDOException $e) { |
|
745 | 745 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
746 | 746 | } |
747 | 747 | return $error; |
@@ -750,13 +750,13 @@ discard block |
||
750 | 750 | private static function update_from_21() { |
751 | 751 | $Connection = new Connection(); |
752 | 752 | $error = ''; |
753 | - if (!$Connection->checkColumnName('stats_airport','stats_type')) { |
|
753 | + if (!$Connection->checkColumnName('stats_airport', 'stats_type')) { |
|
754 | 754 | // Rename type to stats_type |
755 | 755 | $query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);"; |
756 | 756 | try { |
757 | 757 | $sth = $Connection->db->prepare($query); |
758 | 758 | $sth->execute(); |
759 | - } catch(PDOException $e) { |
|
759 | + } catch (PDOException $e) { |
|
760 | 760 | return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n"; |
761 | 761 | } |
762 | 762 | if ($error != '') return $error; |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | try { |
766 | 766 | $sth = $Connection->db->prepare($query); |
767 | 767 | $sth->execute(); |
768 | - } catch(PDOException $e) { |
|
768 | + } catch (PDOException $e) { |
|
769 | 769 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
770 | 770 | } |
771 | 771 | return $error; |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | try { |
789 | 789 | $sth = $Connection->db->prepare($query); |
790 | 790 | $sth->execute(); |
791 | - } catch(PDOException $e) { |
|
791 | + } catch (PDOException $e) { |
|
792 | 792 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
793 | 793 | } |
794 | 794 | return $error; |
@@ -814,17 +814,17 @@ discard block |
||
814 | 814 | try { |
815 | 815 | $sth = $Connection->db->prepare($query); |
816 | 816 | $sth->execute(); |
817 | - } catch(PDOException $e) { |
|
817 | + } catch (PDOException $e) { |
|
818 | 818 | return "error (create index on spotter_archive) : ".$e->getMessage()."\n"; |
819 | 819 | } |
820 | 820 | } |
821 | - if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) { |
|
821 | + if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) { |
|
822 | 822 | // Add aircraft_manufacturer to stats_aircraft |
823 | 823 | $query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL"; |
824 | 824 | try { |
825 | 825 | $sth = $Connection->db->prepare($query); |
826 | 826 | $sth->execute(); |
827 | - } catch(PDOException $e) { |
|
827 | + } catch (PDOException $e) { |
|
828 | 828 | return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n"; |
829 | 829 | } |
830 | 830 | } |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | try { |
834 | 834 | $sth = $Connection->db->prepare($query); |
835 | 835 | $sth->execute(); |
836 | - } catch(PDOException $e) { |
|
836 | + } catch (PDOException $e) { |
|
837 | 837 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
838 | 838 | } |
839 | 839 | return $error; |
@@ -849,23 +849,23 @@ discard block |
||
849 | 849 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
850 | 850 | } |
851 | 851 | if ($error != '') return 'Import airlines.sql : '.$error; |
852 | - if (!$Connection->checkColumnName('airlines','forsource')) { |
|
852 | + if (!$Connection->checkColumnName('airlines', 'forsource')) { |
|
853 | 853 | // Add forsource to airlines |
854 | 854 | $query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL"; |
855 | 855 | try { |
856 | 856 | $sth = $Connection->db->prepare($query); |
857 | 857 | $sth->execute(); |
858 | - } catch(PDOException $e) { |
|
858 | + } catch (PDOException $e) { |
|
859 | 859 | return "error (add forsource column) : ".$e->getMessage()."\n"; |
860 | 860 | } |
861 | 861 | } |
862 | - if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) { |
|
862 | + if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) { |
|
863 | 863 | // Add forsource to airlines |
864 | 864 | $query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
865 | 865 | try { |
866 | 866 | $sth = $Connection->db->prepare($query); |
867 | 867 | $sth->execute(); |
868 | - } catch(PDOException $e) { |
|
868 | + } catch (PDOException $e) { |
|
869 | 869 | return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n"; |
870 | 870 | } |
871 | 871 | // Add unique key |
@@ -877,17 +877,17 @@ discard block |
||
877 | 877 | try { |
878 | 878 | $sth = $Connection->db->prepare($query); |
879 | 879 | $sth->execute(); |
880 | - } catch(PDOException $e) { |
|
880 | + } catch (PDOException $e) { |
|
881 | 881 | return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n"; |
882 | 882 | } |
883 | 883 | } |
884 | - if (!$Connection->checkColumnName('stats_airport','stats_airline')) { |
|
884 | + if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) { |
|
885 | 885 | // Add forsource to airlines |
886 | 886 | $query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
887 | 887 | try { |
888 | 888 | $sth = $Connection->db->prepare($query); |
889 | 889 | $sth->execute(); |
890 | - } catch(PDOException $e) { |
|
890 | + } catch (PDOException $e) { |
|
891 | 891 | return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n"; |
892 | 892 | } |
893 | 893 | // Add unique key |
@@ -899,17 +899,17 @@ discard block |
||
899 | 899 | try { |
900 | 900 | $sth = $Connection->db->prepare($query); |
901 | 901 | $sth->execute(); |
902 | - } catch(PDOException $e) { |
|
902 | + } catch (PDOException $e) { |
|
903 | 903 | return "error (add unique key in stats_airport) : ".$e->getMessage()."\n"; |
904 | 904 | } |
905 | 905 | } |
906 | - if (!$Connection->checkColumnName('stats_country','stats_airline')) { |
|
906 | + if (!$Connection->checkColumnName('stats_country', 'stats_airline')) { |
|
907 | 907 | // Add forsource to airlines |
908 | 908 | $query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
909 | 909 | try { |
910 | 910 | $sth = $Connection->db->prepare($query); |
911 | 911 | $sth->execute(); |
912 | - } catch(PDOException $e) { |
|
912 | + } catch (PDOException $e) { |
|
913 | 913 | return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n"; |
914 | 914 | } |
915 | 915 | // Add unique key |
@@ -921,36 +921,36 @@ discard block |
||
921 | 921 | try { |
922 | 922 | $sth = $Connection->db->prepare($query); |
923 | 923 | $sth->execute(); |
924 | - } catch(PDOException $e) { |
|
924 | + } catch (PDOException $e) { |
|
925 | 925 | return "error (add unique key in stats_airline) : ".$e->getMessage()."\n"; |
926 | 926 | } |
927 | 927 | } |
928 | - if (!$Connection->checkColumnName('stats_flight','stats_airline')) { |
|
928 | + if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) { |
|
929 | 929 | // Add forsource to airlines |
930 | 930 | $query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
931 | 931 | try { |
932 | 932 | $sth = $Connection->db->prepare($query); |
933 | 933 | $sth->execute(); |
934 | - } catch(PDOException $e) { |
|
934 | + } catch (PDOException $e) { |
|
935 | 935 | return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n"; |
936 | 936 | } |
937 | 937 | } |
938 | - if (!$Connection->checkColumnName('stats','stats_airline')) { |
|
938 | + if (!$Connection->checkColumnName('stats', 'stats_airline')) { |
|
939 | 939 | // Add forsource to airlines |
940 | 940 | $query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
941 | 941 | try { |
942 | 942 | $sth = $Connection->db->prepare($query); |
943 | 943 | $sth->execute(); |
944 | - } catch(PDOException $e) { |
|
944 | + } catch (PDOException $e) { |
|
945 | 945 | return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n"; |
946 | 946 | } |
947 | - if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) { |
|
947 | + if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) { |
|
948 | 948 | // Add unique key |
949 | 949 | $query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);"; |
950 | 950 | try { |
951 | 951 | $sth = $Connection->db->prepare($query); |
952 | 952 | $sth->execute(); |
953 | - } catch(PDOException $e) { |
|
953 | + } catch (PDOException $e) { |
|
954 | 954 | return "error (add unique key in stats) : ".$e->getMessage()."\n"; |
955 | 955 | } |
956 | 956 | } else { |
@@ -963,18 +963,18 @@ discard block |
||
963 | 963 | try { |
964 | 964 | $sth = $Connection->db->prepare($query); |
965 | 965 | $sth->execute(); |
966 | - } catch(PDOException $e) { |
|
966 | + } catch (PDOException $e) { |
|
967 | 967 | return "error (add unique key in stats) : ".$e->getMessage()."\n"; |
968 | 968 | } |
969 | 969 | } |
970 | 970 | } |
971 | - if (!$Connection->checkColumnName('stats_registration','stats_airline')) { |
|
971 | + if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) { |
|
972 | 972 | // Add forsource to airlines |
973 | 973 | $query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
974 | 974 | try { |
975 | 975 | $sth = $Connection->db->prepare($query); |
976 | 976 | $sth->execute(); |
977 | - } catch(PDOException $e) { |
|
977 | + } catch (PDOException $e) { |
|
978 | 978 | return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n"; |
979 | 979 | } |
980 | 980 | // Add unique key |
@@ -986,17 +986,17 @@ discard block |
||
986 | 986 | try { |
987 | 987 | $sth = $Connection->db->prepare($query); |
988 | 988 | $sth->execute(); |
989 | - } catch(PDOException $e) { |
|
989 | + } catch (PDOException $e) { |
|
990 | 990 | return "error (add unique key in stats_registration) : ".$e->getMessage()."\n"; |
991 | 991 | } |
992 | 992 | } |
993 | - if (!$Connection->checkColumnName('stats_callsign','filter_name')) { |
|
993 | + if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) { |
|
994 | 994 | // Add forsource to airlines |
995 | 995 | $query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
996 | 996 | try { |
997 | 997 | $sth = $Connection->db->prepare($query); |
998 | 998 | $sth->execute(); |
999 | - } catch(PDOException $e) { |
|
999 | + } catch (PDOException $e) { |
|
1000 | 1000 | return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n"; |
1001 | 1001 | } |
1002 | 1002 | // Add unique key |
@@ -1008,17 +1008,17 @@ discard block |
||
1008 | 1008 | try { |
1009 | 1009 | $sth = $Connection->db->prepare($query); |
1010 | 1010 | $sth->execute(); |
1011 | - } catch(PDOException $e) { |
|
1011 | + } catch (PDOException $e) { |
|
1012 | 1012 | return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n"; |
1013 | 1013 | } |
1014 | 1014 | } |
1015 | - if (!$Connection->checkColumnName('stats_airline','filter_name')) { |
|
1015 | + if (!$Connection->checkColumnName('stats_airline', 'filter_name')) { |
|
1016 | 1016 | // Add forsource to airlines |
1017 | 1017 | $query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
1018 | 1018 | try { |
1019 | 1019 | $sth = $Connection->db->prepare($query); |
1020 | 1020 | $sth->execute(); |
1021 | - } catch(PDOException $e) { |
|
1021 | + } catch (PDOException $e) { |
|
1022 | 1022 | return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n"; |
1023 | 1023 | } |
1024 | 1024 | // Add unique key |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | try { |
1031 | 1031 | $sth = $Connection->db->prepare($query); |
1032 | 1032 | $sth->execute(); |
1033 | - } catch(PDOException $e) { |
|
1033 | + } catch (PDOException $e) { |
|
1034 | 1034 | return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n"; |
1035 | 1035 | } |
1036 | 1036 | } |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | try { |
1040 | 1040 | $sth = $Connection->db->prepare($query); |
1041 | 1041 | $sth->execute(); |
1042 | - } catch(PDOException $e) { |
|
1042 | + } catch (PDOException $e) { |
|
1043 | 1043 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1044 | 1044 | } |
1045 | 1045 | return $error; |
@@ -1049,13 +1049,13 @@ discard block |
||
1049 | 1049 | global $globalDBdriver; |
1050 | 1050 | $Connection = new Connection(); |
1051 | 1051 | $error = ''; |
1052 | - if (!$Connection->checkColumnName('stats_owner','stats_airline')) { |
|
1052 | + if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) { |
|
1053 | 1053 | // Add forsource to airlines |
1054 | 1054 | $query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
1055 | 1055 | try { |
1056 | 1056 | $sth = $Connection->db->prepare($query); |
1057 | 1057 | $sth->execute(); |
1058 | - } catch(PDOException $e) { |
|
1058 | + } catch (PDOException $e) { |
|
1059 | 1059 | return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n"; |
1060 | 1060 | } |
1061 | 1061 | // Add unique key |
@@ -1067,17 +1067,17 @@ discard block |
||
1067 | 1067 | try { |
1068 | 1068 | $sth = $Connection->db->prepare($query); |
1069 | 1069 | $sth->execute(); |
1070 | - } catch(PDOException $e) { |
|
1070 | + } catch (PDOException $e) { |
|
1071 | 1071 | return "error (add unique key in stats_owner) : ".$e->getMessage()."\n"; |
1072 | 1072 | } |
1073 | 1073 | } |
1074 | - if (!$Connection->checkColumnName('stats_pilot','stats_airline')) { |
|
1074 | + if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) { |
|
1075 | 1075 | // Add forsource to airlines |
1076 | 1076 | $query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
1077 | 1077 | try { |
1078 | 1078 | $sth = $Connection->db->prepare($query); |
1079 | 1079 | $sth->execute(); |
1080 | - } catch(PDOException $e) { |
|
1080 | + } catch (PDOException $e) { |
|
1081 | 1081 | return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n"; |
1082 | 1082 | } |
1083 | 1083 | // Add unique key |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | try { |
1090 | 1090 | $sth = $Connection->db->prepare($query); |
1091 | 1091 | $sth->execute(); |
1092 | - } catch(PDOException $e) { |
|
1092 | + } catch (PDOException $e) { |
|
1093 | 1093 | return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n"; |
1094 | 1094 | } |
1095 | 1095 | } |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | try { |
1098 | 1098 | $sth = $Connection->db->prepare($query); |
1099 | 1099 | $sth->execute(); |
1100 | - } catch(PDOException $e) { |
|
1100 | + } catch (PDOException $e) { |
|
1101 | 1101 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1102 | 1102 | } |
1103 | 1103 | return $error; |
@@ -1107,12 +1107,12 @@ discard block |
||
1107 | 1107 | global $globalDBdriver; |
1108 | 1108 | $Connection = new Connection(); |
1109 | 1109 | $error = ''; |
1110 | - if (!$Connection->checkColumnName('atc','format_source')) { |
|
1110 | + if (!$Connection->checkColumnName('atc', 'format_source')) { |
|
1111 | 1111 | $query = "ALTER TABLE atc ADD format_source VARCHAR(255) DEFAULT NULL, ADD source_name VARCHAR(255) DEFAULT NULL"; |
1112 | 1112 | try { |
1113 | 1113 | $sth = $Connection->db->prepare($query); |
1114 | 1114 | $sth->execute(); |
1115 | - } catch(PDOException $e) { |
|
1115 | + } catch (PDOException $e) { |
|
1116 | 1116 | return "error (add format_source & source_name column in atc) : ".$e->getMessage()."\n"; |
1117 | 1117 | } |
1118 | 1118 | } |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | try { |
1121 | 1121 | $sth = $Connection->db->prepare($query); |
1122 | 1122 | $sth->execute(); |
1123 | - } catch(PDOException $e) { |
|
1123 | + } catch (PDOException $e) { |
|
1124 | 1124 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1125 | 1125 | } |
1126 | 1126 | return $error; |
@@ -1130,13 +1130,13 @@ discard block |
||
1130 | 1130 | global $globalDBdriver; |
1131 | 1131 | $Connection = new Connection(); |
1132 | 1132 | $error = ''; |
1133 | - if (!$Connection->checkColumnName('stats_pilot','format_source')) { |
|
1133 | + if (!$Connection->checkColumnName('stats_pilot', 'format_source')) { |
|
1134 | 1134 | // Add forsource to airlines |
1135 | 1135 | $query = "ALTER TABLE stats_pilot ADD format_source VARCHAR(255) NULL DEFAULT ''"; |
1136 | 1136 | try { |
1137 | 1137 | $sth = $Connection->db->prepare($query); |
1138 | 1138 | $sth->execute(); |
1139 | - } catch(PDOException $e) { |
|
1139 | + } catch (PDOException $e) { |
|
1140 | 1140 | return "error (add format_source column in stats_pilot) : ".$e->getMessage()."\n"; |
1141 | 1141 | } |
1142 | 1142 | // Add unique key |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | try { |
1149 | 1149 | $sth = $Connection->db->prepare($query); |
1150 | 1150 | $sth->execute(); |
1151 | - } catch(PDOException $e) { |
|
1151 | + } catch (PDOException $e) { |
|
1152 | 1152 | return "error (modify unique key in stats_pilot) : ".$e->getMessage()."\n"; |
1153 | 1153 | } |
1154 | 1154 | } |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | try { |
1157 | 1157 | $sth = $Connection->db->prepare($query); |
1158 | 1158 | $sth->execute(); |
1159 | - } catch(PDOException $e) { |
|
1159 | + } catch (PDOException $e) { |
|
1160 | 1160 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1161 | 1161 | } |
1162 | 1162 | return $error; |
@@ -1166,23 +1166,23 @@ discard block |
||
1166 | 1166 | global $globalDBdriver; |
1167 | 1167 | $Connection = new Connection(); |
1168 | 1168 | $error = ''; |
1169 | - if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live','latitude')) { |
|
1169 | + if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live', 'latitude')) { |
|
1170 | 1170 | // Add unique key |
1171 | 1171 | $query = "alter table spotter_live add index(latitude,longitude)"; |
1172 | 1172 | try { |
1173 | 1173 | $sth = $Connection->db->prepare($query); |
1174 | 1174 | $sth->execute(); |
1175 | - } catch(PDOException $e) { |
|
1175 | + } catch (PDOException $e) { |
|
1176 | 1176 | return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n"; |
1177 | 1177 | } |
1178 | 1178 | } |
1179 | - if (!$Connection->checkColumnName('aircraft','mfr')) { |
|
1179 | + if (!$Connection->checkColumnName('aircraft', 'mfr')) { |
|
1180 | 1180 | // Add mfr to aircraft |
1181 | 1181 | $query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL"; |
1182 | 1182 | try { |
1183 | 1183 | $sth = $Connection->db->prepare($query); |
1184 | 1184 | $sth->execute(); |
1185 | - } catch(PDOException $e) { |
|
1185 | + } catch (PDOException $e) { |
|
1186 | 1186 | return "error (add mfr column in aircraft) : ".$e->getMessage()."\n"; |
1187 | 1187 | } |
1188 | 1188 | } |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | try { |
1199 | 1199 | $sth = $Connection->db->prepare($query); |
1200 | 1200 | $sth->execute(); |
1201 | - } catch(PDOException $e) { |
|
1201 | + } catch (PDOException $e) { |
|
1202 | 1202 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1203 | 1203 | } |
1204 | 1204 | return $error; |
@@ -1208,13 +1208,13 @@ discard block |
||
1208 | 1208 | global $globalDBdriver; |
1209 | 1209 | $Connection = new Connection(); |
1210 | 1210 | $error = ''; |
1211 | - if ($Connection->checkColumnName('aircraft','mfr')) { |
|
1211 | + if ($Connection->checkColumnName('aircraft', 'mfr')) { |
|
1212 | 1212 | // drop mfr to aircraft |
1213 | 1213 | $query = "ALTER TABLE aircraft DROP COLUMN mfr"; |
1214 | 1214 | try { |
1215 | 1215 | $sth = $Connection->db->prepare($query); |
1216 | 1216 | $sth->execute(); |
1217 | - } catch(PDOException $e) { |
|
1217 | + } catch (PDOException $e) { |
|
1218 | 1218 | return "error (drop mfr column in aircraft) : ".$e->getMessage()."\n"; |
1219 | 1219 | } |
1220 | 1220 | } |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | try { |
1231 | 1231 | $sth = $Connection->db->prepare($query); |
1232 | 1232 | $sth->execute(); |
1233 | - } catch(PDOException $e) { |
|
1233 | + } catch (PDOException $e) { |
|
1234 | 1234 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1235 | 1235 | } |
1236 | 1236 | return $error; |
@@ -1240,33 +1240,33 @@ discard block |
||
1240 | 1240 | global $globalDBdriver; |
1241 | 1241 | $Connection = new Connection(); |
1242 | 1242 | $error = ''; |
1243 | - if (!$Connection->indexExists('notam','ref_idx')) { |
|
1243 | + if (!$Connection->indexExists('notam', 'ref_idx')) { |
|
1244 | 1244 | // Add index key |
1245 | 1245 | $query = "create index ref_idx on notam (ref)"; |
1246 | 1246 | try { |
1247 | 1247 | $sth = $Connection->db->prepare($query); |
1248 | 1248 | $sth->execute(); |
1249 | - } catch(PDOException $e) { |
|
1249 | + } catch (PDOException $e) { |
|
1250 | 1250 | return "error (add index ref on notam) : ".$e->getMessage()."\n"; |
1251 | 1251 | } |
1252 | 1252 | } |
1253 | - if (!$Connection->indexExists('accidents','registration_idx')) { |
|
1253 | + if (!$Connection->indexExists('accidents', 'registration_idx')) { |
|
1254 | 1254 | // Add index key |
1255 | 1255 | $query = "create index registration_idx on accidents (registration)"; |
1256 | 1256 | try { |
1257 | 1257 | $sth = $Connection->db->prepare($query); |
1258 | 1258 | $sth->execute(); |
1259 | - } catch(PDOException $e) { |
|
1259 | + } catch (PDOException $e) { |
|
1260 | 1260 | return "error (add index registration on accidents) : ".$e->getMessage()."\n"; |
1261 | 1261 | } |
1262 | 1262 | } |
1263 | - if (!$Connection->indexExists('accidents','rdts')) { |
|
1263 | + if (!$Connection->indexExists('accidents', 'rdts')) { |
|
1264 | 1264 | // Add index key |
1265 | 1265 | $query = "create index rdts on accidents (registration,date,type,source)"; |
1266 | 1266 | try { |
1267 | 1267 | $sth = $Connection->db->prepare($query); |
1268 | 1268 | $sth->execute(); |
1269 | - } catch(PDOException $e) { |
|
1269 | + } catch (PDOException $e) { |
|
1270 | 1270 | return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n"; |
1271 | 1271 | } |
1272 | 1272 | } |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | try { |
1276 | 1276 | $sth = $Connection->db->prepare($query); |
1277 | 1277 | $sth->execute(); |
1278 | - } catch(PDOException $e) { |
|
1278 | + } catch (PDOException $e) { |
|
1279 | 1279 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1280 | 1280 | } |
1281 | 1281 | return $error; |
@@ -1285,23 +1285,23 @@ discard block |
||
1285 | 1285 | global $globalDBdriver; |
1286 | 1286 | $Connection = new Connection(); |
1287 | 1287 | $error = ''; |
1288 | - if (!$Connection->checkColumnName('accidents','airline_name')) { |
|
1288 | + if (!$Connection->checkColumnName('accidents', 'airline_name')) { |
|
1289 | 1289 | // Add airline_name to accidents |
1290 | 1290 | $query = "ALTER TABLE accidents ADD airline_name VARCHAR(255) NULL"; |
1291 | 1291 | try { |
1292 | 1292 | $sth = $Connection->db->prepare($query); |
1293 | 1293 | $sth->execute(); |
1294 | - } catch(PDOException $e) { |
|
1294 | + } catch (PDOException $e) { |
|
1295 | 1295 | return "error (add airline_name column in accidents) : ".$e->getMessage()."\n"; |
1296 | 1296 | } |
1297 | 1297 | } |
1298 | - if (!$Connection->checkColumnName('accidents','airline_icao')) { |
|
1298 | + if (!$Connection->checkColumnName('accidents', 'airline_icao')) { |
|
1299 | 1299 | // Add airline_icao to accidents |
1300 | 1300 | $query = "ALTER TABLE accidents ADD airline_icao VARCHAR(10) NULL"; |
1301 | 1301 | try { |
1302 | 1302 | $sth = $Connection->db->prepare($query); |
1303 | 1303 | $sth->execute(); |
1304 | - } catch(PDOException $e) { |
|
1304 | + } catch (PDOException $e) { |
|
1305 | 1305 | return "error (add airline_icao column in accidents) : ".$e->getMessage()."\n"; |
1306 | 1306 | } |
1307 | 1307 | } |
@@ -1309,7 +1309,7 @@ discard block |
||
1309 | 1309 | try { |
1310 | 1310 | $sth = $Connection->db->prepare($query); |
1311 | 1311 | $sth->execute(); |
1312 | - } catch(PDOException $e) { |
|
1312 | + } catch (PDOException $e) { |
|
1313 | 1313 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1314 | 1314 | } |
1315 | 1315 | return $error; |
@@ -1319,13 +1319,13 @@ discard block |
||
1319 | 1319 | global $globalDBdriver, $globalVATSIM, $globalIVAO; |
1320 | 1320 | $Connection = new Connection(); |
1321 | 1321 | $error = ''; |
1322 | - if (!$Connection->checkColumnName('airlines','alliance')) { |
|
1322 | + if (!$Connection->checkColumnName('airlines', 'alliance')) { |
|
1323 | 1323 | // Add alliance to airlines |
1324 | 1324 | $query = "ALTER TABLE airlines ADD alliance VARCHAR(255) NULL"; |
1325 | 1325 | try { |
1326 | 1326 | $sth = $Connection->db->prepare($query); |
1327 | 1327 | $sth->execute(); |
1328 | - } catch(PDOException $e) { |
|
1328 | + } catch (PDOException $e) { |
|
1329 | 1329 | return "error (add alliance column in airlines) : ".$e->getMessage()."\n"; |
1330 | 1330 | } |
1331 | 1331 | } |
@@ -1352,7 +1352,7 @@ discard block |
||
1352 | 1352 | try { |
1353 | 1353 | $sth = $Connection->db->prepare($query); |
1354 | 1354 | $sth->execute(); |
1355 | - } catch(PDOException $e) { |
|
1355 | + } catch (PDOException $e) { |
|
1356 | 1356 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1357 | 1357 | } |
1358 | 1358 | return $error; |
@@ -1362,13 +1362,13 @@ discard block |
||
1362 | 1362 | global $globalDBdriver, $globalVATSIM, $globalIVAO; |
1363 | 1363 | $Connection = new Connection(); |
1364 | 1364 | $error = ''; |
1365 | - if (!$Connection->checkColumnName('airlines','ban_eu')) { |
|
1365 | + if (!$Connection->checkColumnName('airlines', 'ban_eu')) { |
|
1366 | 1366 | // Add ban_eu to airlines |
1367 | 1367 | $query = "ALTER TABLE airlines ADD ban_eu INTEGER NOT NULL DEFAULT '0'"; |
1368 | 1368 | try { |
1369 | 1369 | $sth = $Connection->db->prepare($query); |
1370 | 1370 | $sth->execute(); |
1371 | - } catch(PDOException $e) { |
|
1371 | + } catch (PDOException $e) { |
|
1372 | 1372 | return "error (add ban_eu column in airlines) : ".$e->getMessage()."\n"; |
1373 | 1373 | } |
1374 | 1374 | } |
@@ -1376,7 +1376,7 @@ discard block |
||
1376 | 1376 | try { |
1377 | 1377 | $sth = $Connection->db->prepare($query); |
1378 | 1378 | $sth->execute(); |
1379 | - } catch(PDOException $e) { |
|
1379 | + } catch (PDOException $e) { |
|
1380 | 1380 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1381 | 1381 | } |
1382 | 1382 | return $error; |
@@ -1387,19 +1387,19 @@ discard block |
||
1387 | 1387 | $Connection = new Connection(); |
1388 | 1388 | $error = ''; |
1389 | 1389 | if ($globalDBdriver == 'mysql') { |
1390 | - if ($Connection->getColumnType('spotter_output','date') == 'TIMESTAMP' && $Connection->getColumnType('spotter_output','last_seen') != 'TIMESTAMP') { |
|
1390 | + if ($Connection->getColumnType('spotter_output', 'date') == 'TIMESTAMP' && $Connection->getColumnType('spotter_output', 'last_seen') != 'TIMESTAMP') { |
|
1391 | 1391 | $query = "ALTER TABLE spotter_output CHANGE date date TIMESTAMP NULL DEFAULT NULL"; |
1392 | 1392 | try { |
1393 | 1393 | $sth = $Connection->db->prepare($query); |
1394 | 1394 | $sth->execute(); |
1395 | - } catch(PDOException $e) { |
|
1395 | + } catch (PDOException $e) { |
|
1396 | 1396 | return "error (delete default timestamp spotter_output) : ".$e->getMessage()."\n"; |
1397 | 1397 | } |
1398 | 1398 | $query = "ALTER TABLE spotter_output MODIFY COLUMN last_seen timestamp not null default current_timestamp()"; |
1399 | 1399 | try { |
1400 | 1400 | $sth = $Connection->db->prepare($query); |
1401 | 1401 | $sth->execute(); |
1402 | - } catch(PDOException $e) { |
|
1402 | + } catch (PDOException $e) { |
|
1403 | 1403 | return "error (convert spotter_output last_seen to timestamp) : ".$e->getMessage()."\n"; |
1404 | 1404 | } |
1405 | 1405 | |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | try { |
1408 | 1408 | $sth = $Connection->db->prepare($query); |
1409 | 1409 | $sth->execute(); |
1410 | - } catch(PDOException $e) { |
|
1410 | + } catch (PDOException $e) { |
|
1411 | 1411 | return "error (delete default timestamp spotter_output) : ".$e->getMessage()."\n"; |
1412 | 1412 | } |
1413 | 1413 | /*$query = "SELECT date,last_seen FROM spotter_output WHERE last_seen < date ORDER BY date DESC LIMIT 150"; |
@@ -1458,7 +1458,7 @@ discard block |
||
1458 | 1458 | try { |
1459 | 1459 | $sth = $Connection->db->prepare($query); |
1460 | 1460 | $sth->execute(); |
1461 | - } catch(PDOException $e) { |
|
1461 | + } catch (PDOException $e) { |
|
1462 | 1462 | return "error (fix date) : ".$e->getMessage()."\n"; |
1463 | 1463 | } |
1464 | 1464 | } |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | try { |
1544 | 1544 | $sth = $Connection->db->prepare($query); |
1545 | 1545 | $sth->execute(); |
1546 | - } catch(PDOException $e) { |
|
1546 | + } catch (PDOException $e) { |
|
1547 | 1547 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1548 | 1548 | } |
1549 | 1549 | return $error; |
@@ -1552,13 +1552,13 @@ discard block |
||
1552 | 1552 | global $globalDBdriver; |
1553 | 1553 | $Connection = new Connection(); |
1554 | 1554 | $error = ''; |
1555 | - if (!$Connection->indexExists('accidents','type')) { |
|
1555 | + if (!$Connection->indexExists('accidents', 'type')) { |
|
1556 | 1556 | // Add index key |
1557 | 1557 | $query = "create index type on accidents (type,date)"; |
1558 | 1558 | try { |
1559 | 1559 | $sth = $Connection->db->prepare($query); |
1560 | 1560 | $sth->execute(); |
1561 | - } catch(PDOException $e) { |
|
1561 | + } catch (PDOException $e) { |
|
1562 | 1562 | return "error (add index type on accidents) : ".$e->getMessage()."\n"; |
1563 | 1563 | } |
1564 | 1564 | } |
@@ -1566,7 +1566,7 @@ discard block |
||
1566 | 1566 | try { |
1567 | 1567 | $sth = $Connection->db->prepare($query); |
1568 | 1568 | $sth->execute(); |
1569 | - } catch(PDOException $e) { |
|
1569 | + } catch (PDOException $e) { |
|
1570 | 1570 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1571 | 1571 | } |
1572 | 1572 | return $error; |
@@ -1576,12 +1576,12 @@ discard block |
||
1576 | 1576 | global $globalDBdriver; |
1577 | 1577 | $Connection = new Connection(); |
1578 | 1578 | $error = ''; |
1579 | - if (!$Connection->checkColumnName('aircraft_modes','source_type')) { |
|
1579 | + if (!$Connection->checkColumnName('aircraft_modes', 'source_type')) { |
|
1580 | 1580 | $query = "ALTER TABLE aircraft_modes ADD source_type VARCHAR(255) DEFAULT 'modes'"; |
1581 | 1581 | try { |
1582 | 1582 | $sth = $Connection->db->prepare($query); |
1583 | 1583 | $sth->execute(); |
1584 | - } catch(PDOException $e) { |
|
1584 | + } catch (PDOException $e) { |
|
1585 | 1585 | return "error (add source_type column in aircraft_modes) : ".$e->getMessage()."\n"; |
1586 | 1586 | } |
1587 | 1587 | } |
@@ -1647,7 +1647,7 @@ discard block |
||
1647 | 1647 | try { |
1648 | 1648 | $sth = $Connection->db->prepare($query); |
1649 | 1649 | $sth->execute(); |
1650 | - } catch(PDOException $e) { |
|
1650 | + } catch (PDOException $e) { |
|
1651 | 1651 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1652 | 1652 | } |
1653 | 1653 | return $error; |
@@ -1699,7 +1699,7 @@ discard block |
||
1699 | 1699 | try { |
1700 | 1700 | $sth = $Connection->db->prepare($query); |
1701 | 1701 | $sth->execute(); |
1702 | - } catch(PDOException $e) { |
|
1702 | + } catch (PDOException $e) { |
|
1703 | 1703 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
1704 | 1704 | } |
1705 | 1705 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -1708,18 +1708,18 @@ discard block |
||
1708 | 1708 | try { |
1709 | 1709 | $sth = $Connection->db->prepare($query); |
1710 | 1710 | $sth->execute(); |
1711 | - } catch(PDOException $e) { |
|
1711 | + } catch (PDOException $e) { |
|
1712 | 1712 | return "error (Change table format from archive to InnoDB for spotter_archive) : ".$e->getMessage()."\n"; |
1713 | 1713 | } |
1714 | 1714 | } |
1715 | 1715 | } |
1716 | - if (!$Connection->indexExists('spotter_archive','flightaware_id_date_idx') && !$Connection->indexExists('spotter_archive','flightaware_id')) { |
|
1716 | + if (!$Connection->indexExists('spotter_archive', 'flightaware_id_date_idx') && !$Connection->indexExists('spotter_archive', 'flightaware_id')) { |
|
1717 | 1717 | // Add index key |
1718 | 1718 | $query = "create index flightaware_id_date_idx on spotter_archive (flightaware_id,date)"; |
1719 | 1719 | try { |
1720 | 1720 | $sth = $Connection->db->prepare($query); |
1721 | 1721 | $sth->execute(); |
1722 | - } catch(PDOException $e) { |
|
1722 | + } catch (PDOException $e) { |
|
1723 | 1723 | return "error (add index flightaware_id, date on spotter_archive) : ".$e->getMessage()."\n"; |
1724 | 1724 | } |
1725 | 1725 | } |
@@ -1727,7 +1727,7 @@ discard block |
||
1727 | 1727 | try { |
1728 | 1728 | $sth = $Connection->db->prepare($query); |
1729 | 1729 | $sth->execute(); |
1730 | - } catch(PDOException $e) { |
|
1730 | + } catch (PDOException $e) { |
|
1731 | 1731 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1732 | 1732 | } |
1733 | 1733 | return $error; |
@@ -1738,148 +1738,148 @@ discard block |
||
1738 | 1738 | $Connection = new Connection(); |
1739 | 1739 | $error = ''; |
1740 | 1740 | if ($globalDBdriver == 'mysql') { |
1741 | - if (!$Connection->checkColumnName('marine_output','type_id')) { |
|
1741 | + if (!$Connection->checkColumnName('marine_output', 'type_id')) { |
|
1742 | 1742 | $query = "ALTER TABLE marine_output ADD COLUMN type_id int(11) DEFAULT NULL"; |
1743 | 1743 | try { |
1744 | 1744 | $sth = $Connection->db->prepare($query); |
1745 | 1745 | $sth->execute(); |
1746 | - } catch(PDOException $e) { |
|
1746 | + } catch (PDOException $e) { |
|
1747 | 1747 | return "error (add column type_id in marine_output) : ".$e->getMessage()."\n"; |
1748 | 1748 | } |
1749 | 1749 | } |
1750 | - if (!$Connection->checkColumnName('marine_live','type_id')) { |
|
1750 | + if (!$Connection->checkColumnName('marine_live', 'type_id')) { |
|
1751 | 1751 | $query = "ALTER TABLE marine_live ADD COLUMN type_id int(11) DEFAULT NULL"; |
1752 | 1752 | try { |
1753 | 1753 | $sth = $Connection->db->prepare($query); |
1754 | 1754 | $sth->execute(); |
1755 | - } catch(PDOException $e) { |
|
1755 | + } catch (PDOException $e) { |
|
1756 | 1756 | return "error (add column type_id in marine_live) : ".$e->getMessage()."\n"; |
1757 | 1757 | } |
1758 | 1758 | } |
1759 | - if (!$Connection->checkColumnName('marine_archive','type_id')) { |
|
1759 | + if (!$Connection->checkColumnName('marine_archive', 'type_id')) { |
|
1760 | 1760 | $query = "ALTER TABLE marine_archive ADD COLUMN type_id int(11) DEFAULT NULL"; |
1761 | 1761 | try { |
1762 | 1762 | $sth = $Connection->db->prepare($query); |
1763 | 1763 | $sth->execute(); |
1764 | - } catch(PDOException $e) { |
|
1764 | + } catch (PDOException $e) { |
|
1765 | 1765 | return "error (add column type_id in marine_archive) : ".$e->getMessage()."\n"; |
1766 | 1766 | } |
1767 | 1767 | } |
1768 | - if (!$Connection->checkColumnName('marine_archive_output','type_id')) { |
|
1768 | + if (!$Connection->checkColumnName('marine_archive_output', 'type_id')) { |
|
1769 | 1769 | $query = "ALTER TABLE marine_archive_output ADD COLUMN type_id int(11) DEFAULT NULL"; |
1770 | 1770 | try { |
1771 | 1771 | $sth = $Connection->db->prepare($query); |
1772 | 1772 | $sth->execute(); |
1773 | - } catch(PDOException $e) { |
|
1773 | + } catch (PDOException $e) { |
|
1774 | 1774 | return "error (add column type_id in marine_archive_output) : ".$e->getMessage()."\n"; |
1775 | 1775 | } |
1776 | 1776 | } |
1777 | - if (!$Connection->checkColumnName('marine_output','status_id')) { |
|
1777 | + if (!$Connection->checkColumnName('marine_output', 'status_id')) { |
|
1778 | 1778 | $query = "ALTER TABLE marine_output ADD COLUMN status_id int(11) DEFAULT NULL"; |
1779 | 1779 | try { |
1780 | 1780 | $sth = $Connection->db->prepare($query); |
1781 | 1781 | $sth->execute(); |
1782 | - } catch(PDOException $e) { |
|
1782 | + } catch (PDOException $e) { |
|
1783 | 1783 | return "error (add column status_id in marine_output) : ".$e->getMessage()."\n"; |
1784 | 1784 | } |
1785 | 1785 | } |
1786 | - if (!$Connection->checkColumnName('marine_live','status_id')) { |
|
1786 | + if (!$Connection->checkColumnName('marine_live', 'status_id')) { |
|
1787 | 1787 | $query = "ALTER TABLE marine_live ADD COLUMN status_id int(11) DEFAULT NULL"; |
1788 | 1788 | try { |
1789 | 1789 | $sth = $Connection->db->prepare($query); |
1790 | 1790 | $sth->execute(); |
1791 | - } catch(PDOException $e) { |
|
1791 | + } catch (PDOException $e) { |
|
1792 | 1792 | return "error (add column status_id in marine_live) : ".$e->getMessage()."\n"; |
1793 | 1793 | } |
1794 | 1794 | } |
1795 | - if (!$Connection->checkColumnName('marine_archive','status_id')) { |
|
1795 | + if (!$Connection->checkColumnName('marine_archive', 'status_id')) { |
|
1796 | 1796 | $query = "ALTER TABLE marine_archive ADD COLUMN status_id int(11) DEFAULT NULL"; |
1797 | 1797 | try { |
1798 | 1798 | $sth = $Connection->db->prepare($query); |
1799 | 1799 | $sth->execute(); |
1800 | - } catch(PDOException $e) { |
|
1800 | + } catch (PDOException $e) { |
|
1801 | 1801 | return "error (add column status_id in marine_archive) : ".$e->getMessage()."\n"; |
1802 | 1802 | } |
1803 | 1803 | } |
1804 | - if (!$Connection->checkColumnName('marine_archive_output','status_id')) { |
|
1804 | + if (!$Connection->checkColumnName('marine_archive_output', 'status_id')) { |
|
1805 | 1805 | $query = "ALTER TABLE marine_archive_output ADD COLUMN status_id int(11) DEFAULT NULL"; |
1806 | 1806 | try { |
1807 | 1807 | $sth = $Connection->db->prepare($query); |
1808 | 1808 | $sth->execute(); |
1809 | - } catch(PDOException $e) { |
|
1809 | + } catch (PDOException $e) { |
|
1810 | 1810 | return "error (add column status_id in marine_archive_output) : ".$e->getMessage()."\n"; |
1811 | 1811 | } |
1812 | 1812 | } |
1813 | 1813 | } else { |
1814 | - if (!$Connection->checkColumnName('marine_output','type_id')) { |
|
1814 | + if (!$Connection->checkColumnName('marine_output', 'type_id')) { |
|
1815 | 1815 | $query = "ALTER TABLE marine_output ADD COLUMN type_id integer DEFAULT NULL"; |
1816 | 1816 | try { |
1817 | 1817 | $sth = $Connection->db->prepare($query); |
1818 | 1818 | $sth->execute(); |
1819 | - } catch(PDOException $e) { |
|
1819 | + } catch (PDOException $e) { |
|
1820 | 1820 | return "error (add column type_id in marine_output) : ".$e->getMessage()."\n"; |
1821 | 1821 | } |
1822 | 1822 | } |
1823 | - if (!$Connection->checkColumnName('marine_live','type_id')) { |
|
1823 | + if (!$Connection->checkColumnName('marine_live', 'type_id')) { |
|
1824 | 1824 | $query = "ALTER TABLE marine_live ADD COLUMN type_id integer DEFAULT NULL"; |
1825 | 1825 | try { |
1826 | 1826 | $sth = $Connection->db->prepare($query); |
1827 | 1827 | $sth->execute(); |
1828 | - } catch(PDOException $e) { |
|
1828 | + } catch (PDOException $e) { |
|
1829 | 1829 | return "error (add column type_id in marine_live) : ".$e->getMessage()."\n"; |
1830 | 1830 | } |
1831 | 1831 | } |
1832 | - if (!$Connection->checkColumnName('marine_archive','type_id')) { |
|
1832 | + if (!$Connection->checkColumnName('marine_archive', 'type_id')) { |
|
1833 | 1833 | $query = "ALTER TABLE marine_archive ADD COLUMN type_id integer DEFAULT NULL"; |
1834 | 1834 | try { |
1835 | 1835 | $sth = $Connection->db->prepare($query); |
1836 | 1836 | $sth->execute(); |
1837 | - } catch(PDOException $e) { |
|
1837 | + } catch (PDOException $e) { |
|
1838 | 1838 | return "error (add column type_id in marine_archive) : ".$e->getMessage()."\n"; |
1839 | 1839 | } |
1840 | 1840 | } |
1841 | - if (!$Connection->checkColumnName('marine_archive_output','type_id')) { |
|
1841 | + if (!$Connection->checkColumnName('marine_archive_output', 'type_id')) { |
|
1842 | 1842 | $query = "ALTER TABLE marine_archive_output ADD COLUMN type_id integer DEFAULT NULL"; |
1843 | 1843 | try { |
1844 | 1844 | $sth = $Connection->db->prepare($query); |
1845 | 1845 | $sth->execute(); |
1846 | - } catch(PDOException $e) { |
|
1846 | + } catch (PDOException $e) { |
|
1847 | 1847 | return "error (add column type_id in marine_archive_output) : ".$e->getMessage()."\n"; |
1848 | 1848 | } |
1849 | 1849 | } |
1850 | - if (!$Connection->checkColumnName('marine_output','status_id')) { |
|
1850 | + if (!$Connection->checkColumnName('marine_output', 'status_id')) { |
|
1851 | 1851 | $query = "ALTER TABLE marine_output ADD COLUMN status_id integer DEFAULT NULL"; |
1852 | 1852 | try { |
1853 | 1853 | $sth = $Connection->db->prepare($query); |
1854 | 1854 | $sth->execute(); |
1855 | - } catch(PDOException $e) { |
|
1855 | + } catch (PDOException $e) { |
|
1856 | 1856 | return "error (add column status_id in marine_output) : ".$e->getMessage()."\n"; |
1857 | 1857 | } |
1858 | 1858 | } |
1859 | - if (!$Connection->checkColumnName('marine_live','status_id')) { |
|
1859 | + if (!$Connection->checkColumnName('marine_live', 'status_id')) { |
|
1860 | 1860 | $query = "ALTER TABLE marine_live ADD COLUMN status_id integer DEFAULT NULL"; |
1861 | 1861 | try { |
1862 | 1862 | $sth = $Connection->db->prepare($query); |
1863 | 1863 | $sth->execute(); |
1864 | - } catch(PDOException $e) { |
|
1864 | + } catch (PDOException $e) { |
|
1865 | 1865 | return "error (add column status_id in marine_live) : ".$e->getMessage()."\n"; |
1866 | 1866 | } |
1867 | 1867 | } |
1868 | - if (!$Connection->checkColumnName('marine_archive','status_id')) { |
|
1868 | + if (!$Connection->checkColumnName('marine_archive', 'status_id')) { |
|
1869 | 1869 | $query = "ALTER TABLE marine_archive ADD COLUMN status_id integer DEFAULT NULL"; |
1870 | 1870 | try { |
1871 | 1871 | $sth = $Connection->db->prepare($query); |
1872 | 1872 | $sth->execute(); |
1873 | - } catch(PDOException $e) { |
|
1873 | + } catch (PDOException $e) { |
|
1874 | 1874 | return "error (add column status_id in marine_archive) : ".$e->getMessage()."\n"; |
1875 | 1875 | } |
1876 | 1876 | } |
1877 | - if (!$Connection->checkColumnName('marine_archive_output','status_id')) { |
|
1877 | + if (!$Connection->checkColumnName('marine_archive_output', 'status_id')) { |
|
1878 | 1878 | $query = "ALTER TABLE marine_archive_output ADD COLUMN status_id integer DEFAULT NULL"; |
1879 | 1879 | try { |
1880 | 1880 | $sth = $Connection->db->prepare($query); |
1881 | 1881 | $sth->execute(); |
1882 | - } catch(PDOException $e) { |
|
1882 | + } catch (PDOException $e) { |
|
1883 | 1883 | return "error (add column status_id in marine_archive_output) : ".$e->getMessage()."\n"; |
1884 | 1884 | } |
1885 | 1885 | } |
@@ -1888,7 +1888,7 @@ discard block |
||
1888 | 1888 | try { |
1889 | 1889 | $sth = $Connection->db->prepare($query); |
1890 | 1890 | $sth->execute(); |
1891 | - } catch(PDOException $e) { |
|
1891 | + } catch (PDOException $e) { |
|
1892 | 1892 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1893 | 1893 | } |
1894 | 1894 | return $error; |
@@ -1903,14 +1903,14 @@ discard block |
||
1903 | 1903 | try { |
1904 | 1904 | $sth = $Connection->db->prepare($query); |
1905 | 1905 | $sth->execute(); |
1906 | - } catch(PDOException $e) { |
|
1906 | + } catch (PDOException $e) { |
|
1907 | 1907 | return "error (change pilot_id type to varchar in stats_pilot) : ".$e->getMessage()."\n"; |
1908 | 1908 | } |
1909 | 1909 | $query = "ALTER TABLE marine_identity MODIFY COLUMN mmsi varchar(255) DEFAULT NULL"; |
1910 | 1910 | try { |
1911 | 1911 | $sth = $Connection->db->prepare($query); |
1912 | 1912 | $sth->execute(); |
1913 | - } catch(PDOException $e) { |
|
1913 | + } catch (PDOException $e) { |
|
1914 | 1914 | return "error (change mmsi type to varchar in marine_identity) : ".$e->getMessage()."\n"; |
1915 | 1915 | } |
1916 | 1916 | } else { |
@@ -1918,14 +1918,14 @@ discard block |
||
1918 | 1918 | try { |
1919 | 1919 | $sth = $Connection->db->prepare($query); |
1920 | 1920 | $sth->execute(); |
1921 | - } catch(PDOException $e) { |
|
1921 | + } catch (PDOException $e) { |
|
1922 | 1922 | return "error (change pilot_id type to varchar in stats_pilot) : ".$e->getMessage()."\n"; |
1923 | 1923 | } |
1924 | 1924 | $query = "alter table marine_identity alter column mmsi type varchar(255)"; |
1925 | 1925 | try { |
1926 | 1926 | $sth = $Connection->db->prepare($query); |
1927 | 1927 | $sth->execute(); |
1928 | - } catch(PDOException $e) { |
|
1928 | + } catch (PDOException $e) { |
|
1929 | 1929 | return "error (change mmsi type to varchar in marine_identity) : ".$e->getMessage()."\n"; |
1930 | 1930 | } |
1931 | 1931 | } |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | try { |
1934 | 1934 | $sth = $Connection->db->prepare($query); |
1935 | 1935 | $sth->execute(); |
1936 | - } catch(PDOException $e) { |
|
1936 | + } catch (PDOException $e) { |
|
1937 | 1937 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1938 | 1938 | } |
1939 | 1939 | return $error; |
@@ -1943,32 +1943,32 @@ discard block |
||
1943 | 1943 | global $globalDBdriver; |
1944 | 1944 | $Connection = new Connection(); |
1945 | 1945 | $error = ''; |
1946 | - if (!$Connection->checkColumnName('source_location','last_seen')) { |
|
1946 | + if (!$Connection->checkColumnName('source_location', 'last_seen')) { |
|
1947 | 1947 | $query = "ALTER TABLE source_location ADD COLUMN last_seen timestamp NULL DEFAULT NULL"; |
1948 | 1948 | try { |
1949 | 1949 | $sth = $Connection->db->prepare($query); |
1950 | 1950 | $sth->execute(); |
1951 | - } catch(PDOException $e) { |
|
1951 | + } catch (PDOException $e) { |
|
1952 | 1952 | return "error (add column last_seen in source_location) : ".$e->getMessage()."\n"; |
1953 | 1953 | } |
1954 | 1954 | } |
1955 | 1955 | if ($globalDBdriver == 'mysql') { |
1956 | - if (!$Connection->checkColumnName('source_location','location_id')) { |
|
1956 | + if (!$Connection->checkColumnName('source_location', 'location_id')) { |
|
1957 | 1957 | $query = "ALTER TABLE source_location ADD COLUMN location_id int(11) DEFAULT NULL"; |
1958 | 1958 | try { |
1959 | 1959 | $sth = $Connection->db->prepare($query); |
1960 | 1960 | $sth->execute(); |
1961 | - } catch(PDOException $e) { |
|
1961 | + } catch (PDOException $e) { |
|
1962 | 1962 | return "error (add column location_id in source_location) : ".$e->getMessage()."\n"; |
1963 | 1963 | } |
1964 | 1964 | } |
1965 | 1965 | } else { |
1966 | - if (!$Connection->checkColumnName('source_location','location_id')) { |
|
1966 | + if (!$Connection->checkColumnName('source_location', 'location_id')) { |
|
1967 | 1967 | $query = "ALTER TABLE source_location ADD COLUMN location_id integer DEFAULT NULL"; |
1968 | 1968 | try { |
1969 | 1969 | $sth = $Connection->db->prepare($query); |
1970 | 1970 | $sth->execute(); |
1971 | - } catch(PDOException $e) { |
|
1971 | + } catch (PDOException $e) { |
|
1972 | 1972 | return "error (add column location_id in source_location) : ".$e->getMessage()."\n"; |
1973 | 1973 | } |
1974 | 1974 | } |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | try { |
1978 | 1978 | $sth = $Connection->db->prepare($query); |
1979 | 1979 | $sth->execute(); |
1980 | - } catch(PDOException $e) { |
|
1980 | + } catch (PDOException $e) { |
|
1981 | 1981 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1982 | 1982 | } |
1983 | 1983 | return $error; |
@@ -1987,12 +1987,12 @@ discard block |
||
1987 | 1987 | global $globalDBdriver; |
1988 | 1988 | $Connection = new Connection(); |
1989 | 1989 | $error = ''; |
1990 | - if (!$Connection->checkColumnName('source_location','description')) { |
|
1990 | + if (!$Connection->checkColumnName('source_location', 'description')) { |
|
1991 | 1991 | $query = "ALTER TABLE source_location ADD COLUMN description text DEFAULT NULL"; |
1992 | 1992 | try { |
1993 | 1993 | $sth = $Connection->db->prepare($query); |
1994 | 1994 | $sth->execute(); |
1995 | - } catch(PDOException $e) { |
|
1995 | + } catch (PDOException $e) { |
|
1996 | 1996 | return "error (add column description in source_location) : ".$e->getMessage()."\n"; |
1997 | 1997 | } |
1998 | 1998 | } |
@@ -2000,7 +2000,7 @@ discard block |
||
2000 | 2000 | try { |
2001 | 2001 | $sth = $Connection->db->prepare($query); |
2002 | 2002 | $sth->execute(); |
2003 | - } catch(PDOException $e) { |
|
2003 | + } catch (PDOException $e) { |
|
2004 | 2004 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2005 | 2005 | } |
2006 | 2006 | return $error; |
@@ -2010,39 +2010,39 @@ discard block |
||
2010 | 2010 | global $globalDBdriver; |
2011 | 2011 | $Connection = new Connection(); |
2012 | 2012 | $error = ''; |
2013 | - if (!$Connection->checkColumnName('spotter_live','real_altitude')) { |
|
2013 | + if (!$Connection->checkColumnName('spotter_live', 'real_altitude')) { |
|
2014 | 2014 | $query = "ALTER TABLE spotter_live ADD COLUMN real_altitude float DEFAULT NULL"; |
2015 | 2015 | try { |
2016 | 2016 | $sth = $Connection->db->prepare($query); |
2017 | 2017 | $sth->execute(); |
2018 | - } catch(PDOException $e) { |
|
2018 | + } catch (PDOException $e) { |
|
2019 | 2019 | return "error (add column real_altitude in spotter_live) : ".$e->getMessage()."\n"; |
2020 | 2020 | } |
2021 | 2021 | } |
2022 | - if (!$Connection->checkColumnName('spotter_output','real_altitude')) { |
|
2022 | + if (!$Connection->checkColumnName('spotter_output', 'real_altitude')) { |
|
2023 | 2023 | $query = "ALTER TABLE spotter_output ADD COLUMN real_altitude float DEFAULT NULL"; |
2024 | 2024 | try { |
2025 | 2025 | $sth = $Connection->db->prepare($query); |
2026 | 2026 | $sth->execute(); |
2027 | - } catch(PDOException $e) { |
|
2027 | + } catch (PDOException $e) { |
|
2028 | 2028 | return "error (add column real_altitude in spotter_output) : ".$e->getMessage()."\n"; |
2029 | 2029 | } |
2030 | 2030 | } |
2031 | - if (!$Connection->checkColumnName('spotter_archive_output','real_altitude')) { |
|
2031 | + if (!$Connection->checkColumnName('spotter_archive_output', 'real_altitude')) { |
|
2032 | 2032 | $query = "ALTER TABLE spotter_archive_output ADD COLUMN real_altitude float DEFAULT NULL"; |
2033 | 2033 | try { |
2034 | 2034 | $sth = $Connection->db->prepare($query); |
2035 | 2035 | $sth->execute(); |
2036 | - } catch(PDOException $e) { |
|
2036 | + } catch (PDOException $e) { |
|
2037 | 2037 | return "error (add column real_altitude in spotter_archive_output) : ".$e->getMessage()."\n"; |
2038 | 2038 | } |
2039 | 2039 | } |
2040 | - if (!$Connection->checkColumnName('spotter_archive','real_altitude')) { |
|
2040 | + if (!$Connection->checkColumnName('spotter_archive', 'real_altitude')) { |
|
2041 | 2041 | $query = "ALTER TABLE spotter_archive ADD COLUMN real_altitude float DEFAULT NULL"; |
2042 | 2042 | try { |
2043 | 2043 | $sth = $Connection->db->prepare($query); |
2044 | 2044 | $sth->execute(); |
2045 | - } catch(PDOException $e) { |
|
2045 | + } catch (PDOException $e) { |
|
2046 | 2046 | return "error (add column real_altitude in spotter_archive) : ".$e->getMessage()."\n"; |
2047 | 2047 | } |
2048 | 2048 | } |
@@ -2050,7 +2050,7 @@ discard block |
||
2050 | 2050 | try { |
2051 | 2051 | $sth = $Connection->db->prepare($query); |
2052 | 2052 | $sth->execute(); |
2053 | - } catch(PDOException $e) { |
|
2053 | + } catch (PDOException $e) { |
|
2054 | 2054 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2055 | 2055 | } |
2056 | 2056 | return $error; |
@@ -2072,14 +2072,14 @@ discard block |
||
2072 | 2072 | try { |
2073 | 2073 | $sth = $Connection->db->prepare($query); |
2074 | 2074 | $sth->execute(); |
2075 | - } catch(PDOException $e) { |
|
2075 | + } catch (PDOException $e) { |
|
2076 | 2076 | return "error (modify column altitude in tracker_*) : ".$e->getMessage()."\n"; |
2077 | 2077 | } |
2078 | 2078 | $query = "UPDATE config SET value = '44' WHERE name = 'schema_version'"; |
2079 | 2079 | try { |
2080 | 2080 | $sth = $Connection->db->prepare($query); |
2081 | 2081 | $sth->execute(); |
2082 | - } catch(PDOException $e) { |
|
2082 | + } catch (PDOException $e) { |
|
2083 | 2083 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2084 | 2084 | } |
2085 | 2085 | return $error; |
@@ -2120,7 +2120,7 @@ discard block |
||
2120 | 2120 | try { |
2121 | 2121 | $sth = $Connection->db->prepare($query); |
2122 | 2122 | $sth->execute(); |
2123 | - } catch(PDOException $e) { |
|
2123 | + } catch (PDOException $e) { |
|
2124 | 2124 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2125 | 2125 | } |
2126 | 2126 | return $error; |
@@ -2143,7 +2143,7 @@ discard block |
||
2143 | 2143 | try { |
2144 | 2144 | $sth = $Connection->db->prepare($query); |
2145 | 2145 | $sth->execute(); |
2146 | - } catch(PDOException $e) { |
|
2146 | + } catch (PDOException $e) { |
|
2147 | 2147 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2148 | 2148 | } |
2149 | 2149 | return $error; |
@@ -2193,7 +2193,7 @@ discard block |
||
2193 | 2193 | try { |
2194 | 2194 | $sth = $Connection->db->prepare($query); |
2195 | 2195 | $sth->execute(); |
2196 | - } catch(PDOException $e) { |
|
2196 | + } catch (PDOException $e) { |
|
2197 | 2197 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2198 | 2198 | } |
2199 | 2199 | return $error; |
@@ -2216,7 +2216,7 @@ discard block |
||
2216 | 2216 | try { |
2217 | 2217 | $sth = $Connection->db->prepare($query); |
2218 | 2218 | $sth->execute(); |
2219 | - } catch(PDOException $e) { |
|
2219 | + } catch (PDOException $e) { |
|
2220 | 2220 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2221 | 2221 | } |
2222 | 2222 | return $error; |
@@ -2239,7 +2239,7 @@ discard block |
||
2239 | 2239 | try { |
2240 | 2240 | $sth = $Connection->db->prepare($query); |
2241 | 2241 | $sth->execute(); |
2242 | - } catch(PDOException $e) { |
|
2242 | + } catch (PDOException $e) { |
|
2243 | 2243 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2244 | 2244 | } |
2245 | 2245 | return $error; |
@@ -2260,7 +2260,7 @@ discard block |
||
2260 | 2260 | try { |
2261 | 2261 | $sth = $Connection->db->prepare($query); |
2262 | 2262 | $sth->execute(); |
2263 | - } catch(PDOException $e) { |
|
2263 | + } catch (PDOException $e) { |
|
2264 | 2264 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2265 | 2265 | } |
2266 | 2266 | return $error; |
@@ -2283,7 +2283,7 @@ discard block |
||
2283 | 2283 | try { |
2284 | 2284 | $sth = $Connection->db->prepare($query); |
2285 | 2285 | $sth->execute(); |
2286 | - } catch(PDOException $e) { |
|
2286 | + } catch (PDOException $e) { |
|
2287 | 2287 | return "error (check_version): ".$e->getMessage()."\n"; |
2288 | 2288 | } |
2289 | 2289 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | header('Content-Type: text/javascript'); |
18 | 18 | |
19 | 19 | |
20 | -$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
20 | +$polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
21 | 21 | $output = '{"type": "FeatureCollection","features": ['; |
22 | 22 | if (!empty($polar)) { |
23 | - foreach($polar as $eachpolar) { |
|
23 | + foreach ($polar as $eachpolar) { |
|
24 | 24 | $data = json_decode($eachpolar['source_data']); |
25 | 25 | $name = $eachpolar['source_name']; |
26 | 26 | $coord = $Location->getLocationInfobySourceName($name); |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | $initial_longitude = $globalCenterLongitude; |
34 | 34 | } |
35 | 35 | $first = ''; |
36 | - foreach($data as $value => $key) { |
|
37 | - $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude,$initial_longitude,$value*22.5,$key); |
|
38 | - if ($first == '') $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']'; |
|
36 | + foreach ($data as $value => $key) { |
|
37 | + $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude, $initial_longitude, $value*22.5, $key); |
|
38 | + if ($first == '') $first = '['.round($final_coord['longitude'], 5).','.round($final_coord['latitude'], 5).']'; |
|
39 | 39 | $output .= '['.$final_coord['longitude'].','.$final_coord['latitude'].'],'; |
40 | 40 | } |
41 | 41 | $output .= $first; |
42 | 42 | $output .= ']]}},'; |
43 | 43 | } |
44 | - $output = substr($output, 0, -1); |
|
44 | + $output = substr($output, 0, -1); |
|
45 | 45 | } |
46 | 46 | $output .= ']}'; |
47 | 47 | print $output; |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | die; |
51 | 51 | } |
52 | 52 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
53 | - $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
|
53 | + $globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | -$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver','enable-aircraft','disable-aircraft','enable-tracker','disable-tracker','enable-marine','disable-marine')); |
|
57 | +$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::', 'aprsserverhost::', 'aprsserverport::', 'format::', 'noaprsserver', 'enable-aircraft', 'disable-aircraft', 'enable-tracker', 'disable-tracker', 'enable-marine', 'disable-marine')); |
|
58 | 58 | //if (isset($options['s'])) $hosts = array($options['s']); |
59 | 59 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
60 | 60 | if (isset($options['s'])) { |
61 | 61 | $globalSources = array(); |
62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
62 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['s'], 'format' => $options['format']); |
|
63 | 63 | else $globalSources[] = array('host' => $options['s']); |
64 | 64 | } elseif (isset($options['source'])) { |
65 | 65 | $globalSources = array(); |
66 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
66 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['source'], 'format' => $options['format']); |
|
67 | 67 | else $globalSources[] = array('host' => $options['source']); |
68 | 68 | } |
69 | 69 | if (isset($options['aprsserverhost'])) { |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | else $id_source = 1; |
105 | 105 | if (isset($globalServer) && $globalServer) { |
106 | 106 | if ($globalDebug) echo "Using Server Mode\n"; |
107 | - $SI=new SpotterServer(); |
|
107 | + $SI = new SpotterServer(); |
|
108 | 108 | /* |
109 | 109 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
110 | 110 | $SI = new adsb2aprs(); |
111 | 111 | $SI->connect(); |
112 | 112 | */ |
113 | -} else $SI=new SpotterImport($Connection->db); |
|
113 | +} else $SI = new SpotterImport($Connection->db); |
|
114 | 114 | |
115 | 115 | if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
116 | 116 | if (isset($globalMarine) && $globalMarine) { |
@@ -124,17 +124,17 @@ discard block |
||
124 | 124 | $MI = new MarineImport($Connection->db); |
125 | 125 | } |
126 | 126 | //$APRS=new APRS($Connection->db); |
127 | -$SBS=new SBS(); |
|
127 | +$SBS = new SBS(); |
|
128 | 128 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
129 | - $ACARS=new ACARS($Connection->db,true); |
|
130 | - $Source=new Source($Connection->db); |
|
129 | + $ACARS = new ACARS($Connection->db, true); |
|
130 | + $Source = new Source($Connection->db); |
|
131 | 131 | } |
132 | -$Common=new Common(); |
|
132 | +$Common = new Common(); |
|
133 | 133 | date_default_timezone_set('UTC'); |
134 | 134 | //$servertz = system('date +%Z'); |
135 | 135 | // signal handler - playing nice with sockets and dump1090 |
136 | 136 | if (function_exists('pcntl_fork')) { |
137 | - pcntl_signal(SIGINT, function() { |
|
137 | + pcntl_signal(SIGINT, function() { |
|
138 | 138 | global $sockets; |
139 | 139 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
140 | 140 | die("Bye!\n"); |
@@ -150,35 +150,35 @@ discard block |
||
150 | 150 | |
151 | 151 | function connect_all($hosts) { |
152 | 152 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
153 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
153 | + global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context; |
|
154 | 154 | $reset++; |
155 | 155 | if ($globalDebug) echo 'Connect to all...'."\n"; |
156 | 156 | foreach ($hosts as $id => $value) { |
157 | 157 | $host = $value['host']; |
158 | 158 | $globalSources[$id]['last_exec'] = 0; |
159 | 159 | // Here we check type of source(s) |
160 | - if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
161 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
160 | + if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
161 | + if (preg_match('/deltadb.txt$/i', $host)) { |
|
162 | 162 | //$formats[$id] = 'deltadbtxt'; |
163 | 163 | $globalSources[$id]['format'] = 'deltadbtxt'; |
164 | 164 | //$last_exec['deltadbtxt'] = 0; |
165 | 165 | if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
166 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
166 | + } else if (preg_match('/vatsim-data.txt$/i', $host)) { |
|
167 | 167 | //$formats[$id] = 'vatsimtxt'; |
168 | 168 | $globalSources[$id]['format'] = 'vatsimtxt'; |
169 | 169 | //$last_exec['vatsimtxt'] = 0; |
170 | 170 | if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
171 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
171 | + } else if (preg_match('/aircraftlist.json$/i', $host)) { |
|
172 | 172 | //$formats[$id] = 'aircraftlistjson'; |
173 | 173 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
174 | 174 | //$last_exec['aircraftlistjson'] = 0; |
175 | 175 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
176 | - } else if (preg_match('/aircraft.json$/i',$host)) { |
|
176 | + } else if (preg_match('/aircraft.json$/i', $host)) { |
|
177 | 177 | //$formats[$id] = 'aircraftjson'; |
178 | 178 | $globalSources[$id]['format'] = 'aircraftjson'; |
179 | 179 | //$last_exec['aircraftlistjson'] = 0; |
180 | 180 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
181 | - } else if (preg_match('/opensky/i',$host)) { |
|
181 | + } else if (preg_match('/opensky/i', $host)) { |
|
182 | 182 | //$formats[$id] = 'aircraftlistjson'; |
183 | 183 | $globalSources[$id]['format'] = 'opensky'; |
184 | 184 | //$last_exec['aircraftlistjson'] = 0; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | exit(0); |
196 | 196 | } |
197 | 197 | */ |
198 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
198 | + } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { |
|
199 | 199 | //$formats[$id] = 'planeupdatefaa'; |
200 | 200 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
201 | 201 | //$last_exec['planeupdatefaa'] = 0; |
@@ -204,37 +204,37 @@ discard block |
||
204 | 204 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
205 | 205 | exit(0); |
206 | 206 | } |
207 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
207 | + } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { |
|
208 | 208 | //$formats[$id] = 'phpvmacars'; |
209 | 209 | $globalSources[$id]['format'] = 'phpvmacars'; |
210 | 210 | //$last_exec['phpvmacars'] = 0; |
211 | 211 | if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
212 | - } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) { |
|
212 | + } else if (preg_match('/\/api\/v1\/acars\/data$/i', $host)) { |
|
213 | 213 | //$formats[$id] = 'phpvmacars'; |
214 | 214 | $globalSources[$id]['format'] = 'vaos'; |
215 | 215 | //$last_exec['phpvmacars'] = 0; |
216 | 216 | if ($globalDebug) echo "Connect to vaos source (".$host.")...\n"; |
217 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
217 | + } else if (preg_match('/VAM-json.php$/i', $host)) { |
|
218 | 218 | //$formats[$id] = 'phpvmacars'; |
219 | 219 | $globalSources[$id]['format'] = 'vam'; |
220 | 220 | if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
221 | - } else if (preg_match('/whazzup/i',$host)) { |
|
221 | + } else if (preg_match('/whazzup/i', $host)) { |
|
222 | 222 | //$formats[$id] = 'whazzup'; |
223 | 223 | $globalSources[$id]['format'] = 'whazzup'; |
224 | 224 | //$last_exec['whazzup'] = 0; |
225 | 225 | if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
226 | - } else if (preg_match('/blitzortung/i',$host)) { |
|
226 | + } else if (preg_match('/blitzortung/i', $host)) { |
|
227 | 227 | $globalSources[$id]['format'] = 'blitzortung'; |
228 | 228 | if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
229 | - } else if (preg_match('/airwhere/i',$host)) { |
|
229 | + } else if (preg_match('/airwhere/i', $host)) { |
|
230 | 230 | $globalSources[$id]['format'] = 'airwhere'; |
231 | 231 | if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
232 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
232 | + } else if (preg_match('/recentpireps/i', $host)) { |
|
233 | 233 | //$formats[$id] = 'pirepsjson'; |
234 | 234 | $globalSources[$id]['format'] = 'pirepsjson'; |
235 | 235 | //$last_exec['pirepsjson'] = 0; |
236 | 236 | if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
237 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
237 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { |
|
238 | 238 | //$formats[$id] = 'fr24json'; |
239 | 239 | $globalSources[$id]['format'] = 'fr24json'; |
240 | 240 | //$last_exec['fr24json'] = 0; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
244 | 244 | exit(0); |
245 | 245 | } |
246 | - } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
246 | + } else if (preg_match(':myshiptracking.com/:i', $host)) { |
|
247 | 247 | //$formats[$id] = 'fr24json'; |
248 | 248 | $globalSources[$id]['format'] = 'myshiptracking'; |
249 | 249 | //$last_exec['fr24json'] = 0; |
@@ -253,21 +253,21 @@ discard block |
||
253 | 253 | exit(0); |
254 | 254 | } |
255 | 255 | //} else if (preg_match('/10001/',$host)) { |
256 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
256 | + } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
257 | 257 | //$formats[$id] = 'tsv'; |
258 | 258 | $globalSources[$id]['format'] = 'tsv'; |
259 | 259 | if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
260 | 260 | } |
261 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
261 | + } elseif (filter_var($host, FILTER_VALIDATE_URL)) { |
|
262 | 262 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
263 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
263 | + $idf = fopen($globalSources[$id]['host'], 'r', false, $context); |
|
264 | 264 | if ($idf !== false) { |
265 | 265 | $httpfeeds[$id] = $idf; |
266 | 266 | if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
267 | 267 | } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
268 | 268 | } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
269 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
270 | - $hostport = explode(':',$host); |
|
269 | + } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { |
|
270 | + $hostport = explode(':', $host); |
|
271 | 271 | if (isset($hostport[1])) { |
272 | 272 | $port = $hostport[1]; |
273 | 273 | $hostn = $hostport[0]; |
@@ -277,19 +277,19 @@ discard block |
||
277 | 277 | } |
278 | 278 | $Common = new Common(); |
279 | 279 | if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
280 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
280 | + $s = $Common->create_socket($hostn, $port, $errno, $errstr); |
|
281 | 281 | } else { |
282 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
282 | + $s = $Common->create_socket_udp($hostn, $port, $errno, $errstr); |
|
283 | 283 | } |
284 | 284 | if ($s) { |
285 | 285 | $sockets[$id] = $s; |
286 | 286 | if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
287 | - if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
287 | + if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') { |
|
288 | 288 | //$formats[$id] = 'aprs'; |
289 | 289 | $globalSources[$id]['format'] = 'aprs'; |
290 | 290 | //$aprs_connect = 0; |
291 | 291 | //$use_aprs = true; |
292 | - } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
292 | + } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
293 | 293 | $globalSources[$id]['format'] = 'vrstcp'; |
294 | 294 | } elseif ($port == '10001') { |
295 | 295 | //$formats[$id] = 'tsv'; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
329 | 329 | else $timeout = 20; |
330 | 330 | $errno = ''; |
331 | -$errstr=''; |
|
331 | +$errstr = ''; |
|
332 | 332 | |
333 | 333 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
334 | 334 | /* Initiate connections to all the hosts simultaneously */ |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | //connect_all($globalSources); |
337 | 337 | |
338 | 338 | if (isset($globalProxy) && $globalProxy) { |
339 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
339 | + $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true))); |
|
340 | 340 | } else { |
341 | 341 | $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
342 | 342 | } |
@@ -366,16 +366,16 @@ discard block |
||
366 | 366 | |
367 | 367 | if ($use_aprs) { |
368 | 368 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
369 | - $APRS=new APRS(); |
|
369 | + $APRS = new APRS(); |
|
370 | 370 | $aprs_connect = 0; |
371 | 371 | $aprs_keep = 120; |
372 | 372 | $aprs_last_tx = time(); |
373 | 373 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
374 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
374 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
375 | 375 | if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
376 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
376 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
377 | 377 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
378 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
378 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
379 | 379 | if ($aprs_full) $aprs_filter = ''; |
380 | 380 | if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
381 | 381 | else $aprs_pass = '-1'; |
@@ -389,12 +389,12 @@ discard block |
||
389 | 389 | sleep(1); |
390 | 390 | if ($globalDebug) echo "SCAN MODE \n\n"; |
391 | 391 | if (!isset($globalCronEnd)) $globalCronEnd = 60; |
392 | -$endtime = time()+$globalCronEnd; |
|
392 | +$endtime = time() + $globalCronEnd; |
|
393 | 393 | $i = 1; |
394 | 394 | $tt = array(); |
395 | 395 | // Delete all ATC |
396 | 396 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
397 | - $ATC=new ATC($Connection->db); |
|
397 | + $ATC = new ATC($Connection->db); |
|
398 | 398 | } |
399 | 399 | if (!$globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
400 | 400 | $ATC->deleteAll(); |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | while ($i > 0) { |
405 | 405 | if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
406 | 406 | |
407 | - if (!$globalDaemon) $i = $endtime-time(); |
|
407 | + if (!$globalDaemon) $i = $endtime - time(); |
|
408 | 408 | // Delete old ATC |
409 | 409 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
410 | 410 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | } |
419 | 419 | if ($max < $globalMinFetch) { |
420 | 420 | if ($globalDebug) echo 'Sleeping...'."\n"; |
421 | - sleep($globalMinFetch-$max+2); |
|
421 | + sleep($globalMinFetch - $max + 2); |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
@@ -437,8 +437,8 @@ discard block |
||
437 | 437 | //$buffer = $Common->getData($hosts[$id]); |
438 | 438 | $buffer = $Common->getData($value['host']); |
439 | 439 | if ($buffer != '') $reset = 0; |
440 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
441 | - $buffer = explode('\n',$buffer); |
|
440 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
441 | + $buffer = explode('\n', $buffer); |
|
442 | 442 | foreach ($buffer as $line) { |
443 | 443 | if ($line != '' && count($line) > 7) { |
444 | 444 | $line = explode(',', $line); |
@@ -471,11 +471,11 @@ discard block |
||
471 | 471 | ) |
472 | 472 | ) { |
473 | 473 | date_default_timezone_set('CET'); |
474 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
474 | + $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host'])); |
|
475 | 475 | date_default_timezone_set('UTC'); |
476 | 476 | if ($buffer != '') $reset = 0; |
477 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
478 | - $buffer = explode('\n',$buffer); |
|
477 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
478 | + $buffer = explode('\n', $buffer); |
|
479 | 479 | foreach ($buffer as $line) { |
480 | 480 | if ($line != '') { |
481 | 481 | //echo "'".$line."'\n"; |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | $ais_data = $AIS->parse_line(trim($line)); |
484 | 484 | $data = array(); |
485 | 485 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
486 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
486 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
487 | 487 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
488 | 488 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
489 | 489 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
496 | 496 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
497 | 497 | if (isset($ais_data['timestamp'])) { |
498 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
498 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
499 | 499 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
500 | 500 | $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
501 | 501 | $add = true; |
@@ -518,21 +518,21 @@ discard block |
||
518 | 518 | $w = $e = null; |
519 | 519 | |
520 | 520 | if (isset($arr[$id])) { |
521 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
521 | + $nn = stream_select($arr, $w, $e, $timeout); |
|
522 | 522 | if ($nn > 0) { |
523 | 523 | foreach ($httpfeeds as $feed) { |
524 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
524 | + $buffer = stream_get_line($feed, 2000, "\n"); |
|
525 | 525 | if ($buffer === FALSE) { |
526 | 526 | connect_all($globalSources); |
527 | 527 | } |
528 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
529 | - $buffer = explode('\n',$buffer); |
|
528 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
529 | + $buffer = explode('\n', $buffer); |
|
530 | 530 | foreach ($buffer as $line) { |
531 | 531 | if ($line != '') { |
532 | 532 | $ais_data = $AIS->parse_line(trim($line)); |
533 | 533 | $data = array(); |
534 | 534 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
535 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
535 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
536 | 536 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
537 | 537 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
538 | 538 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -544,9 +544,9 @@ discard block |
||
544 | 544 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
545 | 545 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
546 | 546 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
547 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
547 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
548 | 548 | if (isset($ais_data['timestamp'])) { |
549 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
549 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
550 | 550 | } else { |
551 | 551 | $data['datetime'] = date('Y-m-d H:i:s'); |
552 | 552 | } |
@@ -578,10 +578,10 @@ discard block |
||
578 | 578 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
579 | 579 | ) |
580 | 580 | ) { |
581 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
581 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
582 | 582 | if ($buffer != '') { |
583 | 583 | //echo $buffer; |
584 | - $all_data = json_decode($buffer,true); |
|
584 | + $all_data = json_decode($buffer, true); |
|
585 | 585 | //print_r($all_data); |
586 | 586 | if (isset($all_data[0]['DATA'])) { |
587 | 587 | foreach ($all_data[0]['DATA'] as $line) { |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | $data['ident'] = $line['NAME']; |
591 | 591 | $data['mmsi'] = $line['MMSI']; |
592 | 592 | if (strlen($data['mmsi']) > 9) { |
593 | - $data['mmsi'] = substr($data['mmsi'],-9); |
|
593 | + $data['mmsi'] = substr($data['mmsi'], -9); |
|
594 | 594 | } |
595 | 595 | $data['speed'] = $line['SOG']; |
596 | 596 | $data['heading'] = $line['COG']; |
@@ -600,8 +600,8 @@ discard block |
||
600 | 600 | //$data['type_id'] = $line['TYPE']; |
601 | 601 | $data['imo'] = $line['IMO']; |
602 | 602 | if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST']; |
603 | - if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
604 | - $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
603 | + if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s', strtotime($line['ARV'])); |
|
604 | + $data['datetime'] = date('Y-m-d H:i:s', $line['T']); |
|
605 | 605 | $data['format_source'] = 'myshiptracking'; |
606 | 606 | $data['id_source'] = $id_source; |
607 | 607 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -618,16 +618,16 @@ discard block |
||
618 | 618 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
619 | 619 | ) |
620 | 620 | ) { |
621 | - $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
621 | + $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host'])); |
|
622 | 622 | if ($buffer != '') { |
623 | - $all_data = json_decode($buffer,true); |
|
623 | + $all_data = json_decode($buffer, true); |
|
624 | 624 | if (isset($all_data[0]['mmsi'])) { |
625 | 625 | foreach ($all_data as $line) { |
626 | 626 | if ($line != '') { |
627 | 627 | $data = array(); |
628 | 628 | $data['ident'] = $line['shipname']; |
629 | 629 | $data['callsign'] = $line['callsign']; |
630 | - $data['mmsi'] = substr($line['mmsi'],-9); |
|
630 | + $data['mmsi'] = substr($line['mmsi'], -9); |
|
631 | 631 | $data['speed'] = $line['sog']; |
632 | 632 | if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
633 | 633 | $data['latitude'] = $line['latitude']; |
@@ -654,14 +654,14 @@ discard block |
||
654 | 654 | ) { |
655 | 655 | $buffer = $Common->getData($value['host']); |
656 | 656 | if ($buffer != '') { |
657 | - $all_data = json_decode($buffer,true); |
|
657 | + $all_data = json_decode($buffer, true); |
|
658 | 658 | if (isset($all_data['features'][0]['id'])) { |
659 | 659 | foreach ($all_data['features'] as $line) { |
660 | 660 | print_r($line); |
661 | 661 | $data = array(); |
662 | 662 | if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
663 | 663 | if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
664 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
664 | + if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'], -9); |
|
665 | 665 | if (isset($line['properties']['imo'])) $data['imo'] = $line['properties']['imo']; |
666 | 666 | if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
667 | 667 | if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) $data['heading'] = $line['properties']['heading']; |
@@ -688,31 +688,31 @@ discard block |
||
688 | 688 | ) |
689 | 689 | ) { |
690 | 690 | echo 'download...'; |
691 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
691 | + $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter'); |
|
692 | 692 | echo 'done !'."\n"; |
693 | 693 | // FIXME: Need more work |
694 | 694 | if ($buffer != '') $reset = 0; |
695 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
696 | - $buffer = explode('\n',$buffer); |
|
695 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
696 | + $buffer = explode('\n', $buffer); |
|
697 | 697 | foreach ($buffer as $line) { |
698 | 698 | if ($line != '') { |
699 | 699 | $data = array(); |
700 | 700 | echo $line."\n"; |
701 | - $data['mmsi'] = (int)substr($line,0,9); |
|
702 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
703 | - $data['status_id'] = substr($line,21,2); |
|
704 | - $data['type_id'] = substr($line,24,3); |
|
705 | - $data['latitude'] = substr($line,29,9); |
|
706 | - $data['longitude'] = substr($line,41,9); |
|
707 | - $data['speed'] = round(substr($line,51,5)); |
|
701 | + $data['mmsi'] = (int) substr($line, 0, 9); |
|
702 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10)); |
|
703 | + $data['status_id'] = substr($line, 21, 2); |
|
704 | + $data['type_id'] = substr($line, 24, 3); |
|
705 | + $data['latitude'] = substr($line, 29, 9); |
|
706 | + $data['longitude'] = substr($line, 41, 9); |
|
707 | + $data['speed'] = round(substr($line, 51, 5)); |
|
708 | 708 | //$data['course'] = substr($line,57,5); |
709 | - $data['heading'] = round(substr($line,63,3)); |
|
709 | + $data['heading'] = round(substr($line, 63, 3)); |
|
710 | 710 | //$data['draft'] = substr($line,67,4); |
711 | 711 | //$data['length'] = substr($line,72,3); |
712 | 712 | //$data['beam'] = substr($line,76,2); |
713 | - $data['ident'] = trim(utf8_encode(substr($line,78,20))); |
|
713 | + $data['ident'] = trim(utf8_encode(substr($line, 78, 20))); |
|
714 | 714 | //$data['callsign'] = trim(substr($line,100,7); |
715 | - $data['arrival_code'] = substr($line,108,20); |
|
715 | + $data['arrival_code'] = substr($line, 108, 20); |
|
716 | 716 | //$data['etaDate'] = substr($line,129,5); |
717 | 717 | //$data['etaTime'] = substr($line,135,5); |
718 | 718 | $data['format_source'] = 'shipplotter'; |
@@ -743,8 +743,8 @@ discard block |
||
743 | 743 | ) { |
744 | 744 | //$buffer = $Common->getData($hosts[$id]); |
745 | 745 | $buffer = $Common->getData($value['host']); |
746 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
747 | - $buffer = explode('\n',$buffer); |
|
746 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
747 | + $buffer = explode('\n', $buffer); |
|
748 | 748 | $reset = 0; |
749 | 749 | foreach ($buffer as $line) { |
750 | 750 | if ($line != '') { |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
756 | 756 | $data['pilot_id'] = $line[1]; |
757 | 757 | $data['pilot_name'] = $line[2]; |
758 | - $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
|
758 | + $data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT); |
|
759 | 759 | $data['ident'] = $line[0]; // ident |
760 | 760 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
761 | 761 | $data['speed'] = $line[8]; // speed |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
772 | 772 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
773 | 773 | $data['departure_airport_icao'] = $line[11]; |
774 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
774 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); |
|
775 | 775 | $data['arrival_airport_icao'] = $line[13]; |
776 | 776 | $data['frequency'] = $line[4]; |
777 | 777 | $data['type'] = $line[18]; |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | $data['id_source'] = $id_source; |
781 | 781 | //$data['arrival_airport_time'] = ; |
782 | 782 | if ($line[9] != '') { |
783 | - $aircraft_data = explode('/',$line[9]); |
|
783 | + $aircraft_data = explode('/', $line[9]); |
|
784 | 784 | if (isset($aircraft_data[1])) { |
785 | 785 | $data['aircraft_icao'] = $aircraft_data[1]; |
786 | 786 | } |
@@ -795,9 +795,9 @@ discard block |
||
795 | 795 | if ($line[3] === 'PILOT') $SI->add($data); |
796 | 796 | elseif ($line[3] === 'ATC') { |
797 | 797 | //print_r($data); |
798 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
799 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
800 | - $typec = substr($data['ident'],-3); |
|
798 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
799 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
800 | + $typec = substr($data['ident'], -3); |
|
801 | 801 | if ($typec === 'APP') $data['type'] = 'Approach'; |
802 | 802 | elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
803 | 803 | elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
@@ -809,8 +809,8 @@ discard block |
||
809 | 809 | elseif ($data['type'] === '') $data['type'] = 'Observer'; |
810 | 810 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
811 | 811 | if (isset($ATC)) { |
812 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
813 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
812 | + if (count($ATC->getByIdent($data['ident'], $data['format_source'])) > 0) echo $ATC->update($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
813 | + else echo $ATC->add($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
814 | 814 | } |
815 | 815 | } |
816 | 816 | unset($data); |
@@ -826,24 +826,24 @@ discard block |
||
826 | 826 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
827 | 827 | ) |
828 | 828 | ) { |
829 | - $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
829 | + $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php', 'get', '', '', '', '', '20'); |
|
830 | 830 | if ($buffer != '') { |
831 | 831 | $all_data = simplexml_load_string($buffer); |
832 | - foreach($all_data->children() as $childdata) { |
|
832 | + foreach ($all_data->children() as $childdata) { |
|
833 | 833 | $data = array(); |
834 | 834 | $line = $childdata; |
835 | 835 | //$data['hex'] = str_pad(dechex((int)$line['pktPilotID']),6,'000000',STR_PAD_LEFT); |
836 | - $data['id'] = date('Ymd').(int)$line['pktPilotID']; |
|
837 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
|
838 | - $data['latitude'] = (float)$line['pktLatitude']; |
|
839 | - $data['longitude'] = (float)$line['pktLongitude']; |
|
840 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
841 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
842 | - $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
|
836 | + $data['id'] = date('Ymd').(int) $line['pktPilotID']; |
|
837 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['entryTime'].' BST')); |
|
838 | + $data['latitude'] = (float) $line['pktLatitude']; |
|
839 | + $data['longitude'] = (float) $line['pktLongitude']; |
|
840 | + if ((float) $line['pktTrack'] != 0) $data['heading'] = (float) $line['pktTrack']; |
|
841 | + if ((int) $line['pktSpeed'] != 0) $data['speed'] = (int) $line['pktSpeed']; |
|
842 | + $data['altitude'] = round((int) $line['pktAltitude']*3.28084); |
|
843 | 843 | $data['altitude_relative'] = 'AMSL'; |
844 | - $data['pilot_id'] = (int)$line['pktPilotID']; |
|
844 | + $data['pilot_id'] = (int) $line['pktPilotID']; |
|
845 | 845 | $data['aircraft_icao'] = 'PARAGLIDER'; |
846 | - $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
846 | + $pilot_data = explode(',', $Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
847 | 847 | if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
848 | 848 | $data['format_source'] = $value['format']; |
849 | 849 | $SI->add($data); |
@@ -851,22 +851,22 @@ discard block |
||
851 | 851 | } |
852 | 852 | } |
853 | 853 | $Source->deleteOldLocationByType('gs'); |
854 | - $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
854 | + $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php', 'get', '', '', '', '', '20'); |
|
855 | 855 | if ($buffer != '') { |
856 | 856 | $all_data = simplexml_load_string($buffer); |
857 | - foreach($all_data->children() as $childdata) { |
|
857 | + foreach ($all_data->children() as $childdata) { |
|
858 | 858 | $data = array(); |
859 | 859 | $line = $childdata; |
860 | - $data['id'] = (int)$line['gsID']; |
|
861 | - $data['latitude'] = (float)$line['gsLatitude']; |
|
862 | - $data['longitude'] = (float)$line['gsLongitude']; |
|
863 | - $data['altitude'] = round((int)$line['gsHeight']*3.28084); |
|
860 | + $data['id'] = (int) $line['gsID']; |
|
861 | + $data['latitude'] = (float) $line['gsLatitude']; |
|
862 | + $data['longitude'] = (float) $line['gsLongitude']; |
|
863 | + $data['altitude'] = round((int) $line['gsHeight']*3.28084); |
|
864 | 864 | $data['altitude_relative'] = 'AMSL'; |
865 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['gsLastUpdate'].' BST')); |
|
865 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['gsLastUpdate'].' BST')); |
|
866 | 866 | if (count($Source->getLocationInfoByLocationID($data['id'])) > 0) { |
867 | - $Source->updateLocationByLocationID('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
867 | + $Source->updateLocationByLocationID('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
868 | 868 | } else { |
869 | - $Source->addLocation('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
869 | + $Source->addLocation('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
870 | 870 | } |
871 | 871 | unset($data); |
872 | 872 | } |
@@ -884,9 +884,9 @@ discard block |
||
884 | 884 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
885 | 885 | ) |
886 | 886 | ) { |
887 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
887 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
888 | 888 | if ($buffer != '') { |
889 | - $all_data = json_decode($buffer,true); |
|
889 | + $all_data = json_decode($buffer, true); |
|
890 | 890 | if (isset($all_data['acList'])) { |
891 | 891 | $reset = 0; |
892 | 892 | foreach ($all_data['acList'] as $line) { |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
903 | 903 | $data['emergency'] = ''; // emergency |
904 | 904 | if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
905 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
905 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
906 | 906 | else $data['datetime'] = date('Y-m-d H:i:s'); |
907 | 907 | //$data['datetime'] = date('Y-m-d H:i:s'); |
908 | 908 | if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | $data['verticalrate'] = $line['vrt']; // verticale rate |
928 | 928 | $data['squawk'] = $line['squawk']; // squawk |
929 | 929 | $data['emergency'] = ''; // emergency |
930 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
930 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
931 | 931 | else $data['datetime'] = date('Y-m-d H:i:s'); |
932 | 932 | $data['format_source'] = 'aircraftlistjson'; |
933 | 933 | $data['id_source'] = $id_source; |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | ) |
949 | 949 | ) { |
950 | 950 | $buffer = $Common->getData($value['host']); |
951 | - $all_data = json_decode($buffer,true); |
|
951 | + $all_data = json_decode($buffer, true); |
|
952 | 952 | if (isset($all_data['planes'])) { |
953 | 953 | $reset = 0; |
954 | 954 | foreach ($all_data['planes'] as $key => $line) { |
@@ -965,12 +965,12 @@ discard block |
||
965 | 965 | $data['emergency'] = ''; // emergency |
966 | 966 | $data['registration'] = $line[2]; |
967 | 967 | $data['aircraft_icao'] = $line[0]; |
968 | - $deparr = explode('-',$line[1]); |
|
968 | + $deparr = explode('-', $line[1]); |
|
969 | 969 | if (count($deparr) === 2) { |
970 | 970 | $data['departure_airport_icao'] = $deparr[0]; |
971 | 971 | $data['arrival_airport_icao'] = $deparr[1]; |
972 | 972 | } |
973 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
973 | + $data['datetime'] = date('Y-m-d H:i:s', $line[9]); |
|
974 | 974 | $data['format_source'] = 'planeupdatefaa'; |
975 | 975 | $data['id_source'] = $id_source; |
976 | 976 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | ) |
989 | 989 | ) { |
990 | 990 | $buffer = $Common->getData($value['host']); |
991 | - $all_data = json_decode($buffer,true); |
|
991 | + $all_data = json_decode($buffer, true); |
|
992 | 992 | if (isset($all_data['states'])) { |
993 | 993 | $reset = 0; |
994 | 994 | foreach ($all_data['states'] as $key => $line) { |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | //$data['emergency'] = ''; // emergency |
1006 | 1006 | //$data['registration'] = $line[2]; |
1007 | 1007 | //$data['aircraft_icao'] = $line[0]; |
1008 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
1008 | + $data['datetime'] = date('Y-m-d H:i:s', $line[3]); |
|
1009 | 1009 | $data['format_source'] = 'opensky'; |
1010 | 1010 | $data['id_source'] = $id_source; |
1011 | 1011 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | ) |
1023 | 1023 | ) { |
1024 | 1024 | $buffer = $Common->getData($value['host']); |
1025 | - $all_data = json_decode($buffer,true); |
|
1025 | + $all_data = json_decode($buffer, true); |
|
1026 | 1026 | if (isset($all_data['aircraft'])) { |
1027 | 1027 | $reset = 0; |
1028 | 1028 | foreach ($all_data['aircraft'] as $key => $line) { |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | ) { |
1059 | 1059 | //$buffer = $Common->getData($hosts[$id]); |
1060 | 1060 | $buffer = $Common->getData($value['host']); |
1061 | - $all_data = json_decode($buffer,true); |
|
1061 | + $all_data = json_decode($buffer, true); |
|
1062 | 1062 | if (!empty($all_data)) $reset = 0; |
1063 | 1063 | foreach ($all_data as $key => $line) { |
1064 | 1064 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
@@ -1096,11 +1096,11 @@ discard block |
||
1096 | 1096 | ) |
1097 | 1097 | ) { |
1098 | 1098 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
1099 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
1099 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); |
|
1100 | 1100 | //echo $buffer; |
1101 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
1102 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
1103 | - $all_data = json_decode($buffer,true); |
|
1101 | + $buffer = str_replace(array("\n", "\r"), "", $buffer); |
|
1102 | + $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); |
|
1103 | + $all_data = json_decode($buffer, true); |
|
1104 | 1104 | if (json_last_error() != JSON_ERROR_NONE) { |
1105 | 1105 | die(json_last_error_msg()); |
1106 | 1106 | } |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | //$data['departure_airport_iata'] = $line[11]; |
1124 | 1124 | //$data['arrival_airport_iata'] = $line[12]; |
1125 | 1125 | //$data['emergency'] = ''; // emergency |
1126 | - $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
|
1126 | + $data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] |
|
1127 | 1127 | $data['format_source'] = 'radarvirtueljson'; |
1128 | 1128 | $data['id_source'] = $id_source; |
1129 | 1129 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1144,14 +1144,14 @@ discard block |
||
1144 | 1144 | ) { |
1145 | 1145 | //$buffer = $Common->getData($hosts[$id]); |
1146 | 1146 | $buffer = $Common->getData($value['host'].'?'.time()); |
1147 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
1147 | + $all_data = json_decode(utf8_encode($buffer), true); |
|
1148 | 1148 | |
1149 | 1149 | if (isset($all_data['pireps'])) { |
1150 | 1150 | $reset = 0; |
1151 | 1151 | foreach ($all_data['pireps'] as $line) { |
1152 | 1152 | $data = array(); |
1153 | 1153 | $data['id'] = $line['id']; |
1154 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
1154 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1155 | 1155 | $data['ident'] = $line['callsign']; // ident |
1156 | 1156 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
1157 | 1157 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
@@ -1181,9 +1181,9 @@ discard block |
||
1181 | 1181 | $SI->add($data); |
1182 | 1182 | // print_r($data); |
1183 | 1183 | } elseif ($line['icon'] === 'ct') { |
1184 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
1185 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
1186 | - $typec = substr($data['ident'],-3); |
|
1184 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
1185 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
1186 | + $typec = substr($data['ident'], -3); |
|
1187 | 1187 | $data['type'] = ''; |
1188 | 1188 | if ($typec === 'APP') $data['type'] = 'Approach'; |
1189 | 1189 | elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
@@ -1194,7 +1194,7 @@ discard block |
||
1194 | 1194 | elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
1195 | 1195 | elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
1196 | 1196 | else $data['type'] = 'Observer'; |
1197 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
1197 | + if (isset($ATC)) echo $ATC->add($data['ident'], '', $data['latitude'], $data['longitude'], '0', $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source']); |
|
1198 | 1198 | } |
1199 | 1199 | unset($data); |
1200 | 1200 | } |
@@ -1211,14 +1211,14 @@ discard block |
||
1211 | 1211 | //$buffer = $Common->getData($hosts[$id]); |
1212 | 1212 | if ($globalDebug) echo 'Get Data...'."\n"; |
1213 | 1213 | $buffer = $Common->getData($value['host']); |
1214 | - $all_data = json_decode($buffer,true); |
|
1214 | + $all_data = json_decode($buffer, true); |
|
1215 | 1215 | if ($buffer != '' && is_array($all_data)) { |
1216 | 1216 | $reset = 0; |
1217 | 1217 | foreach ($all_data as $line) { |
1218 | 1218 | $data = array(); |
1219 | 1219 | //$data['id'] = $line['id']; // id not usable |
1220 | 1220 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
1221 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1221 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1222 | 1222 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
1223 | 1223 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
1224 | 1224 | $data['ident'] = $line['flightnum']; // ident |
@@ -1233,7 +1233,7 @@ discard block |
||
1233 | 1233 | //$data['datetime'] = $line['lastupdate']; |
1234 | 1234 | //$data['last_update'] = $line['lastupdate']; |
1235 | 1235 | if (isset($value['timezone'])) { |
1236 | - $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
1236 | + $datetime = new DateTime($line['lastupdate'], new DateTimeZone($value['timezone'])); |
|
1237 | 1237 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
1238 | 1238 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1239 | 1239 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1249,14 +1249,14 @@ discard block |
||
1249 | 1249 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
1250 | 1250 | if (isset($line['aircraftname'])) { |
1251 | 1251 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
1252 | - $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
|
1253 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
1252 | + $line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); |
|
1253 | + $aircraft_data = explode('-', $line['aircraftname']); |
|
1254 | 1254 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
1255 | 1255 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
1256 | 1256 | else { |
1257 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
1258 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1259 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1257 | + $aircraft_data = explode(' ', $line['aircraftname']); |
|
1258 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]); |
|
1259 | + else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']); |
|
1260 | 1260 | } |
1261 | 1261 | } |
1262 | 1262 | if (isset($line['route'])) $data['waypoints'] = $line['route']; |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | //$buffer = $Common->getData($hosts[$id]); |
1282 | 1282 | if ($globalDebug) echo 'Get Data...'."\n"; |
1283 | 1283 | $buffer = $Common->getData($value['host']); |
1284 | - $all_data = json_decode($buffer,true); |
|
1284 | + $all_data = json_decode($buffer, true); |
|
1285 | 1285 | if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) { |
1286 | 1286 | $reset = 0; |
1287 | 1287 | foreach ($all_data['ACARSData'] as $line) { |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
1293 | 1293 | if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username']; |
1294 | 1294 | if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id']; |
1295 | - $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident |
|
1295 | + $data['ident'] = str_replace(' ', '', $line['bid']['flightnum']); // ident |
|
1296 | 1296 | if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
1297 | 1297 | $data['altitude'] = $line['altitude']; // altitude |
1298 | 1298 | $data['speed'] = $line['groundspeed']; // speed |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | //$data['squawk'] = ''; // squawk |
1304 | 1304 | //$data['emergency'] = ''; // emergency |
1305 | 1305 | if (isset($value['timezone'])) { |
1306 | - $datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone'])); |
|
1306 | + $datetime = new DateTime($line['updated_at'], new DateTimeZone($value['timezone'])); |
|
1307 | 1307 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
1308 | 1308 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1309 | 1309 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1339,14 +1339,14 @@ discard block |
||
1339 | 1339 | //$buffer = $Common->getData($hosts[$id]); |
1340 | 1340 | if ($globalDebug) echo 'Get Data...'."\n"; |
1341 | 1341 | $buffer = $Common->getData($value['host']); |
1342 | - $all_data = json_decode($buffer,true); |
|
1342 | + $all_data = json_decode($buffer, true); |
|
1343 | 1343 | if ($buffer != '' && is_array($all_data)) { |
1344 | 1344 | $reset = 0; |
1345 | 1345 | foreach ($all_data as $line) { |
1346 | 1346 | $data = array(); |
1347 | 1347 | //$data['id'] = $line['id']; // id not usable |
1348 | 1348 | $data['id'] = trim($line['flight_id']); |
1349 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1349 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1350 | 1350 | $data['pilot_name'] = $line['pilot_name']; |
1351 | 1351 | $data['pilot_id'] = $line['pilot_id']; |
1352 | 1352 | $data['ident'] = trim($line['callsign']); // ident |
@@ -1390,24 +1390,24 @@ discard block |
||
1390 | 1390 | //$buffer = $Common->getData($hosts[$id]); |
1391 | 1391 | if ($globalDebug) echo 'Get Data...'."\n"; |
1392 | 1392 | $buffer = $Common->getData($value['host']); |
1393 | - $all_data = json_decode($buffer,true); |
|
1393 | + $all_data = json_decode($buffer, true); |
|
1394 | 1394 | if ($buffer != '') { |
1395 | 1395 | $Source->deleteLocationBySource('blitzortung'); |
1396 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
1397 | - $buffer = explode('\n',$buffer); |
|
1396 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
1397 | + $buffer = explode('\n', $buffer); |
|
1398 | 1398 | foreach ($buffer as $buffer_line) { |
1399 | - $line = json_decode($buffer_line,true); |
|
1399 | + $line = json_decode($buffer_line, true); |
|
1400 | 1400 | if (isset($line['time'])) { |
1401 | 1401 | $data = array(); |
1402 | 1402 | $data['altitude'] = $line['alt']; // altitude |
1403 | 1403 | $data['latitude'] = $line['lat']; // lat |
1404 | 1404 | $data['longitude'] = $line['lon']; // long |
1405 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line['time'],0,10)); |
|
1405 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line['time'], 0, 10)); |
|
1406 | 1406 | $data['id_source'] = $id_source; |
1407 | 1407 | $data['format_source'] = 'blitzortung'; |
1408 | 1408 | $SI->add($data); |
1409 | 1409 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
1410 | - $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
|
1410 | + $Source->addLocation('', $data['latitude'], $data['longitude'], 0, '', '', 'blitzortung', 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime']); |
|
1411 | 1411 | unset($data); |
1412 | 1412 | } |
1413 | 1413 | } |
@@ -1430,11 +1430,11 @@ discard block |
||
1430 | 1430 | //$value = $formats[$nb]; |
1431 | 1431 | $format = $globalSources[$nb]['format']; |
1432 | 1432 | if ($format === 'sbs' || $format === 'aprs' || $format === 'famaprs' || $format === 'raw' || $format === 'tsv' || $format === 'acarssbs3') { |
1433 | - $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); |
|
1433 | + $buffer = @socket_read($r, 6000, PHP_NORMAL_READ); |
|
1434 | 1434 | } elseif ($format === 'vrstcp') { |
1435 | 1435 | $buffer = @socket_read($r, 6000); |
1436 | 1436 | } else { |
1437 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
1437 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); |
|
1438 | 1438 | } |
1439 | 1439 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
1440 | 1440 | //echo $buffer."\n"; |
@@ -1444,8 +1444,8 @@ discard block |
||
1444 | 1444 | //$SI::del(); |
1445 | 1445 | if ($buffer !== FALSE) { |
1446 | 1446 | if ($format === 'vrstcp') { |
1447 | - $buffer = explode('},{',$buffer); |
|
1448 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1447 | + $buffer = explode('},{', $buffer); |
|
1448 | + } else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); |
|
1449 | 1449 | } |
1450 | 1450 | // SBS format is CSV format |
1451 | 1451 | if ($buffer !== FALSE && $buffer !== '') { |
@@ -1469,7 +1469,7 @@ discard block |
||
1469 | 1469 | $ais_data = $AIS->parse_line(trim($buffer)); |
1470 | 1470 | $data = array(); |
1471 | 1471 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
1472 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
1472 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
1473 | 1473 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
1474 | 1474 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
1475 | 1475 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -1480,13 +1480,13 @@ discard block |
||
1480 | 1480 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
1481 | 1481 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
1482 | 1482 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
1483 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1483 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
1484 | 1484 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1485 | 1485 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
1486 | 1486 | if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
1487 | 1487 | |
1488 | 1488 | if (isset($ais_data['timestamp'])) { |
1489 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
1489 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
1490 | 1490 | } else { |
1491 | 1491 | $data['datetime'] = date('Y-m-d H:i:s'); |
1492 | 1492 | } |
@@ -1497,10 +1497,10 @@ discard block |
||
1497 | 1497 | } elseif ($format === 'flightgearsp') { |
1498 | 1498 | //echo $buffer."\n"; |
1499 | 1499 | if (strlen($buffer) > 5) { |
1500 | - $line = explode(',',$buffer); |
|
1500 | + $line = explode(',', $buffer); |
|
1501 | 1501 | $data = array(); |
1502 | 1502 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
1503 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); |
|
1503 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1504 | 1504 | $data['ident'] = $line[6]; |
1505 | 1505 | $data['aircraft_name'] = $line[7]; |
1506 | 1506 | $data['longitude'] = $line[1]; |
@@ -1517,16 +1517,16 @@ discard block |
||
1517 | 1517 | } elseif ($format === 'acars') { |
1518 | 1518 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
1519 | 1519 | $ACARS->add(trim($buffer)); |
1520 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
1520 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
1521 | 1521 | $ACARS->deleteLiveAcarsData(); |
1522 | 1522 | } elseif ($format === 'flightgearmp') { |
1523 | - if (substr($buffer,0,1) != '#') { |
|
1523 | + if (substr($buffer, 0, 1) != '#') { |
|
1524 | 1524 | $data = array(); |
1525 | 1525 | //echo $buffer."\n"; |
1526 | - $line = explode(' ',$buffer); |
|
1526 | + $line = explode(' ', $buffer); |
|
1527 | 1527 | if (count($line) === 11) { |
1528 | - $userserver = explode('@',$line[0]); |
|
1529 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
1528 | + $userserver = explode('@', $line[0]); |
|
1529 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex |
|
1530 | 1530 | $data['ident'] = $userserver[0]; |
1531 | 1531 | $data['registration'] = $userserver[0]; |
1532 | 1532 | $data['latitude'] = $line[4]; |
@@ -1534,8 +1534,8 @@ discard block |
||
1534 | 1534 | $data['altitude'] = $line[6]; |
1535 | 1535 | $data['datetime'] = date('Y-m-d H:i:s'); |
1536 | 1536 | $aircraft_type = $line[10]; |
1537 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
1538 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
1537 | + $aircraft_type = preg_split(':/:', $aircraft_type); |
|
1538 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); |
|
1539 | 1539 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1540 | 1540 | if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
1541 | 1541 | } |
@@ -1544,8 +1544,8 @@ discard block |
||
1544 | 1544 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
1545 | 1545 | die; |
1546 | 1546 | } elseif ($format === 'vrstcp') { |
1547 | - foreach($buffer as $all_data) { |
|
1548 | - $line = json_decode('{'.$all_data.'}',true); |
|
1547 | + foreach ($buffer as $all_data) { |
|
1548 | + $line = json_decode('{'.$all_data.'}', true); |
|
1549 | 1549 | $data = array(); |
1550 | 1550 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
1551 | 1551 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
@@ -1571,16 +1571,16 @@ discard block |
||
1571 | 1571 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
1572 | 1572 | unset($data); |
1573 | 1573 | } |
1574 | - } elseif ($format === 'tsv' || substr($buffer,0,4) === 'clock') { |
|
1574 | + } elseif ($format === 'tsv' || substr($buffer, 0, 4) === 'clock') { |
|
1575 | 1575 | $line = explode("\t", $buffer); |
1576 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
1576 | + for ($k = 0; $k < count($line); $k = $k + 2) { |
|
1577 | 1577 | $key = $line[$k]; |
1578 | - $lined[$key] = $line[$k+1]; |
|
1578 | + $lined[$key] = $line[$k + 1]; |
|
1579 | 1579 | } |
1580 | 1580 | if (count($lined) > 3) { |
1581 | 1581 | $data['hex'] = $lined['hexid']; |
1582 | 1582 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
1583 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
1583 | + $data['datetime'] = date('Y-m-d H:i:s'); ; |
|
1584 | 1584 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
1585 | 1585 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
1586 | 1586 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
@@ -1599,23 +1599,23 @@ discard block |
||
1599 | 1599 | } else $error = true; |
1600 | 1600 | } elseif ($format === 'aprs' && $use_aprs) { |
1601 | 1601 | if ($aprs_connect === 0) { |
1602 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
|
1602 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); |
|
1603 | 1603 | $aprs_connect = 1; |
1604 | 1604 | } |
1605 | 1605 | |
1606 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
1606 | + if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { |
|
1607 | 1607 | $aprs_last_tx = time(); |
1608 | 1608 | $data_aprs = "# Keep alive"; |
1609 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
1609 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
1610 | 1610 | } |
1611 | 1611 | |
1612 | 1612 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
1613 | 1613 | //echo 'APRS data : '.$buffer."\n"; |
1614 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
1615 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
1614 | + $buffer = str_replace('APRS <- ', '', $buffer); |
|
1615 | + $buffer = str_replace('APRS -> ', '', $buffer); |
|
1616 | 1616 | //echo $buffer."\n"; |
1617 | 1617 | date_default_timezone_set('UTC'); |
1618 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
1618 | + if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { |
|
1619 | 1619 | $line = $APRS->parse($buffer); |
1620 | 1620 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
1621 | 1621 | if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) { |
@@ -1630,7 +1630,7 @@ discard block |
||
1630 | 1630 | if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date']; |
1631 | 1631 | if (isset($line['typeid'])) $data['type_id'] = $line['typeid']; |
1632 | 1632 | if (isset($line['statusid'])) $data['status_id'] = $line['statusid']; |
1633 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1633 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); |
|
1634 | 1634 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1635 | 1635 | //$data['datetime'] = date('Y-m-d H:i:s'); |
1636 | 1636 | if (isset($line['ident'])) $data['ident'] = $line['ident']; |
@@ -1713,29 +1713,29 @@ discard block |
||
1713 | 1713 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
1714 | 1714 | if (!isset($data['altitude'])) $data['altitude'] = 0; |
1715 | 1715 | $Source->deleteOldLocationByType('gs'); |
1716 | - if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
|
1717 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
1716 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'gs')) > 0) { |
|
1717 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
1718 | 1718 | } else { |
1719 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
1719 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
1720 | 1720 | } |
1721 | 1721 | } elseif (isset($line['symbol']) && $line['symbol'] === 'Weather Station') { |
1722 | 1722 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
1723 | 1723 | if ($globalDebug) echo '# Weather Station added'."\n"; |
1724 | 1724 | $Source->deleteOldLocationByType('wx'); |
1725 | 1725 | $weather_data = json_encode($line); |
1726 | - if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
|
1727 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
|
1726 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'wx')) > 0) { |
|
1727 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); |
|
1728 | 1728 | } else { |
1729 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
|
1729 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); |
|
1730 | 1730 | } |
1731 | 1731 | } elseif (isset($line['symbol']) && ($line['symbol'] === 'Lightning' || $line['symbol'] === 'Thunderstorm')) { |
1732 | 1732 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
1733 | 1733 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
1734 | 1734 | $Source->deleteOldLocationByType('lightning'); |
1735 | - if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
|
1736 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
|
1735 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'lightning')) > 0) { |
|
1736 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); |
|
1737 | 1737 | } else { |
1738 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
|
1738 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); |
|
1739 | 1739 | } |
1740 | 1740 | } elseif ($globalDebug) { |
1741 | 1741 | echo '/!\ Not added: '.$buffer."\n"; |
@@ -1744,7 +1744,7 @@ discard block |
||
1744 | 1744 | unset($data); |
1745 | 1745 | } |
1746 | 1746 | elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
1747 | - $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
|
1747 | + $Source->updateLocationDescByName($line['ident'], $line['source'], $id, $line['comment']); |
|
1748 | 1748 | } |
1749 | 1749 | /* |
1750 | 1750 | elseif (is_array($line) && $globalDebug && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] === 'Car' || $line['symbol'] === 'Ambulance' || $line['symbol'] === 'Van' || $line['symbol'] === 'Truck' || $line['symbol'] === 'Truck (18 Wheeler)' || $line['symbol'] === 'Motorcycle')) { |
@@ -1753,7 +1753,7 @@ discard block |
||
1753 | 1753 | */ |
1754 | 1754 | //elseif ($line === false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
1755 | 1755 | elseif ($line === true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
1756 | - if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
|
1756 | + if (isset($globalSources[$nb]['last_weather_clean']) && time() - $globalSources[$nb]['last_weather_clean'] > 60*5) { |
|
1757 | 1757 | $Source->deleteOldLocationByType('lightning'); |
1758 | 1758 | $Source->deleteOldLocationByType('wx'); |
1759 | 1759 | $globalSources[$nb]['last_weather_clean'] = time(); |
@@ -1838,7 +1838,7 @@ discard block |
||
1838 | 1838 | connect_all($sourceee); |
1839 | 1839 | $sourceee = array(); |
1840 | 1840 | //connect_all($globalSources); |
1841 | - $tt[$format]=0; |
|
1841 | + $tt[$format] = 0; |
|
1842 | 1842 | break; |
1843 | 1843 | } |
1844 | 1844 | //else if ($globalDebug) echo "Trying again (".$tt[$format]."x) ".$format."..."; |
@@ -1848,14 +1848,14 @@ discard block |
||
1848 | 1848 | } else { |
1849 | 1849 | $error = socket_strerror(socket_last_error()); |
1850 | 1850 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
1851 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
1851 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; |
|
1852 | 1852 | if (isset($globalDebug)) echo "Restarting...\n"; |
1853 | 1853 | // Restart the script if possible |
1854 | 1854 | if (is_array($sockets)) { |
1855 | 1855 | if ($globalDebug) echo "Shutdown all sockets..."; |
1856 | 1856 | |
1857 | 1857 | foreach ($sockets as $sock) { |
1858 | - @socket_shutdown($sock,2); |
|
1858 | + @socket_shutdown($sock, 2); |
|
1859 | 1859 | @socket_close($sock); |
1860 | 1860 | } |
1861 | 1861 |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | $currentdate = date('Y-m-d'); |
35 | 35 | $sourcestat = $Stats->getStatsSource($currentdate); |
36 | 36 | if (!empty($sourcestat)) { |
37 | - foreach($sourcestat as $srcst) { |
|
37 | + foreach ($sourcestat as $srcst) { |
|
38 | 38 | $type = $srcst['stats_type']; |
39 | 39 | if ($type == 'polar' || $type == 'hist') { |
40 | 40 | $source = $srcst['source_name']; |
41 | 41 | $data = $srcst['source_data']; |
42 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
42 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | if (isset($globalGeoid) && $globalGeoid) { |
52 | 52 | try { |
53 | 53 | $GeoidClass = new GeoidHeight(); |
54 | - } catch(Exception $e) { |
|
54 | + } catch (Exception $e) { |
|
55 | 55 | if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
56 | 56 | $GeoidClass = FALSE; |
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | - public function get_Schedule($id,$ident) { |
|
61 | + public function get_Schedule($id, $ident) { |
|
62 | 62 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
63 | 63 | // Get schedule here, so it's done only one time |
64 | 64 | |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | $schedule = $Schedule->fetchSchedule($operator); |
84 | 84 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
85 | 85 | if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
86 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
87 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
86 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime'])); |
|
87 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
88 | 88 | // Should also check if route schedule = route from DB |
89 | 89 | if ($schedule['DepartureAirportIATA'] != '') { |
90 | 90 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
107 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
107 | + $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']); |
|
108 | 108 | } |
109 | 109 | } else $scheduleexist = true; |
110 | 110 | } else $scheduleexist = true; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if ($scheduleexist) { |
113 | 113 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
114 | 114 | $sch = $Schedule->getSchedule($operator); |
115 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
115 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport' => $sch['arrival_airport_icao'], 'departure_airport' => $sch['departure_airport_icao'], 'departure_airport_time' => $sch['departure_airport_time'], 'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
116 | 116 | } |
117 | 117 | $Spotter->db = null; |
118 | 118 | $Schedule->db = null; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
140 | 140 | $Spotter = new Spotter($this->db); |
141 | 141 | $real_arrival = $this->arrival($key); |
142 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
142 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $airport_time = ''; |
154 | 154 | if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
155 | 155 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
156 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
156 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
157 | 157 | if (isset($closestAirports[0])) { |
158 | 158 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
159 | 159 | $airport_icao = $closestAirports[0]['icao']; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | break; |
169 | 169 | } |
170 | 170 | } |
171 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
171 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) { |
|
172 | 172 | $airport_icao = $closestAirports[0]['icao']; |
173 | 173 | $airport_time = $this->all_flights[$key]['datetime']; |
174 | 174 | } else { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } else { |
182 | 182 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
183 | 183 | } |
184 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
184 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
193 | 193 | foreach ($this->all_flights as $key => $flight) { |
194 | 194 | if (isset($flight['lastupdate'])) { |
195 | - if ($flight['lastupdate'] < (time()-1800)) { |
|
195 | + if ($flight['lastupdate'] < (time() - 1800)) { |
|
196 | 196 | $this->delKey($key); |
197 | 197 | } |
198 | 198 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $real_arrival = $this->arrival($key); |
209 | 209 | $Spotter = new Spotter($this->db); |
210 | 210 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
211 | - $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
211 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
212 | 212 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
213 | 213 | } |
214 | 214 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $send = false; |
242 | 242 | |
243 | 243 | // SBS format is CSV format |
244 | - if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
244 | + if (is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
245 | 245 | //print_r($line); |
246 | 246 | if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
247 | 247 | if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
@@ -277,25 +277,25 @@ discard block |
||
277 | 277 | if (!isset($this->all_flights[$id])) { |
278 | 278 | if ($globalDebug) echo 'New flight...'."\n"; |
279 | 279 | $this->all_flights[$id] = array(); |
280 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
281 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
282 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
280 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
281 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'altitude_previous' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true, 'source_type' => '')); |
|
282 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
283 | 283 | if (!isset($line['id'])) { |
284 | 284 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
285 | 285 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
286 | 286 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
287 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
287 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
288 | 288 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
289 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
289 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
290 | 290 | if ($globalAllFlights !== FALSE) $dataFound = true; |
291 | 291 | } |
292 | 292 | if (isset($line['source_type']) && $line['source_type'] != '') { |
293 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
293 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_type' => $line['source_type'])); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | //print_r($this->all_flights); |
297 | 297 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
298 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
298 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => trim($line['hex']))); |
|
299 | 299 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
300 | 300 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
301 | 301 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -304,20 +304,20 @@ discard block |
||
304 | 304 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
305 | 305 | $Spotter = new Spotter($this->db); |
306 | 306 | if (isset($this->all_flights[$id]['source_type'])) { |
307 | - $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
|
307 | + $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']), $this->all_flights[$id]['source_type']); |
|
308 | 308 | } else { |
309 | 309 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
310 | 310 | } |
311 | 311 | $Spotter->db = null; |
312 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
313 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
312 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
313 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | if ($globalAllFlights !== FALSE) $dataFound = true; |
317 | 317 | if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
318 | 318 | } |
319 | 319 | if (isset($line['id']) && !isset($line['hex'])) { |
320 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
320 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => '')); |
|
321 | 321 | } |
322 | 322 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
323 | 323 | $icao = $line['aircraft_icao']; |
@@ -326,14 +326,14 @@ discard block |
||
326 | 326 | if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
327 | 327 | $Spotter->db = null; |
328 | 328 | } |
329 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
|
329 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $icao)); |
|
330 | 330 | } elseif (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_name'])) { |
331 | 331 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
332 | 332 | // Get aircraft ICAO from aircraft name |
333 | 333 | $Spotter = new Spotter($this->db); |
334 | 334 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
335 | 335 | $Spotter->db = null; |
336 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
336 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
@@ -341,15 +341,15 @@ discard block |
||
341 | 341 | elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
342 | 342 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
343 | 343 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
344 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
344 | + if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
345 | 345 | } |
346 | 346 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
347 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
347 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
348 | 348 | } |
349 | 349 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
350 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
350 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
351 | 351 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
352 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
352 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
353 | 353 | } else { |
354 | 354 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
355 | 355 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
@@ -360,31 +360,31 @@ discard block |
||
360 | 360 | */ |
361 | 361 | return ''; |
362 | 362 | } |
363 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
363 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
364 | 364 | if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
365 | 365 | return ''; |
366 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
366 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
367 | 367 | if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
368 | 368 | return ''; |
369 | 369 | } elseif (!isset($line['datetime'])) { |
370 | 370 | date_default_timezone_set('UTC'); |
371 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
371 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
372 | 372 | } else { |
373 | 373 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
374 | 374 | return ''; |
375 | 375 | } |
376 | 376 | |
377 | 377 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG' && $line['registration'] != 'NA') { |
378 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
378 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
379 | 379 | } |
380 | 380 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
381 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
381 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
382 | 382 | } |
383 | 383 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
384 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
384 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => trim($line['pilot_id']))); |
|
385 | 385 | } |
386 | 386 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
387 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
387 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => trim($line['pilot_name']))); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
@@ -392,13 +392,13 @@ discard block |
||
392 | 392 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
393 | 393 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
394 | 394 | if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
395 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
396 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
397 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
398 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
399 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
395 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
396 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
397 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
398 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
399 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
400 | 400 | } else { |
401 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
401 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
402 | 402 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
403 | 403 | $timeelapsed = microtime(true); |
404 | 404 | $Spotter = new Spotter($this->db); |
@@ -408,13 +408,13 @@ discard block |
||
408 | 408 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
409 | 409 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
410 | 410 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
411 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
411 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
412 | 412 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
413 | 413 | $Spotter->db = null; |
414 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
414 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
415 | 415 | } |
416 | 416 | } |
417 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
417 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
418 | 418 | |
419 | 419 | /* |
420 | 420 | if (!isset($line['id'])) { |
@@ -424,25 +424,25 @@ discard block |
||
424 | 424 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
425 | 425 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
426 | 426 | */ |
427 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
427 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
428 | 428 | |
429 | 429 | //$putinarchive = true; |
430 | 430 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
431 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
431 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
432 | 432 | } |
433 | 433 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
434 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
434 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
435 | 435 | } |
436 | 436 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
437 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
437 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
438 | 438 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
439 | 439 | $timeelapsed = microtime(true); |
440 | 440 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
441 | 441 | $Spotter = new Spotter($this->db); |
442 | 442 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
443 | 443 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
444 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
445 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
444 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
445 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
446 | 446 | } |
447 | 447 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
448 | 448 | $timeelapsed = microtime(true); |
@@ -456,35 +456,35 @@ discard block |
||
456 | 456 | $Translation->db = null; |
457 | 457 | } |
458 | 458 | $Spotter->db = null; |
459 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
459 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
460 | 460 | } |
461 | 461 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
462 | 462 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
463 | 463 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
464 | 464 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
465 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
465 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop'])); |
|
466 | 466 | } |
467 | 467 | } |
468 | 468 | if (!isset($globalFork)) $globalFork = TRUE; |
469 | 469 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
470 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
470 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
471 | 471 | } |
472 | 472 | } |
473 | 473 | } |
474 | 474 | |
475 | 475 | if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) { |
476 | 476 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
477 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
478 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
477 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
478 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
479 | 479 | //$dataFound = true; |
480 | 480 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
481 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
481 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
482 | 482 | if ($distance > 1000 && $distance < 10000) { |
483 | 483 | // use datetime |
484 | 484 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
485 | 485 | $speed = $speed*3.6; |
486 | 486 | if ($speed < 1000) { |
487 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
487 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
488 | 488 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
489 | 489 | } else { |
490 | 490 | if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
@@ -499,9 +499,9 @@ discard block |
||
499 | 499 | if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
500 | 500 | return false; |
501 | 501 | } |
502 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
502 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
503 | 503 | else unset($timediff); |
504 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
504 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time() - $this->all_flights[$id]['time_last_archive_coord']); |
|
505 | 505 | else unset($timediff_archive); |
506 | 506 | if ($this->tmd > 5 |
507 | 507 | || (isset($line['format_source']) |
@@ -526,14 +526,14 @@ discard block |
||
526 | 526 | || ($timediff > 30 |
527 | 527 | && isset($this->all_flights[$id]['latitude']) |
528 | 528 | && isset($this->all_flights[$id]['longitude']) |
529 | - && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
529 | + && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')) |
|
530 | 530 | ) |
531 | 531 | ) { |
532 | 532 | |
533 | 533 | if ((isset($timediff) && !isset($timediff_archive)) || (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude']))) { |
534 | 534 | if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
535 | 535 | || (isset($line['format_source']) && $line['format_source'] == 'airwhere') |
536 | - || !$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
536 | + || !$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
537 | 537 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
538 | 538 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
539 | 539 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -543,11 +543,11 @@ discard block |
||
543 | 543 | $timeelapsed = microtime(true); |
544 | 544 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
545 | 545 | $Spotter = new Spotter($this->db); |
546 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
546 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
547 | 547 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
548 | 548 | else $this->all_flights[$id]['over_country'] = ''; |
549 | 549 | $Spotter->db = null; |
550 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
550 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
551 | 551 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
552 | 552 | } |
553 | 553 | } |
@@ -573,13 +573,13 @@ discard block |
||
573 | 573 | $this->all_flights[$id]['time_last_coord'] = time(); |
574 | 574 | } |
575 | 575 | //if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
576 | - if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
|
576 | + if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > 0.0001)) { |
|
577 | 577 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
578 | 578 | $dataFound = true; |
579 | 579 | $this->all_flights[$id]['time_last_coord'] = time(); |
580 | 580 | } |
581 | 581 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
582 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
582 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
583 | 583 | /* |
584 | 584 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
585 | 585 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -601,13 +601,13 @@ discard block |
||
601 | 601 | $this->all_flights[$id]['time_last_coord'] = time(); |
602 | 602 | } |
603 | 603 | //if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
604 | - if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
|
604 | + if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > 0.0001)) { |
|
605 | 605 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
606 | 606 | $dataFound = true; |
607 | 607 | $this->all_flights[$id]['time_last_coord'] = time(); |
608 | 608 | } |
609 | 609 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
610 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
610 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
611 | 611 | /* |
612 | 612 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
613 | 613 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -625,46 +625,46 @@ discard block |
||
625 | 625 | } else if ($globalDebug && $timediff > 30) { |
626 | 626 | $this->tmd = $this->tmd + 1; |
627 | 627 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
628 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
629 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
628 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
629 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
630 | 630 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
631 | 631 | } |
632 | 632 | } |
633 | 633 | if (isset($line['last_update']) && $line['last_update'] != '') { |
634 | 634 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
635 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
635 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
636 | 636 | } |
637 | 637 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
638 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
638 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
639 | 639 | //$dataFound = true; |
640 | 640 | } |
641 | 641 | if (isset($line['format_source']) && $line['format_source'] != '') { |
642 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
642 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
643 | 643 | } |
644 | 644 | if (isset($line['source_name']) && $line['source_name'] != '') { |
645 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
645 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
646 | 646 | } |
647 | 647 | if (isset($line['emergency']) && $line['emergency'] != '') { |
648 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
648 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
649 | 649 | //$dataFound = true; |
650 | 650 | } |
651 | 651 | if (isset($line['ground']) && $line['ground'] != '') { |
652 | 652 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
653 | 653 | // Here we force archive of flight because after ground it's a new one (or should be) |
654 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
655 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
656 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
657 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
658 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
654 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
655 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
656 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
657 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
658 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
659 | 659 | } |
660 | 660 | if ($line['ground'] != 1) $line['ground'] = 0; |
661 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
661 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
662 | 662 | //$dataFound = true; |
663 | 663 | } |
664 | 664 | if (isset($line['squawk']) && $line['squawk'] != '') { |
665 | 665 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
666 | 666 | if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
667 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
667 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
668 | 668 | $highlight = ''; |
669 | 669 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
670 | 670 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -673,66 +673,66 @@ discard block |
||
673 | 673 | $timeelapsed = microtime(true); |
674 | 674 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
675 | 675 | $Spotter = new Spotter($this->db); |
676 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
676 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
677 | 677 | $Spotter->db = null; |
678 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
678 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
679 | 679 | } |
680 | 680 | //$putinarchive = true; |
681 | 681 | //$highlight = ''; |
682 | 682 | } |
683 | 683 | |
684 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
684 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
685 | 685 | //$dataFound = true; |
686 | 686 | } |
687 | 687 | |
688 | 688 | if (isset($line['altitude']) && $line['altitude'] != '') { |
689 | 689 | if (isset($line['altitude_relative']) && isset($GeoidClass) && is_object($GeoidClass)) { |
690 | 690 | if ($line['altitude_relative'] == 'AMSL' || $line['altitude_relative'] == 'MSL') { |
691 | - $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'])*3.28084,2); |
|
691 | + $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'])*3.28084, 2); |
|
692 | 692 | //if ($globalDebug) echo '=> Set altitude to WGS84 Ellipsoid, add '.$geoid.' to '.$line['altitude']."\n"; |
693 | 693 | $line['altitude'] = $line['altitude'] - $geoid; |
694 | 694 | } |
695 | 695 | } |
696 | 696 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
697 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
698 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
699 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
697 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
698 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
699 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
700 | 700 | //$dataFound = true; |
701 | 701 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
702 | 702 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
703 | 703 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
704 | 704 | if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
705 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
706 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
707 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
708 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
709 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
705 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
706 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
707 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
708 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
709 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
710 | 710 | } |
711 | 711 | } |
712 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
712 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_previous' => $line['altitude'])); |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
716 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
716 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | if (isset($line['heading']) && $line['heading'] != '') { |
720 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
721 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
722 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
720 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
721 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
722 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
723 | 723 | //$dataFound = true; |
724 | 724 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
725 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
726 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
727 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
725 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
726 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
727 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
728 | 728 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
729 | 729 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
730 | 730 | // If not enough messages and ACARS set heading to 0 |
731 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
731 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
732 | 732 | } |
733 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
734 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
735 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
733 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
734 | + elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
735 | + elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
736 | 736 | |
737 | 737 | // print_r($this->all_flights[$id]); |
738 | 738 | //gets the callsign from the last hour |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
744 | 744 | $this->all_flights[$id]['lastupdate'] = time(); |
745 | 745 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
746 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
746 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
747 | 747 | //print_r($this->all_flights); |
748 | 748 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
749 | 749 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -754,61 +754,61 @@ discard block |
||
754 | 754 | $SpotterLive = new SpotterLive($this->db); |
755 | 755 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
756 | 756 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
757 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
757 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
758 | 758 | } elseif (isset($line['id'])) { |
759 | 759 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
760 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
760 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
761 | 761 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
762 | 762 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
763 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
763 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
764 | 764 | } else $recent_ident = ''; |
765 | - $SpotterLive->db=null; |
|
765 | + $SpotterLive->db = null; |
|
766 | 766 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
767 | 767 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
768 | 768 | } else $recent_ident = ''; |
769 | 769 | } else { |
770 | 770 | $recent_ident = ''; |
771 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
771 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
772 | 772 | } |
773 | 773 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
774 | - if($recent_ident == "") |
|
774 | + if ($recent_ident == "") |
|
775 | 775 | { |
776 | 776 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
777 | 777 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
778 | 778 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
779 | 779 | //adds the spotter data for the archive |
780 | 780 | $ignoreImport = false; |
781 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
781 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
782 | 782 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
783 | 783 | $ignoreImport = true; |
784 | 784 | } |
785 | 785 | } |
786 | 786 | if (count($globalAirportAccept) > 0) { |
787 | 787 | $ignoreImport = true; |
788 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
788 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
789 | 789 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
790 | 790 | $ignoreImport = false; |
791 | 791 | } |
792 | 792 | } |
793 | 793 | } |
794 | 794 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
795 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
796 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
795 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
796 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
797 | 797 | $ignoreImport = true; |
798 | 798 | } |
799 | 799 | } |
800 | 800 | } |
801 | 801 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
802 | 802 | $ignoreImport = true; |
803 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
804 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
803 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
804 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
805 | 805 | $ignoreImport = false; |
806 | 806 | } |
807 | 807 | } |
808 | 808 | } |
809 | 809 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
810 | 810 | $ignoreImport = true; |
811 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
811 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
812 | 812 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
813 | 813 | $ignoreImport = false; |
814 | 814 | } |
@@ -820,32 +820,32 @@ discard block |
||
820 | 820 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
821 | 821 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
822 | 822 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
823 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
823 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
824 | 824 | $timeelapsed = microtime(true); |
825 | 825 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
826 | 826 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
827 | 827 | $Spotter = new Spotter($this->db); |
828 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
828 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['source_type']); |
|
829 | 829 | $Spotter->db = null; |
830 | 830 | if ($globalDebug && isset($result)) echo $result."\n"; |
831 | 831 | } |
832 | 832 | } |
833 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
833 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
834 | 834 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
835 | 835 | |
836 | 836 | // Add source stat in DB |
837 | 837 | $Stats = new Stats($this->db); |
838 | 838 | if (!empty($this->stats)) { |
839 | 839 | if ($globalDebug) echo 'Add source stats : '; |
840 | - foreach($this->stats as $date => $data) { |
|
841 | - foreach($data as $source => $sourced) { |
|
840 | + foreach ($this->stats as $date => $data) { |
|
841 | + foreach ($data as $source => $sourced) { |
|
842 | 842 | //print_r($sourced); |
843 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
844 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
843 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
844 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
845 | 845 | if (isset($sourced['msg'])) { |
846 | 846 | if (time() - $sourced['msg']['date'] > 10) { |
847 | 847 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
848 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
848 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
849 | 849 | unset($this->stats[$date][$source]['msg']); |
850 | 850 | } |
851 | 851 | } |
@@ -883,14 +883,14 @@ discard block |
||
883 | 883 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
884 | 884 | $SpotterLive = new SpotterLive($this->db); |
885 | 885 | $SpotterLive->deleteLiveSpotterData(); |
886 | - $SpotterLive->db=null; |
|
886 | + $SpotterLive->db = null; |
|
887 | 887 | } |
888 | 888 | } |
889 | 889 | if ($globalDebug) echo " Done\n"; |
890 | 890 | $this->last_delete = time(); |
891 | 891 | } |
892 | 892 | } else { |
893 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
893 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
894 | 894 | $this->all_flights[$id]['id'] = $recent_ident; |
895 | 895 | $this->all_flights[$id]['addedSpotter'] = 1; |
896 | 896 | } |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
899 | 899 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
900 | 900 | $Spotter = new Spotter($this->db); |
901 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
901 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']); |
|
902 | 902 | $Spotter->db = null; |
903 | 903 | } |
904 | 904 | } |
@@ -924,37 +924,37 @@ discard block |
||
924 | 924 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
925 | 925 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
926 | 926 | |
927 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
927 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
928 | 928 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
929 | 929 | $ignoreImport = true; |
930 | 930 | } |
931 | 931 | } |
932 | 932 | if (count($globalAirportAccept) > 0) { |
933 | 933 | $ignoreImport = true; |
934 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
934 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
935 | 935 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
936 | 936 | $ignoreImport = false; |
937 | 937 | } |
938 | 938 | } |
939 | 939 | } |
940 | 940 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
941 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
942 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
941 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
942 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
943 | 943 | $ignoreImport = true; |
944 | 944 | } |
945 | 945 | } |
946 | 946 | } |
947 | 947 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
948 | 948 | $ignoreImport = true; |
949 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
950 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
949 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
950 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
951 | 951 | $ignoreImport = false; |
952 | 952 | } |
953 | 953 | } |
954 | 954 | } |
955 | 955 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
956 | 956 | $ignoreImport = true; |
957 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
957 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
958 | 958 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
959 | 959 | $ignoreImport = false; |
960 | 960 | } |
@@ -962,23 +962,23 @@ discard block |
||
962 | 962 | } |
963 | 963 | |
964 | 964 | if (!$ignoreImport) { |
965 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
966 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
965 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
966 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
967 | 967 | $timeelapsed = microtime(true); |
968 | 968 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
969 | 969 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
970 | 970 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
971 | 971 | $SpotterLive = new SpotterLive($this->db); |
972 | - $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
972 | + $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
973 | 973 | $SpotterLive->db = null; |
974 | 974 | if ($globalDebug) echo $result."\n"; |
975 | 975 | } |
976 | 976 | } |
977 | 977 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
978 | - $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
978 | + $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
979 | 979 | } |
980 | 980 | $this->all_flights[$id]['putinarchive'] = false; |
981 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
981 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
982 | 982 | |
983 | 983 | // Put statistics in $this->stats variable |
984 | 984 | //if ($line['format_source'] != 'aprs') { |
@@ -997,19 +997,19 @@ discard block |
||
997 | 997 | $latitude = $globalCenterLatitude; |
998 | 998 | $longitude = $globalCenterLongitude; |
999 | 999 | } |
1000 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
1000 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
1001 | 1001 | } else { |
1002 | 1002 | $latitude = $this->source_location[$source]['latitude']; |
1003 | 1003 | $longitude = $this->source_location[$source]['longitude']; |
1004 | 1004 | } |
1005 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
1005 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
1006 | 1006 | //$stats_heading = $stats_heading%22.5; |
1007 | 1007 | $stats_heading = round($stats_heading/22.5); |
1008 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
1008 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
1009 | 1009 | $current_date = date('Y-m-d'); |
1010 | 1010 | if ($stats_heading == 16) $stats_heading = 0; |
1011 | 1011 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
1012 | - for ($i=0;$i<=15;$i++) { |
|
1012 | + for ($i = 0; $i <= 15; $i++) { |
|
1013 | 1013 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
1014 | 1014 | } |
1015 | 1015 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -1024,9 +1024,9 @@ discard block |
||
1024 | 1024 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
1025 | 1025 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
1026 | 1026 | end($this->stats[$current_date][$source]['hist']); |
1027 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
1027 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
1028 | 1028 | } else $mini = 0; |
1029 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
1029 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
1030 | 1030 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
1031 | 1031 | } |
1032 | 1032 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | $this->all_flights[$id]['lastupdate'] = time(); |
1040 | 1040 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
1041 | 1041 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
1042 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
1042 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
1043 | 1043 | //$this->del(); |
1044 | 1044 | |
1045 | 1045 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
@@ -117,31 +117,31 @@ discard block |
||
117 | 117 | |
118 | 118 | private function make_latf($temp) { // unsigned long |
119 | 119 | $flat = 0.0; // float |
120 | - $temp = $temp & 0x07FFFFFF; |
|
121 | - if ($temp & 0x04000000) { |
|
122 | - $temp = $temp ^ 0x07FFFFFF; |
|
120 | + $temp = $temp&0x07FFFFFF; |
|
121 | + if ($temp&0x04000000) { |
|
122 | + $temp = $temp^0x07FFFFFF; |
|
123 | 123 | $temp += 1; |
124 | - $flat = (float)($temp / (60.0 * 10000.0)); |
|
124 | + $flat = (float) ($temp/(60.0*10000.0)); |
|
125 | 125 | $flat *= -1.0; |
126 | - } else $flat = (float)($temp / (60.0 * 10000.0)); |
|
126 | + } else $flat = (float) ($temp/(60.0*10000.0)); |
|
127 | 127 | return $flat; // float |
128 | 128 | } |
129 | 129 | |
130 | 130 | private function make_lonf($temp) { // unsigned long |
131 | 131 | $flon = 0.0; // float |
132 | - $temp = $temp & 0x0FFFFFFF; |
|
133 | - if ($temp & 0x08000000) { |
|
134 | - $temp = $temp ^ 0x0FFFFFFF; |
|
132 | + $temp = $temp&0x0FFFFFFF; |
|
133 | + if ($temp&0x08000000) { |
|
134 | + $temp = $temp^0x0FFFFFFF; |
|
135 | 135 | $temp += 1; |
136 | - $flon = (float)($temp / (60.0 * 10000.0)); |
|
136 | + $flon = (float) ($temp/(60.0*10000.0)); |
|
137 | 137 | $flon *= -1.0; |
138 | - } else $flon = (float)($temp / (60.0 * 10000.0)); |
|
138 | + } else $flon = (float) ($temp/(60.0*10000.0)); |
|
139 | 139 | return $flon; |
140 | 140 | } |
141 | 141 | |
142 | 142 | private function ascii_2_dec($chr) { |
143 | - $dec=ord($chr);//get decimal ascii code |
|
144 | - $hex=dechex($dec);//convert decimal to hex |
|
143 | + $dec = ord($chr); //get decimal ascii code |
|
144 | + $hex = dechex($dec); //convert decimal to hex |
|
145 | 145 | return ($dec); |
146 | 146 | } |
147 | 147 | |
@@ -160,15 +160,15 @@ discard block |
||
160 | 160 | //only process in the following range: 48-87, 96-119 |
161 | 161 | if ($ascii < 48) { } |
162 | 162 | else { |
163 | - if($ascii>119) { } |
|
163 | + if ($ascii > 119) { } |
|
164 | 164 | else { |
165 | - if ($ascii>87 && $ascii<96) ; |
|
165 | + if ($ascii > 87 && $ascii < 96); |
|
166 | 166 | else { |
167 | - $ascii=$ascii+40; |
|
168 | - if ($ascii>128){ |
|
169 | - $ascii=$ascii+32; |
|
167 | + $ascii = $ascii + 40; |
|
168 | + if ($ascii > 128) { |
|
169 | + $ascii = $ascii + 32; |
|
170 | 170 | } else { |
171 | - $ascii=$ascii+40; |
|
171 | + $ascii = $ascii + 40; |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | private function dec_2_6bit($dec) { |
180 | - $bin=decbin($dec); |
|
180 | + $bin = decbin($dec); |
|
181 | 181 | return(substr($bin, -6)); |
182 | 182 | } |
183 | 183 | |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | ); |
196 | 196 | // " |
197 | 197 | $rv = ''; |
198 | - if ($_size % 6 == 0) { |
|
199 | - $len = $_size / 6; |
|
200 | - for ($i=0; $i<$len; $i++) { |
|
201 | - $offset = $i * 6; |
|
202 | - $rv .= $ais_chars[ bindec(substr($_str,$_start + $offset,6)) ]; |
|
198 | + if ($_size%6 == 0) { |
|
199 | + $len = $_size/6; |
|
200 | + for ($i = 0; $i < $len; $i++) { |
|
201 | + $offset = $i*6; |
|
202 | + $rv .= $ais_chars[bindec(substr($_str, $_start + $offset, 6))]; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | return $rv; |
@@ -226,93 +226,93 @@ discard block |
||
226 | 226 | $ro->eta_hour = ''; |
227 | 227 | $ro->eta_minute = ''; |
228 | 228 | $ro->ts = time(); |
229 | - $ro->id = bindec(substr($_aisdata,0,6)); |
|
230 | - $ro->mmsi = bindec(substr($_aisdata,8,30)); |
|
229 | + $ro->id = bindec(substr($_aisdata, 0, 6)); |
|
230 | + $ro->mmsi = bindec(substr($_aisdata, 8, 30)); |
|
231 | 231 | if ($ro->id >= 1 && $ro->id <= 3) { |
232 | - $ro->cog = bindec(substr($_aisdata,116,12))/10; |
|
233 | - $ro->sog = bindec(substr($_aisdata,50,10))/10; |
|
234 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,61,28))); |
|
235 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,89,27))); |
|
232 | + $ro->cog = bindec(substr($_aisdata, 116, 12))/10; |
|
233 | + $ro->sog = bindec(substr($_aisdata, 50, 10))/10; |
|
234 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 61, 28))); |
|
235 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 89, 27))); |
|
236 | 236 | $ro->cls = 1; // class A |
237 | 237 | } else if ($ro->id == 4) { |
238 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,79,28))); |
|
239 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,107,27))); |
|
238 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 79, 28))); |
|
239 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 107, 27))); |
|
240 | 240 | $ro->cls = 1; // class A |
241 | 241 | } else if ($ro->id == 5) { |
242 | - $ro->imo = bindec(substr($_aisdata,40,30)); |
|
243 | - $ro->callsign = $this->binchar($_aisdata,70,42); |
|
244 | - $ro->name = $this->binchar($_aisdata,112,120); |
|
245 | - $ro->typeid = bindec(substr($_aisdata,232,8)); |
|
242 | + $ro->imo = bindec(substr($_aisdata, 40, 30)); |
|
243 | + $ro->callsign = $this->binchar($_aisdata, 70, 42); |
|
244 | + $ro->name = $this->binchar($_aisdata, 112, 120); |
|
245 | + $ro->typeid = bindec(substr($_aisdata, 232, 8)); |
|
246 | 246 | $ro->type = $this->getShipType($ro->typeid); |
247 | 247 | //$ro->to_bow = bindec(substr($_aisdata,240,9)); |
248 | 248 | //$ro->to_stern = bindec(substr($_aisdata,249,9)); |
249 | 249 | //$ro->to_port = bindec(substr($_aisdata,258,6)); |
250 | 250 | //$ro->to_starboard = bindec(substr($_aisdata,264,6)); |
251 | - $ro->eta_month = bindec(substr($_aisdata,274,4)); |
|
252 | - $ro->eta_day = bindec(substr($_aisdata,278,5)); |
|
253 | - $ro->eta_hour = bindec(substr($_aisdata,283,5)); |
|
254 | - $ro->eta_minute = bindec(substr($_aisdata,288,6)); |
|
251 | + $ro->eta_month = bindec(substr($_aisdata, 274, 4)); |
|
252 | + $ro->eta_day = bindec(substr($_aisdata, 278, 5)); |
|
253 | + $ro->eta_hour = bindec(substr($_aisdata, 283, 5)); |
|
254 | + $ro->eta_minute = bindec(substr($_aisdata, 288, 6)); |
|
255 | 255 | //$ro->draught = bindec(substr($_aisdata,294,8)); |
256 | - $ro->destination = $this->binchar($_aisdata,302,120); |
|
256 | + $ro->destination = $this->binchar($_aisdata, 302, 120); |
|
257 | 257 | $ro->cls = 1; // class A |
258 | 258 | } else if ($ro->id == 9) { |
259 | 259 | // Search and Rescue aircraft position report |
260 | 260 | } else if ($ro->id == 18) { |
261 | - $ro->cog = bindec(substr($_aisdata,112,12))/10; |
|
262 | - $ro->sog = bindec(substr($_aisdata,46,10))/10; |
|
263 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,57,28))); |
|
264 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,85,27))); |
|
265 | - $ro->heading = bindec(substr($_aisdata,124,9)); |
|
261 | + $ro->cog = bindec(substr($_aisdata, 112, 12))/10; |
|
262 | + $ro->sog = bindec(substr($_aisdata, 46, 10))/10; |
|
263 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 57, 28))); |
|
264 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 85, 27))); |
|
265 | + $ro->heading = bindec(substr($_aisdata, 124, 9)); |
|
266 | 266 | if ($ro->heading == 511) $ro->heading = ''; |
267 | 267 | $ro->cls = 2; // class B |
268 | 268 | } else if ($ro->id == 19) { |
269 | - $ro->cog = bindec(substr($_aisdata,112,12))/10; |
|
270 | - $ro->sog = bindec(substr($_aisdata,46,10))/10; |
|
271 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,61,28))); |
|
272 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,89,27))); |
|
273 | - $ro->name = $this->binchar($_aisdata,143,120); |
|
269 | + $ro->cog = bindec(substr($_aisdata, 112, 12))/10; |
|
270 | + $ro->sog = bindec(substr($_aisdata, 46, 10))/10; |
|
271 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 61, 28))); |
|
272 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 89, 27))); |
|
273 | + $ro->name = $this->binchar($_aisdata, 143, 120); |
|
274 | 274 | $ro->cls = 2; // class B |
275 | - $ro->heading = bindec(substr($_aisdata,124,9)); |
|
275 | + $ro->heading = bindec(substr($_aisdata, 124, 9)); |
|
276 | 276 | if ($ro->heading == 511) $ro->heading = ''; |
277 | - $ro->typeid = bindec(substr($_aisdata,263,8)); |
|
277 | + $ro->typeid = bindec(substr($_aisdata, 263, 8)); |
|
278 | 278 | $ro->type = $this->getShipType($ro->typeid); |
279 | 279 | //$ro->to_bow = bindec(substr($_aisdata,271,9)); |
280 | 280 | //$ro->to_stern = bindec(substr($_aisdata,280,9)); |
281 | 281 | //$ro->to_port = bindec(substr($_aisdata,289,6)); |
282 | 282 | //$ro->to_starboard = bindec(substr($_aisdata,295,6)); |
283 | 283 | } else if ($ro->id == 21) { |
284 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,164,28))); |
|
285 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,192,27))); |
|
286 | - $ro->name = $this->binchar($_aisdata,43,120); |
|
284 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 164, 28))); |
|
285 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 192, 27))); |
|
286 | + $ro->name = $this->binchar($_aisdata, 43, 120); |
|
287 | 287 | //$ro->to_bow = bindec(substr($_aisdata,219,9)); |
288 | 288 | //$ro->to_stern = bindec(substr($_aisdata,228,9)); |
289 | 289 | //$ro->to_port = bindec(substr($_aisdata,237,6)); |
290 | 290 | //$ro->to_starboard = bindec(substr($_aisdata,243,6)); |
291 | 291 | $ro->cls = 2; // class B |
292 | 292 | } else if ($ro->id == 24) { |
293 | - $pn = bindec(substr($_aisdata,38,2)); |
|
293 | + $pn = bindec(substr($_aisdata, 38, 2)); |
|
294 | 294 | if ($pn == 0) { |
295 | - $ro->name = $this->binchar($_aisdata,40,120); |
|
295 | + $ro->name = $this->binchar($_aisdata, 40, 120); |
|
296 | 296 | } |
297 | - $ro->typeid = bindec(substr($_aisdata,40,8)); |
|
297 | + $ro->typeid = bindec(substr($_aisdata, 40, 8)); |
|
298 | 298 | $ro->type = $this->getShipType($ro->typeid); |
299 | - $ro->callsign = $this->binchar($_aisdata,90,42); |
|
299 | + $ro->callsign = $this->binchar($_aisdata, 90, 42); |
|
300 | 300 | //$ro->to_bow = bindec(substr($_aisdata,132,9)); |
301 | 301 | //$ro->to_stern = bindec(substr($_aisdata,141,9)); |
302 | 302 | //$ro->to_port = bindec(substr($_aisdata,150,6)); |
303 | 303 | //$ro->to_starboard = bindec(substr($_aisdata,156,6)); |
304 | 304 | $ro->cls = 2; // class B |
305 | 305 | } else if ($ro->id == 27) { |
306 | - $ro->cog = bindec(substr($_aisdata,85,9)); |
|
306 | + $ro->cog = bindec(substr($_aisdata, 85, 9)); |
|
307 | 307 | if ($ro->cog == 511) $ro->cog = 0.0; |
308 | - $ro->sog = bindec(substr($_aisdata,79,6)); |
|
308 | + $ro->sog = bindec(substr($_aisdata, 79, 6)); |
|
309 | 309 | if ($ro->sog == 63) $ro->sog = 0.0; |
310 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,44,18))*10); |
|
311 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,62,17))*10); |
|
310 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 44, 18))*10); |
|
311 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 62, 17))*10); |
|
312 | 312 | $ro->cls = 1; // class A |
313 | 313 | |
314 | 314 | } |
315 | - $ro->statusid = bindec(substr($_aisdata,38,4)); |
|
315 | + $ro->statusid = bindec(substr($_aisdata, 38, 4)); |
|
316 | 316 | $ro->status = $this->getStatus($ro->statusid); |
317 | 317 | return $ro; |
318 | 318 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | } |
360 | 360 | |
361 | 361 | public function getShipTypeID($type) { |
362 | - $typeid = array_search($type,$this->shiptype); |
|
362 | + $typeid = array_search($type, $this->shiptype); |
|
363 | 363 | if ($typeid !== FALSE) return $typeid; |
364 | 364 | elseif ($type == 'Cargo' || $type == 'General Cargo' || $type == 'Bulk Carrier' || $type == 'Container Ship' || $type == 'Cargo A' || $type == 'Reefer' || $type == 'Vehicles Carrier' || $type == 'Ro-Ro Cargo') return 70; |
365 | 365 | elseif ($type == 'Passengers Ship' || $type == 'Passenger' || $type == 'Ro-Ro/Passenger Ship' || $type == 'Motor Passenger') return 60; |
@@ -381,14 +381,14 @@ discard block |
||
381 | 381 | public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) { |
382 | 382 | global $port; // tcpip port... |
383 | 383 | static $debug_counter = 0; |
384 | - $aisdata168='';//six bit array of ascii characters |
|
384 | + $aisdata168 = ''; //six bit array of ascii characters |
|
385 | 385 | $ais_nmea_array = str_split($_itu); // convert to an array |
386 | 386 | foreach ($ais_nmea_array as $value) { |
387 | 387 | $dec = $this->ascii_2_dec($value); |
388 | 388 | $bit8 = $this->asciidec_2_8bit($dec); |
389 | 389 | $bit6 = $this->dec_2_6bit($bit8); |
390 | 390 | //echo $value ."-" .$bit6 .""; |
391 | - $aisdata168 .=$bit6; |
|
391 | + $aisdata168 .= $bit6; |
|
392 | 392 | } |
393 | 393 | //echo $aisdata168 . "<br/>"; |
394 | 394 | //return $this->decode_ais($aisdata168, $aux); |
@@ -411,24 +411,24 @@ discard block |
||
411 | 411 | // calculate checksum after ! till * |
412 | 412 | // assume 1st ! is valid |
413 | 413 | // find * ensure that it is at correct position |
414 | - $end = strrpos ( $rawdata , '*' ); |
|
414 | + $end = strrpos($rawdata, '*'); |
|
415 | 415 | if ($end === FALSE) return -1; // check for NULLS!!! |
416 | - $cs = substr( $rawdata, $end + 1 ); |
|
417 | - if ( strlen($cs) != 2 ) return -1; // correct cs length |
|
418 | - $dcs = (int)hexdec( $cs ); |
|
419 | - for ( $alias=1; $alias<$end; $alias++) $chksum ^= ord( $rawdata[$alias] ); // perform XOR for NMEA checksum |
|
420 | - if ( $chksum == $dcs ) { // NMEA checksum pass |
|
416 | + $cs = substr($rawdata, $end + 1); |
|
417 | + if (strlen($cs) != 2) return -1; // correct cs length |
|
418 | + $dcs = (int) hexdec($cs); |
|
419 | + for ($alias = 1; $alias < $end; $alias++) $chksum ^= ord($rawdata[$alias]); // perform XOR for NMEA checksum |
|
420 | + if ($chksum == $dcs) { // NMEA checksum pass |
|
421 | 421 | $pcs = explode(',', $rawdata); |
422 | 422 | // !AI??? identifier |
423 | 423 | if (!isset($pcs[1])) { |
424 | 424 | echo "ERROR,INVALID_DATA ".time()." $rawdata\n"; |
425 | 425 | return -1; |
426 | 426 | } |
427 | - $num_seq = (int)$pcs[1]; // number of sequences |
|
428 | - $seq = (int)$pcs[2]; // get sequence |
|
427 | + $num_seq = (int) $pcs[1]; // number of sequences |
|
428 | + $seq = (int) $pcs[2]; // get sequence |
|
429 | 429 | // get msg sequence id |
430 | 430 | if ($pcs[3] == '') $msg_sid = -1; // non-multipart message, set to -1 |
431 | - else $msg_sid = (int)$pcs[3]; // multipart message |
|
431 | + else $msg_sid = (int) $pcs[3]; // multipart message |
|
432 | 432 | $ais_ch = $pcs[4]; // get AIS channel |
433 | 433 | // message sequence checking |
434 | 434 | if ($num_seq < 1 || $num_seq > 9) { |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | } |
462 | 462 | } |
463 | 463 | $itu = $itu.$pcs[5]; // get itu message |
464 | - $filler += (int)$pcs[6][0]; // get filler |
|
464 | + $filler += (int) $pcs[6][0]; // get filler |
|
465 | 465 | if ($num_seq == 1 // valid single message |
466 | 466 | || $num_seq == $pseq // valid multi-part message |
467 | 467 | ) { |
@@ -483,13 +483,13 @@ discard block |
||
483 | 483 | $cbuf = $cbuf.$ibuf; |
484 | 484 | $last_pos = 0; |
485 | 485 | $result = new stdClass(); |
486 | - while ( ($start = strpos($cbuf,"VDM",$last_pos)) !== FALSE) { |
|
486 | + while (($start = strpos($cbuf, "VDM", $last_pos)) !== FALSE) { |
|
487 | 487 | //while ( ($start = strpos($cbuf,"!AI",$last_pos)) !== FALSE) { |
488 | 488 | //DEBUG echo $cbuf; |
489 | - if ( ($end = strpos($cbuf,"\r\n", $start)) !== FALSE) { //TBD need to trim? |
|
489 | + if (($end = strpos($cbuf, "\r\n", $start)) !== FALSE) { //TBD need to trim? |
|
490 | 490 | $tst = substr($cbuf, $start - 3, ($end - $start + 3)); |
491 | 491 | //DEBUG echo "[$start $end $tst]\n"; |
492 | - $result = $this->process_ais_raw( $tst, "" ); |
|
492 | + $result = $this->process_ais_raw($tst, ""); |
|
493 | 493 | $last_pos = $end + 1; |
494 | 494 | } else break; |
495 | 495 | } |
@@ -501,41 +501,41 @@ discard block |
||
501 | 501 | // incoming data from serial or IP comms |
502 | 502 | public function process_ais_line($cbuf) { |
503 | 503 | $result = new stdClass(); |
504 | - $start = strpos($cbuf,"VDM"); |
|
504 | + $start = strpos($cbuf, "VDM"); |
|
505 | 505 | $tst = substr($cbuf, $start - 3); |
506 | - $result = $this->process_ais_raw( $tst, "" ); |
|
506 | + $result = $this->process_ais_raw($tst, ""); |
|
507 | 507 | return $result; |
508 | 508 | } |
509 | 509 | |
510 | 510 | /* AIS Encoding |
511 | 511 | */ |
512 | - private function mk_ais_lat( $lat ) { |
|
512 | + private function mk_ais_lat($lat) { |
|
513 | 513 | //$lat = 1.2569; |
514 | - if ($lat<0.0) { |
|
514 | + if ($lat < 0.0) { |
|
515 | 515 | $lat = -$lat; |
516 | - $neg=true; |
|
517 | - } else $neg=false; |
|
516 | + $neg = true; |
|
517 | + } else $neg = false; |
|
518 | 518 | $latd = 0x00000000; |
519 | - $latd = intval ($lat * 600000.0); |
|
520 | - if ($neg==true) { |
|
519 | + $latd = intval($lat*600000.0); |
|
520 | + if ($neg == true) { |
|
521 | 521 | $latd = ~$latd; |
522 | - $latd+=1; |
|
522 | + $latd += 1; |
|
523 | 523 | $latd &= 0x07FFFFFF; |
524 | 524 | } |
525 | 525 | return $latd; |
526 | 526 | } |
527 | 527 | |
528 | - private function mk_ais_lon( $lon ) { |
|
528 | + private function mk_ais_lon($lon) { |
|
529 | 529 | //$lon = 103.851; |
530 | - if ($lon<0.0) { |
|
530 | + if ($lon < 0.0) { |
|
531 | 531 | $lon = -$lon; |
532 | - $neg=true; |
|
533 | - } else $neg=false; |
|
532 | + $neg = true; |
|
533 | + } else $neg = false; |
|
534 | 534 | $lond = 0x00000000; |
535 | - $lond = intval ($lon * 600000.0); |
|
536 | - if ($neg==true) { |
|
535 | + $lond = intval($lon*600000.0); |
|
536 | + if ($neg == true) { |
|
537 | 537 | $lond = ~$lond; |
538 | - $lond+=1; |
|
538 | + $lond += 1; |
|
539 | 539 | $lond &= 0x0FFFFFFF; |
540 | 540 | } |
541 | 541 | return $lond; |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | |
544 | 544 | private function char2bin($name, $max_len) { |
545 | 545 | $len = strlen($name); |
546 | - if ($len > $max_len) $name = substr($name,0,$max_len); |
|
547 | - if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len) * 6); |
|
546 | + if ($len > $max_len) $name = substr($name, 0, $max_len); |
|
547 | + if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len)*6); |
|
548 | 548 | else $pad = ''; |
549 | 549 | $rv = ''; |
550 | 550 | $ais_chars = array( |
@@ -561,26 +561,26 @@ discard block |
||
561 | 561 | if ($_a) foreach ($_a as $_1) { |
562 | 562 | if (isset($ais_chars[$_1])) $dec = $ais_chars[$_1]; |
563 | 563 | else $dec = 0; |
564 | - $bin = str_pad(decbin( $dec ), 6, '0', STR_PAD_LEFT); |
|
564 | + $bin = str_pad(decbin($dec), 6, '0', STR_PAD_LEFT); |
|
565 | 565 | $rv .= $bin; |
566 | 566 | //echo "$_1 $dec ($bin)<br/>"; |
567 | 567 | } |
568 | 568 | return $rv.$pad; |
569 | 569 | } |
570 | 570 | |
571 | - private function mk_ais($_enc, $_part=1,$_total=1,$_seq='',$_ch='A') { |
|
571 | + private function mk_ais($_enc, $_part = 1, $_total = 1, $_seq = '', $_ch = 'A') { |
|
572 | 572 | $len_bit = strlen($_enc); |
573 | - $rem6 = $len_bit % 6; |
|
573 | + $rem6 = $len_bit%6; |
|
574 | 574 | $pad6_len = 0; |
575 | 575 | if ($rem6) $pad6_len = 6 - $rem6; |
576 | 576 | //echo $pad6_len.'<br>'; |
577 | 577 | $_enc .= str_repeat("0", $pad6_len); // pad the text... |
578 | - $len_enc = strlen($_enc) / 6; |
|
578 | + $len_enc = strlen($_enc)/6; |
|
579 | 579 | //echo $_enc.' '.$len_enc.'<br/>'; |
580 | 580 | $itu = ''; |
581 | - for ($i=0; $i<$len_enc; $i++) { |
|
582 | - $offset = $i * 6; |
|
583 | - $dec = bindec(substr($_enc,$offset,6)); |
|
581 | + for ($i = 0; $i < $len_enc; $i++) { |
|
582 | + $offset = $i*6; |
|
583 | + $dec = bindec(substr($_enc, $offset, 6)); |
|
584 | 584 | if ($dec < 40) $dec += 48; |
585 | 585 | else $dec += 56; |
586 | 586 | //echo chr($dec)." $dec<br/>"; |
@@ -590,15 +590,15 @@ discard block |
||
590 | 590 | $chksum = 0; |
591 | 591 | $itu = "AIVDM,$_part,$_total,$_seq,$_ch,".$itu.",0"; |
592 | 592 | $len_itu = strlen($itu); |
593 | - for ($i=0; $i<$len_itu; $i++) { |
|
594 | - $chksum ^= ord( $itu[$i] ); |
|
593 | + for ($i = 0; $i < $len_itu; $i++) { |
|
594 | + $chksum ^= ord($itu[$i]); |
|
595 | 595 | } |
596 | - $hex_arr = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); |
|
597 | - $lsb = $chksum & 0x0F; |
|
598 | - if ($lsb >=0 && $lsb <= 15 ) $lsbc = $hex_arr[$lsb]; |
|
596 | + $hex_arr = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); |
|
597 | + $lsb = $chksum&0x0F; |
|
598 | + if ($lsb >= 0 && $lsb <= 15) $lsbc = $hex_arr[$lsb]; |
|
599 | 599 | else $lsbc = '0'; |
600 | - $msb = (($chksum & 0xF0) >> 4) & 0x0F; |
|
601 | - if ($msb >=0 && $msb <= 15 ) $msbc = $hex_arr[$msb]; |
|
600 | + $msb = (($chksum&0xF0) >> 4)&0x0F; |
|
601 | + if ($msb >= 0 && $msb <= 15) $msbc = $hex_arr[$msb]; |
|
602 | 602 | else $msbc = '0'; |
603 | 603 | $itu = '!'.$itu."*{$msbc}{$lsbc}\r\n"; |
604 | 604 | return $itu; |
@@ -624,14 +624,14 @@ discard block |
||
624 | 624 | |
625 | 625 | public function mmsitype($mmsi) { |
626 | 626 | if (strlen($mmsi) == 9) { |
627 | - if (substr($mmsi,0,3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS'; |
|
628 | - elseif (substr($mmsi,0,3) == '972') return 'MOB (Man Overboard) device'; |
|
629 | - elseif (substr($mmsi,0,3) == '970') return 'AIS SART (Search and Rescue Transmitter)'; |
|
630 | - elseif (substr($mmsi,0,3) == '111') return 'SAR (Search and Rescue) aircraft'; |
|
631 | - elseif (substr($mmsi,0,2) == '98') return 'Auxiliary craft associated with a parent ship'; |
|
632 | - elseif (substr($mmsi,0,2) == '99') return 'Aids to Navigation'; |
|
633 | - elseif (substr($mmsi,0,2) == '00') return 'Coastal stations'; |
|
634 | - elseif (substr($mmsi,0,1) == '0') return 'Group of ships'; |
|
627 | + if (substr($mmsi, 0, 3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS'; |
|
628 | + elseif (substr($mmsi, 0, 3) == '972') return 'MOB (Man Overboard) device'; |
|
629 | + elseif (substr($mmsi, 0, 3) == '970') return 'AIS SART (Search and Rescue Transmitter)'; |
|
630 | + elseif (substr($mmsi, 0, 3) == '111') return 'SAR (Search and Rescue) aircraft'; |
|
631 | + elseif (substr($mmsi, 0, 2) == '98') return 'Auxiliary craft associated with a parent ship'; |
|
632 | + elseif (substr($mmsi, 0, 2) == '99') return 'Aids to Navigation'; |
|
633 | + elseif (substr($mmsi, 0, 2) == '00') return 'Coastal stations'; |
|
634 | + elseif (substr($mmsi, 0, 1) == '0') return 'Group of ships'; |
|
635 | 635 | else return 'Ship'; |
636 | 636 | } |
637 | 637 | |
@@ -641,19 +641,19 @@ discard block |
||
641 | 641 | public function parse_line($buffer) { |
642 | 642 | global $globalDebug; |
643 | 643 | $result = array(); |
644 | - $start = strpos($buffer,"VDM"); |
|
644 | + $start = strpos($buffer, "VDM"); |
|
645 | 645 | $tst = substr($buffer, $start - 3); |
646 | - $data = $this->process_ais_raw( $tst, "" ); |
|
646 | + $data = $this->process_ais_raw($tst, ""); |
|
647 | 647 | if (!is_object($data)) { |
648 | 648 | //if ($globalDebug) echo '==== Line format not supported : '.$buffer."\n"; |
649 | 649 | return array(); |
650 | 650 | } |
651 | 651 | if ($data->lon != 0) $result['longitude'] = $data->lon; |
652 | 652 | if ($data->lat != 0) $result['latitude'] = $data->lat; |
653 | - $result['ident'] = trim(str_replace('@','',$data->name)); |
|
653 | + $result['ident'] = trim(str_replace('@', '', $data->name)); |
|
654 | 654 | $result['timestamp'] = $data->ts; |
655 | 655 | $result['mmsi'] = $data->mmsi; |
656 | - if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') $result['mmsi'] = '3'.$result['mmsi']; |
|
656 | + if (strlen($result['mmsi']) == 8 && substr($result['mmsi'], 0, 3) == '669') $result['mmsi'] = '3'.$result['mmsi']; |
|
657 | 657 | $result['mmsi_type'] = $this->mmsitype($result['mmsi']); |
658 | 658 | if ($data->sog != -1.0) $result['speed'] = $data->sog; |
659 | 659 | if ($data->heading !== '') $result['heading'] = $data->heading; |
@@ -663,16 +663,16 @@ discard block |
||
663 | 663 | if ($data->type !== '') $result['type'] = $data->type; |
664 | 664 | if ($data->typeid !== '') $result['typeid'] = $data->typeid; |
665 | 665 | if ($data->imo !== '') $result['imo'] = $data->imo; |
666 | - if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@','',$data->callsign)); |
|
666 | + if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@', '', $data->callsign)); |
|
667 | 667 | if (is_numeric($data->eta_month) && $data->eta_month != 0 && is_numeric($data->eta_day) && $data->eta_day != 0 && $data->eta_hour !== '' && $data->eta_minute !== '') { |
668 | - $eta_ts = strtotime(date('Y').'-'.sprintf("%02d",$data->eta_month).'-'.sprintf("%02d",$data->eta_day).' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00'); |
|
668 | + $eta_ts = strtotime(date('Y').'-'.sprintf("%02d", $data->eta_month).'-'.sprintf("%02d", $data->eta_day).' '.sprintf("%02d", $data->eta_hour).':'.sprintf("%02d", $data->eta_minute).':00'); |
|
669 | 669 | if ($eta_ts != '') $result['eta_ts'] = $eta_ts; |
670 | 670 | } elseif (is_numeric($data->eta_hour) && is_numeric($data->eta_minute)) { |
671 | - $eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00'); |
|
671 | + $eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d", $data->eta_hour).':'.sprintf("%02d", $data->eta_minute).':00'); |
|
672 | 672 | if ($eta_ts != '') $result['eta_ts'] = $eta_ts; |
673 | 673 | } |
674 | 674 | if ($data->destination != '') { |
675 | - $dest = trim(str_replace('@','',$data->destination)); |
|
675 | + $dest = trim(str_replace('@', '', $data->destination)); |
|
676 | 676 | if ($dest != '') $result['destination'] = $dest; |
677 | 677 | } |
678 | 678 | $result['all'] = (array) $data; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | require_once(dirname(__FILE__).'/class.create_db.php'); |
23 | 23 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
24 | 24 | require_once(dirname(__FILE__).'/class.settings.php'); |
25 | -$title="Install"; |
|
25 | +$title = "Install"; |
|
26 | 26 | require(dirname(__FILE__).'/../require/settings.php'); |
27 | 27 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
28 | 28 | require(dirname(__FILE__).'/header.php'); |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | if (!extension_loaded('curl')) { |
96 | 96 | $error[] = "Curl is not loaded."; |
97 | 97 | } |
98 | - if(function_exists('apache_get_modules') ){ |
|
99 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
98 | + if (function_exists('apache_get_modules')) { |
|
99 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
100 | 100 | $error[] = "mod_rewrite is not available."; |
101 | 101 | } |
102 | 102 | /* |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>'; |
113 | 113 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
114 | 114 | if (function_exists('get_headers')) { |
115 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
116 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
115 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
116 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
117 | 117 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
118 | 118 | } |
119 | 119 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
193 | 193 | if (isset($_SERVER['REQUEST_URI'])) { |
194 | 194 | $URL = $_SERVER['REQUEST_URI']; |
195 | - $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
|
195 | + $globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL))); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | ?> |
@@ -515,13 +515,13 @@ 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 | 523 | } else { |
524 | - $hostport = explode(':',$source['host']); |
|
524 | + $hostport = explode(':', $source['host']); |
|
525 | 525 | if (isset($hostport[1])) { |
526 | 526 | $host = $hostport[0]; |
527 | 527 | $port = $hostport[1]; |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | <select name="timezones[]" id="timezones"> |
571 | 571 | <?php |
572 | 572 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
573 | - foreach($timezonelist as $timezones){ |
|
573 | + foreach ($timezonelist as $timezones) { |
|
574 | 574 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
575 | 575 | print '<option selected>'.$timezones.'</option>'; |
576 | 576 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | <select name="timezones[]" id="timezones"> |
625 | 625 | <?php |
626 | 626 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
627 | - foreach($timezonelist as $timezones){ |
|
627 | + foreach ($timezonelist as $timezones) { |
|
628 | 628 | if ($timezones == 'UTC') { |
629 | 629 | print '<option selected>'.$timezones.'</option>'; |
630 | 630 | } else print '<option>'.$timezones.'</option>'; |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | <br /> |
1077 | 1077 | <p> |
1078 | 1078 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1079 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1079 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
1080 | 1080 | </p> |
1081 | 1081 | <br /> |
1082 | 1082 | <p> |
@@ -1138,14 +1138,14 @@ discard block |
||
1138 | 1138 | $error = ''; |
1139 | 1139 | |
1140 | 1140 | if (isset($_POST['dbtype'])) { |
1141 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
1142 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
1143 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
1144 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
1145 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
1146 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
1147 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
1148 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
1141 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
1142 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
1143 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
1144 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
1145 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
1146 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
1147 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
1148 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
1149 | 1149 | |
1150 | 1150 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
1151 | 1151 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -1165,49 +1165,49 @@ discard block |
||
1165 | 1165 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
1166 | 1166 | */ |
1167 | 1167 | |
1168 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
1168 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
1169 | 1169 | |
1170 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
1171 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
1172 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
1173 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
1174 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
1170 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
1171 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
1172 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
1173 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
1174 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
1175 | 1175 | |
1176 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
1177 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
1178 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
1179 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
1180 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
1181 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
1182 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
1183 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
1184 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
1185 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1176 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
1177 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
1178 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
1179 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
1180 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
1181 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
1182 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
1183 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
1184 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
1185 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1186 | 1186 | |
1187 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
1188 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
1189 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
1190 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
1191 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
1192 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
1187 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
1188 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
1189 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
1190 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
1191 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
1192 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
1193 | 1193 | |
1194 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
1195 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
1194 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
1195 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
1196 | 1196 | |
1197 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
1198 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
1199 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
1197 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
1198 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
1199 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
1200 | 1200 | |
1201 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
1201 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
1202 | 1202 | if ($acars == 'acars') { |
1203 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
1203 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
1204 | 1204 | } else { |
1205 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
1205 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1206 | 1206 | } |
1207 | 1207 | |
1208 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1209 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1210 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1208 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1209 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1210 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1211 | 1211 | |
1212 | 1212 | $source_name = $_POST['source_name']; |
1213 | 1213 | $source_latitude = $_POST['source_latitude']; |
@@ -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 | |
@@ -1231,16 +1231,16 @@ discard block |
||
1231 | 1231 | $newstype = $_POST['newstype']; |
1232 | 1232 | |
1233 | 1233 | $newsfeeds = array(); |
1234 | - foreach($newsurl as $newskey => $url) { |
|
1234 | + foreach ($newsurl as $newskey => $url) { |
|
1235 | 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 | - $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
|
1243 | + $settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds)); |
|
1244 | 1244 | |
1245 | 1245 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
1246 | 1246 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1251,27 +1251,27 @@ discard block |
||
1251 | 1251 | $sbsurl = $_POST['sbsurl']; |
1252 | 1252 | */ |
1253 | 1253 | |
1254 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1255 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1256 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1257 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1258 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1259 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1260 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1261 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1254 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1255 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1256 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1257 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1258 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1259 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1260 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1261 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1262 | 1262 | |
1263 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1264 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1265 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1266 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1267 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1268 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1269 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1270 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1271 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1272 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1273 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1274 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1263 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1264 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1265 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1266 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1267 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1268 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1269 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1270 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1271 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1272 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1273 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1274 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1275 | 1275 | |
1276 | 1276 | /* |
1277 | 1277 | $globalSBS1Hosts = array(); |
@@ -1287,7 +1287,7 @@ discard block |
||
1287 | 1287 | } |
1288 | 1288 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1289 | 1289 | */ |
1290 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1290 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1291 | 1291 | $host = $_POST['host']; |
1292 | 1292 | $port = $_POST['port']; |
1293 | 1293 | $name = $_POST['name']; |
@@ -1304,115 +1304,115 @@ discard block |
||
1304 | 1304 | else $cov = 'FALSE'; |
1305 | 1305 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1306 | 1306 | else $arch = 'FALSE'; |
1307 | - if (strpos($format[$key],'_callback')) { |
|
1308 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1307 | + if (strpos($format[$key], '_callback')) { |
|
1308 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1309 | 1309 | } elseif ($h != '' || $name[$key] != '') { |
1310 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1310 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1311 | 1311 | } |
1312 | 1312 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1313 | 1313 | } |
1314 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1314 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1315 | 1315 | |
1316 | 1316 | /* |
1317 | 1317 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1318 | 1318 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1319 | 1319 | */ |
1320 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1321 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1322 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1320 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1321 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1322 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1323 | 1323 | |
1324 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1325 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1324 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1325 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1326 | 1326 | |
1327 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1328 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1327 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1328 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1329 | 1329 | |
1330 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
1331 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
1330 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
1331 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
1332 | 1332 | |
1333 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1334 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1335 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1336 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1333 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1334 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1335 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1336 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1337 | 1337 | |
1338 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1339 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1340 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1338 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1339 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1340 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1341 | 1341 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1342 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1343 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1342 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1343 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1344 | 1344 | |
1345 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1346 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1347 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1348 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1349 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1350 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1351 | - $minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT); |
|
1352 | - $settings = array_merge($settings,array('globalMinFetch' => $minfetch)); |
|
1353 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1354 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1345 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1346 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1347 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1348 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1349 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1350 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1351 | + $minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT); |
|
1352 | + $settings = array_merge($settings, array('globalMinFetch' => $minfetch)); |
|
1353 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1354 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1355 | 1355 | |
1356 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1357 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1356 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1357 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1358 | 1358 | |
1359 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1360 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1359 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1360 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1361 | 1361 | |
1362 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1362 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1363 | 1363 | if ($archiveyear == "archiveyear") { |
1364 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1364 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1365 | 1365 | } else { |
1366 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1366 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1367 | 1367 | } |
1368 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1369 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1370 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1371 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1368 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1369 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1370 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1371 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1372 | 1372 | |
1373 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1374 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1375 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1376 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1373 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1374 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1375 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1376 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1377 | 1377 | |
1378 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1379 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1380 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1378 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1379 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1380 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1381 | 1381 | |
1382 | 1382 | // Create in settings.php keys not yet configurable if not already here |
1383 | 1383 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1384 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1384 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1385 | 1385 | |
1386 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1386 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1387 | 1387 | if ($resetyearstats == 'resetyearstats') { |
1388 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1388 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1389 | 1389 | } else { |
1390 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1390 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1391 | 1391 | } |
1392 | 1392 | |
1393 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1393 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1394 | 1394 | if ($archive == 'archive') { |
1395 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1395 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1396 | 1396 | } else { |
1397 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1397 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1398 | 1398 | } |
1399 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
1399 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
1400 | 1400 | if ($archiveresults == 'archiveresults') { |
1401 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
1401 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
1402 | 1402 | } else { |
1403 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
1403 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
1404 | 1404 | } |
1405 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1405 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1406 | 1406 | if ($daemon == 'daemon') { |
1407 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1407 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1408 | 1408 | } else { |
1409 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1409 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1410 | 1410 | } |
1411 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1411 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1412 | 1412 | if ($schedules == 'schedules') { |
1413 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1413 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1414 | 1414 | } else { |
1415 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1415 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | /* |
@@ -1423,274 +1423,274 @@ discard block |
||
1423 | 1423 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1424 | 1424 | } |
1425 | 1425 | */ |
1426 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1427 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1428 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1429 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1430 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1426 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1427 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1428 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1429 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1430 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1431 | 1431 | $va = false; |
1432 | 1432 | if ($globalivao == 'ivao') { |
1433 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1433 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1434 | 1434 | $va = true; |
1435 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1435 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1436 | 1436 | if ($globalvatsim == 'vatsim') { |
1437 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1437 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1438 | 1438 | $va = true; |
1439 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1439 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1440 | 1440 | if ($globalphpvms == 'phpvms') { |
1441 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1441 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1442 | 1442 | $va = true; |
1443 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1443 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1444 | 1444 | if ($globalvam == 'vam') { |
1445 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1445 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1446 | 1446 | $va = true; |
1447 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1447 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1448 | 1448 | if ($va) { |
1449 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1450 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1449 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1450 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1451 | 1451 | if ($globalva == 'va' || $va) { |
1452 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1453 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1452 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1453 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1454 | 1454 | } else { |
1455 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1456 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1457 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1455 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1456 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1457 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1458 | 1458 | } |
1459 | 1459 | |
1460 | 1460 | |
1461 | - $mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING); |
|
1461 | + $mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING); |
|
1462 | 1462 | if ($mapoffline == 'mapoffline') { |
1463 | - $settings = array_merge($settings,array('globalMapOffline' => 'TRUE')); |
|
1463 | + $settings = array_merge($settings, array('globalMapOffline' => 'TRUE')); |
|
1464 | 1464 | } else { |
1465 | - $settings = array_merge($settings,array('globalMapOffline' => 'FALSE')); |
|
1465 | + $settings = array_merge($settings, array('globalMapOffline' => 'FALSE')); |
|
1466 | 1466 | } |
1467 | - $globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING); |
|
1467 | + $globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING); |
|
1468 | 1468 | if ($globaloffline == 'globaloffline') { |
1469 | - $settings = array_merge($settings,array('globalOffline' => 'TRUE')); |
|
1469 | + $settings = array_merge($settings, array('globalOffline' => 'TRUE')); |
|
1470 | 1470 | } else { |
1471 | - $settings = array_merge($settings,array('globalOffline' => 'FALSE')); |
|
1471 | + $settings = array_merge($settings, array('globalOffline' => 'FALSE')); |
|
1472 | 1472 | } |
1473 | 1473 | |
1474 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1474 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1475 | 1475 | if ($notam == 'notam') { |
1476 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1476 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1477 | 1477 | } else { |
1478 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1478 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1479 | 1479 | } |
1480 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1480 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1481 | 1481 | if ($owner == 'owner') { |
1482 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1482 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1483 | 1483 | } else { |
1484 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1484 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1485 | 1485 | } |
1486 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1486 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1487 | 1487 | if ($map3d == 'map3d') { |
1488 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1488 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1489 | 1489 | } else { |
1490 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1490 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1491 | 1491 | } |
1492 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1492 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1493 | 1493 | if ($crash == 'crash') { |
1494 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1494 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1495 | 1495 | } else { |
1496 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1496 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1497 | 1497 | } |
1498 | - $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING); |
|
1498 | + $fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING); |
|
1499 | 1499 | if ($fires == 'fires') { |
1500 | - $settings = array_merge($settings,array('globalMapFires' => 'TRUE')); |
|
1500 | + $settings = array_merge($settings, array('globalMapFires' => 'TRUE')); |
|
1501 | 1501 | } else { |
1502 | - $settings = array_merge($settings,array('globalMapFires' => 'FALSE')); |
|
1502 | + $settings = array_merge($settings, array('globalMapFires' => 'FALSE')); |
|
1503 | 1503 | } |
1504 | - $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING); |
|
1504 | + $firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING); |
|
1505 | 1505 | if ($firessupport == 'firessupport') { |
1506 | - $settings = array_merge($settings,array('globalFires' => 'TRUE')); |
|
1506 | + $settings = array_merge($settings, array('globalFires' => 'TRUE')); |
|
1507 | 1507 | } else { |
1508 | - $settings = array_merge($settings,array('globalFires' => 'FALSE')); |
|
1508 | + $settings = array_merge($settings, array('globalFires' => 'FALSE')); |
|
1509 | 1509 | } |
1510 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1510 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1511 | 1511 | if ($mapsatellites == 'mapsatellites') { |
1512 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1512 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1513 | 1513 | } else { |
1514 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1514 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1515 | 1515 | } |
1516 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1516 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1517 | 1517 | if ($map3ddefault == 'map3ddefault') { |
1518 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1518 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1519 | 1519 | } else { |
1520 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1520 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1521 | 1521 | } |
1522 | - $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING); |
|
1522 | + $map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING); |
|
1523 | 1523 | if ($map3dliveries == 'map3dliveries') { |
1524 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE')); |
|
1524 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE')); |
|
1525 | 1525 | } else { |
1526 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE')); |
|
1526 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE')); |
|
1527 | 1527 | } |
1528 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1528 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1529 | 1529 | if ($translate == 'translate') { |
1530 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1530 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1531 | 1531 | } else { |
1532 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1532 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1533 | 1533 | } |
1534 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1534 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1535 | 1535 | if ($realairlines == 'realairlines') { |
1536 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1536 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1537 | 1537 | } else { |
1538 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1538 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1539 | 1539 | } |
1540 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1540 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1541 | 1541 | if ($estimation == 'estimation') { |
1542 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1542 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1543 | 1543 | } else { |
1544 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1544 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1545 | 1545 | } |
1546 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1546 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1547 | 1547 | if ($metar == 'metar') { |
1548 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1548 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1549 | 1549 | } else { |
1550 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1550 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1551 | 1551 | } |
1552 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1552 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1553 | 1553 | if ($metarcycle == 'metarcycle') { |
1554 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1554 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1555 | 1555 | } else { |
1556 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1556 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1557 | 1557 | } |
1558 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1558 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1559 | 1559 | if ($fork == 'fork') { |
1560 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1560 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1561 | 1561 | } else { |
1562 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1562 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1563 | 1563 | } |
1564 | 1564 | |
1565 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1565 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1566 | 1566 | if ($colormap == 'colormap') { |
1567 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1567 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1568 | 1568 | } else { |
1569 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1569 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1570 | 1570 | } |
1571 | 1571 | |
1572 | 1572 | if (isset($_POST['aircrafticoncolor'])) { |
1573 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1574 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1573 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1574 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1575 | 1575 | } |
1576 | 1576 | |
1577 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1578 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1577 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1578 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1579 | 1579 | |
1580 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1581 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1582 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1583 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1584 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1585 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1580 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1581 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1582 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1583 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1584 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1585 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1586 | 1586 | |
1587 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1587 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1588 | 1588 | if ($mappopup == 'mappopup') { |
1589 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1589 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1590 | 1590 | } else { |
1591 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1591 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1592 | 1592 | } |
1593 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1593 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1594 | 1594 | if ($airportpopup == 'airportpopup') { |
1595 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1595 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1596 | 1596 | } else { |
1597 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1597 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1598 | 1598 | } |
1599 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1599 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1600 | 1600 | if ($maphistory == 'maphistory') { |
1601 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1601 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1602 | 1602 | } else { |
1603 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1603 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1604 | 1604 | } |
1605 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1605 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1606 | 1606 | if ($maptooltip == 'maptooltip') { |
1607 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1607 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1608 | 1608 | } else { |
1609 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1609 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1610 | 1610 | } |
1611 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1611 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1612 | 1612 | if ($flightroute == 'flightroute') { |
1613 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1613 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1614 | 1614 | } else { |
1615 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1615 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1616 | 1616 | } |
1617 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1617 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1618 | 1618 | if ($flightremainingroute == 'flightremainingroute') { |
1619 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1619 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1620 | 1620 | } else { |
1621 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1621 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1622 | 1622 | } |
1623 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1623 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1624 | 1624 | if ($allflights == 'allflights') { |
1625 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1625 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1626 | 1626 | } else { |
1627 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1627 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1628 | 1628 | } |
1629 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1629 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1630 | 1630 | if ($bbox == 'bbox') { |
1631 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1631 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1632 | 1632 | } else { |
1633 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1633 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1634 | 1634 | } |
1635 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1635 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1636 | 1636 | if ($groundaltitude == 'groundaltitude') { |
1637 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1637 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1638 | 1638 | } else { |
1639 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1639 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1640 | 1640 | } |
1641 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1641 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1642 | 1642 | if ($waypoints == 'waypoints') { |
1643 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1643 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1644 | 1644 | } else { |
1645 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1645 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1646 | 1646 | } |
1647 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1647 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1648 | 1648 | if ($geoid == 'geoid') { |
1649 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1649 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1650 | 1650 | } else { |
1651 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1651 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1652 | 1652 | } |
1653 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1654 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1653 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1654 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1655 | 1655 | |
1656 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1656 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1657 | 1657 | if ($noairlines == 'noairlines') { |
1658 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1658 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1659 | 1659 | } else { |
1660 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1660 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1661 | 1661 | } |
1662 | 1662 | |
1663 | - $tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING); |
|
1663 | + $tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING); |
|
1664 | 1664 | if ($tsk == 'tsk') { |
1665 | - $settings = array_merge($settings,array('globalTSK' => 'TRUE')); |
|
1665 | + $settings = array_merge($settings, array('globalTSK' => 'TRUE')); |
|
1666 | 1666 | } else { |
1667 | - $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
|
1667 | + $settings = array_merge($settings, array('globalTSK' => 'FALSE')); |
|
1668 | 1668 | } |
1669 | - $mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING); |
|
1669 | + $mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING); |
|
1670 | 1670 | if ($mapmatching == 'mapmatching') { |
1671 | - $settings = array_merge($settings,array('globalMapMatching' => 'TRUE')); |
|
1671 | + $settings = array_merge($settings, array('globalMapMatching' => 'TRUE')); |
|
1672 | 1672 | } else { |
1673 | - $settings = array_merge($settings,array('globalMapMatching' => 'FALSE')); |
|
1673 | + $settings = array_merge($settings, array('globalMapMatching' => 'FALSE')); |
|
1674 | 1674 | } |
1675 | - $mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING); |
|
1676 | - $settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1677 | - $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
|
1678 | - $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
|
1675 | + $mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING); |
|
1676 | + $settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1677 | + $graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING); |
|
1678 | + $settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper)); |
|
1679 | 1679 | |
1680 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1680 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
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)); |
|
1689 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1690 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1691 | 1691 | } |
1692 | 1692 | |
1693 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1693 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1694 | 1694 | |
1695 | 1695 | if ($error == '') settings::modify_settings($settings); |
1696 | 1696 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if (isset($this->all_tracked[$key]['id'])) { |
48 | 48 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
49 | 49 | $Tracker = new Tracker($this->db); |
50 | - $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
50 | + $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
59 | 59 | foreach ($this->all_tracked as $key => $flight) { |
60 | 60 | if (isset($flight['lastupdate'])) { |
61 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
61 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
62 | 62 | if (isset($this->all_tracked[$key]['id'])) { |
63 | 63 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
64 | 64 | /* |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | //$real_arrival = $this->arrival($key); |
70 | 70 | $Tracker = new Tracker($this->db); |
71 | 71 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
72 | - $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
|
72 | + $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed']); |
|
73 | 73 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
74 | 74 | } |
75 | 75 | // Put in archive |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $send = false; |
90 | 90 | |
91 | 91 | // SBS format is CSV format |
92 | - if(is_array($line) && isset($line['ident'])) { |
|
92 | + if (is_array($line) && isset($line['ident'])) { |
|
93 | 93 | //print_r($line); |
94 | 94 | if (isset($line['ident'])) { |
95 | 95 | |
@@ -113,33 +113,33 @@ discard block |
||
113 | 113 | |
114 | 114 | if (!isset($this->all_tracked[$id])) { |
115 | 115 | $this->all_tracked[$id] = array(); |
116 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
117 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
118 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
116 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedTracker' => 0)); |
|
117 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '')); |
|
118 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
119 | 119 | if (!isset($line['id'])) { |
120 | 120 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
121 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
122 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
121 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
122 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); |
|
123 | 123 | if ($globalAllTracked !== FALSE) $dataFound = true; |
124 | 124 | } |
125 | 125 | |
126 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
126 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
127 | 127 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
128 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
128 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
129 | 129 | } else { |
130 | 130 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
131 | 131 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
132 | 132 | return ''; |
133 | 133 | } |
134 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
134 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
135 | 135 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
136 | 136 | return ''; |
137 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
137 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
138 | 138 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
139 | 139 | return ''; |
140 | 140 | } elseif (!isset($line['datetime'])) { |
141 | 141 | date_default_timezone_set('UTC'); |
142 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
142 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
143 | 143 | } else { |
144 | 144 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
145 | 145 | return ''; |
@@ -147,38 +147,38 @@ discard block |
||
147 | 147 | |
148 | 148 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
149 | 149 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
150 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
150 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
151 | 151 | if ($this->all_tracked[$id]['addedTracker'] == 1) { |
152 | 152 | $timeelapsed = microtime(true); |
153 | 153 | $Tracker = new Tracker($this->db); |
154 | 154 | $fromsource = NULL; |
155 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
155 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
156 | 156 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
157 | 157 | $Tracker->db = null; |
158 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
158 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
159 | 159 | } |
160 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
160 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | if (isset($line['speed']) && $line['speed'] != '') { |
164 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
164 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed']))); |
|
165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
166 | 166 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
167 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
167 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
168 | 168 | if ($distance > 100 && $distance < 10000) { |
169 | 169 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
170 | 170 | $speed = $speed*3.6; |
171 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
171 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed))); |
|
172 | 172 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | 176 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
177 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
178 | 178 | else unset($timediff); |
179 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
179 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) { |
|
180 | 180 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
181 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
|
181 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'], 0.08)) { |
|
182 | 182 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
183 | 183 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
184 | 184 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
187 | 187 | $timeelapsed = microtime(true); |
188 | 188 | $Tracker = new Tracker($this->db); |
189 | - $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
189 | + $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
190 | 190 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
191 | 191 | $Tracker->db = null; |
192 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
192 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
193 | 193 | $this->tmd = 0; |
194 | 194 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
195 | 195 | } |
@@ -197,75 +197,75 @@ discard block |
||
197 | 197 | |
198 | 198 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
199 | 199 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
200 | - if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
200 | + if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
201 | 201 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
202 | 202 | $dataFound = true; |
203 | 203 | $this->all_tracked[$id]['time_last_coord'] = time(); |
204 | 204 | } |
205 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
205 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
206 | 206 | } |
207 | 207 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
208 | 208 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
209 | 209 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
210 | - if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
210 | + if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
211 | 211 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
212 | 212 | $dataFound = true; |
213 | 213 | $this->all_tracked[$id]['time_last_coord'] = time(); |
214 | 214 | } |
215 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
215 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | } else if ($globalDebug && $timediff > 20) { |
219 | 219 | $this->tmd = $this->tmd + 1; |
220 | 220 | if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) { |
221 | 221 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
222 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
223 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
222 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
223 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
224 | 224 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
225 | 225 | } |
226 | 226 | } |
227 | 227 | } |
228 | 228 | if (isset($line['last_update']) && $line['last_update'] != '') { |
229 | 229 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
230 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
230 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
231 | 231 | } |
232 | 232 | if (isset($line['format_source']) && $line['format_source'] != '') { |
233 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
233 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
234 | 234 | } |
235 | 235 | if (isset($line['source_name']) && $line['source_name'] != '') { |
236 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
236 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
237 | 237 | } |
238 | 238 | if (isset($line['comment']) && $line['comment'] != '') { |
239 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
239 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('comment' => $line['comment'])); |
|
240 | 240 | //$dataFound = true; |
241 | 241 | } |
242 | 242 | if (isset($line['type']) && $line['type'] != '') { |
243 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
243 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
244 | 244 | //$dataFound = true; |
245 | 245 | } |
246 | 246 | |
247 | 247 | if (isset($line['altitude']) && $line['altitude'] != '') { |
248 | 248 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
249 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
|
251 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
|
249 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude' => $line['altitude'])); |
|
251 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude_real' => $line['altitude'])); |
|
252 | 252 | //$dataFound = true; |
253 | 253 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
254 | 254 | } |
255 | 255 | |
256 | 256 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
257 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
257 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | if (isset($line['heading']) && $line['heading'] != '') { |
261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
263 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
261 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
263 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
264 | 264 | //$dataFound = true; |
265 | 265 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
266 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
267 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
266 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
267 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); |
|
268 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | 269 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
270 | 270 | } |
271 | 271 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -273,54 +273,54 @@ discard block |
||
273 | 273 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
274 | 274 | $this->all_tracked[$id]['lastupdate'] = time(); |
275 | 275 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
276 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
276 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
277 | 277 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
278 | 278 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
279 | 279 | $timeelapsed = microtime(true); |
280 | 280 | $TrackerLive = new TrackerLive($this->db); |
281 | 281 | if (isset($line['id'])) { |
282 | 282 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
283 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
284 | 284 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
285 | 285 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
286 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
287 | 287 | } else $recent_ident = ''; |
288 | - $TrackerLive->db=null; |
|
288 | + $TrackerLive->db = null; |
|
289 | 289 | |
290 | 290 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
291 | 291 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
292 | 292 | } else { |
293 | 293 | $recent_ident = ''; |
294 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
294 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
295 | 295 | } |
296 | 296 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
297 | - if($recent_ident == "") |
|
297 | + if ($recent_ident == "") |
|
298 | 298 | { |
299 | 299 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
300 | 300 | //adds the spotter data for the archive |
301 | 301 | $highlight = ''; |
302 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
302 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
303 | 303 | $timeelapsed = microtime(true); |
304 | 304 | $Tracker = new Tracker($this->db); |
305 | - $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
305 | + $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']); |
|
306 | 306 | $Tracker->db = null; |
307 | 307 | if ($globalDebug && isset($result)) echo $result."\n"; |
308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
308 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
309 | 309 | |
310 | 310 | |
311 | 311 | // Add source stat in DB |
312 | 312 | $Stats = new Stats($this->db); |
313 | 313 | if (!empty($this->stats)) { |
314 | 314 | if ($globalDebug) echo 'Add source stats : '; |
315 | - foreach($this->stats as $date => $data) { |
|
316 | - foreach($data as $source => $sourced) { |
|
315 | + foreach ($this->stats as $date => $data) { |
|
316 | + foreach ($data as $source => $sourced) { |
|
317 | 317 | //print_r($sourced); |
318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
318 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_tracker', $date); |
|
319 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_tracker', $date); |
|
320 | 320 | if (isset($sourced['msg'])) { |
321 | 321 | if (time() - $sourced['msg']['date'] > 10) { |
322 | 322 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
323 | - echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
323 | + echo $Stats->addStatSource($nbmsg, $source, 'msg_tracker', $date); |
|
324 | 324 | unset($this->stats[$date][$source]['msg']); |
325 | 325 | } |
326 | 326 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
344 | 344 | $TrackerLive = new TrackerLive($this->db); |
345 | 345 | $TrackerLive->deleteLiveTrackerData(); |
346 | - $TrackerLive->db=null; |
|
346 | + $TrackerLive->db = null; |
|
347 | 347 | if ($globalDebug) echo " Done\n"; |
348 | 348 | $this->last_delete = time(); |
349 | 349 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $this->all_tracked[$id]['addedTracker'] = 1; |
353 | 353 | if (isset($globalDaemon) && !$globalDaemon) { |
354 | 354 | $Tracker = new Tracker($this->db); |
355 | - $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['altitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
|
355 | + $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']); |
|
356 | 356 | $Tracker->db = null; |
357 | 357 | } |
358 | 358 | |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | $ignoreImport = false; |
367 | 367 | |
368 | 368 | if (!$ignoreImport) { |
369 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
369 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
370 | 370 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
371 | 371 | $timeelapsed = microtime(true); |
372 | 372 | $TrackerLive = new TrackerLive($this->db); |
373 | - $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
373 | + $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
374 | 374 | $TrackerLive->db = null; |
375 | 375 | $this->all_tracked[$id]['putinarchive'] = false; |
376 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
376 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
377 | 377 | |
378 | 378 | // Put statistics in $this->stats variable |
379 | 379 | |
@@ -390,19 +390,19 @@ discard block |
||
390 | 390 | $latitude = $globalCenterLatitude; |
391 | 391 | $longitude = $globalCenterLongitude; |
392 | 392 | } |
393 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
393 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
394 | 394 | } else { |
395 | 395 | $latitude = $this->source_location[$source]['latitude']; |
396 | 396 | $longitude = $this->source_location[$source]['longitude']; |
397 | 397 | } |
398 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
398 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
399 | 399 | //$stats_heading = $stats_heading%22.5; |
400 | 400 | $stats_heading = round($stats_heading/22.5); |
401 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
401 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
402 | 402 | $current_date = date('Y-m-d'); |
403 | 403 | if ($stats_heading == 16) $stats_heading = 0; |
404 | 404 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
405 | - for ($i=0;$i<=15;$i++) { |
|
405 | + for ($i = 0; $i <= 15; $i++) { |
|
406 | 406 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
407 | 407 | } |
408 | 408 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
418 | 418 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
419 | 419 | end($this->stats[$current_date][$source]['hist']); |
420 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
420 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
421 | 421 | } else $mini = 0; |
422 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
422 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
423 | 423 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
424 | 424 | } |
425 | 425 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | $this->all_tracked[$id]['lastupdate'] = time(); |
432 | 432 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
433 | 433 | if ($globalDebug) echo $result."\n"; |
434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
434 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
435 | 435 | //$this->del(); |
436 | 436 | |
437 | 437 |
@@ -14,33 +14,33 @@ discard block |
||
14 | 14 | * @param Array $filter the filter |
15 | 15 | * @return Array the SQL part |
16 | 16 | */ |
17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
23 | 23 | } else { |
24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | if (isset($filter[0]['source'])) { |
28 | - $filters = array_merge($filters,$filter); |
|
28 | + $filters = array_merge($filters, $filter); |
|
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
31 | 31 | $filter_query_join = ''; |
32 | 32 | $filter_query_where = ''; |
33 | - foreach($filters as $flt) { |
|
33 | + foreach ($filters as $flt) { |
|
34 | 34 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
35 | 35 | if (isset($flt['source'])) { |
36 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
36 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
37 | 37 | } else { |
38 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
38 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | if (isset($filter['source']) && !empty($filter['source'])) { |
43 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
43 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
44 | 44 | } |
45 | 45 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
46 | 46 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -68,38 +68,38 @@ discard block |
||
68 | 68 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_archive_output.date) = '".$filter['day']."'"; |
69 | 69 | } |
70 | 70 | } |
71 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
71 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
72 | 72 | } |
73 | 73 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
74 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
74 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
75 | 75 | } |
76 | 76 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
77 | 77 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
78 | 78 | if ($filter_query_where != '') { |
79 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
79 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
80 | 80 | } |
81 | 81 | $filter_query = $filter_query_join.$filter_query_where; |
82 | 82 | return $filter_query; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // tracker_archive |
86 | - public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') { |
|
86 | + public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') { |
|
87 | 87 | require_once(dirname(__FILE__).'/class.Tracker.php'); |
88 | 88 | if ($over_country == '') { |
89 | 89 | $Tracker = new Tracker($this->db); |
90 | - $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
90 | + $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
91 | 91 | if (!empty($data_country)) $country = $data_country['iso2']; |
92 | 92 | else $country = ''; |
93 | 93 | } else $country = $over_country; |
94 | 94 | // Route is not added in tracker_archive |
95 | - $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
95 | + $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
96 | 96 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
97 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $country,':comment' => $comment,':type' => $type); |
|
97 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $country, ':comment' => $comment, ':type' => $type); |
|
98 | 98 | try { |
99 | 99 | $sth = $this->db->prepare($query); |
100 | 100 | $sth->execute($query_values); |
101 | 101 | $sth->closeCursor(); |
102 | - } catch(PDOException $e) { |
|
102 | + } catch (PDOException $e) { |
|
103 | 103 | return "error : ".$e->getMessage(); |
104 | 104 | } |
105 | 105 | return "success"; |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | |
120 | 120 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
121 | 121 | //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
122 | - $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
122 | + $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
123 | 123 | |
124 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
124 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident)); |
|
125 | 125 | |
126 | 126 | return $spotter_array; |
127 | 127 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
141 | 141 | //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
142 | 142 | //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
143 | - $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
143 | + $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
144 | 144 | |
145 | 145 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
146 | 146 | /* |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
155 | 155 | */ |
156 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
156 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id)); |
|
157 | 157 | |
158 | 158 | return $spotter_array; |
159 | 159 | } |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | * @return Array the spotter information |
165 | 165 | * |
166 | 166 | */ |
167 | - public function getAllArchiveTrackerDataById($id,$date = '') |
|
167 | + public function getAllArchiveTrackerDataById($id, $date = '') |
|
168 | 168 | { |
169 | 169 | date_default_timezone_set('UTC'); |
170 | 170 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
171 | - if ($date == '') $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
172 | - else $query = $this->global_query." WHERE tracker_archive.famtrackid = :id AND date < '".date('c',$date)."' ORDER BY date"; |
|
171 | + if ($date == '') $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
172 | + else $query = $this->global_query." WHERE tracker_archive.famtrackid = :id AND date < '".date('c', $date)."' ORDER BY date"; |
|
173 | 173 | |
174 | 174 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
175 | 175 | |
176 | 176 | try { |
177 | 177 | $sth = $this->db->prepare($query); |
178 | 178 | $sth->execute(array(':id' => $id)); |
179 | - } catch(PDOException $e) { |
|
179 | + } catch (PDOException $e) { |
|
180 | 180 | echo $e->getMessage(); |
181 | 181 | die; |
182 | 182 | } |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | { |
196 | 196 | date_default_timezone_set('UTC'); |
197 | 197 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
198 | - $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
198 | + $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
199 | 199 | |
200 | 200 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
201 | 201 | |
202 | 202 | try { |
203 | 203 | $sth = $this->db->prepare($query); |
204 | 204 | $sth->execute(array(':id' => $id)); |
205 | - } catch(PDOException $e) { |
|
205 | + } catch (PDOException $e) { |
|
206 | 206 | echo $e->getMessage(); |
207 | 207 | die; |
208 | 208 | } |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | date_default_timezone_set('UTC'); |
225 | 225 | |
226 | 226 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
227 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
227 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
228 | 228 | |
229 | 229 | try { |
230 | 230 | $sth = $this->db->prepare($query); |
231 | 231 | $sth->execute(array(':ident' => $ident)); |
232 | - } catch(PDOException $e) { |
|
232 | + } catch (PDOException $e) { |
|
233 | 233 | echo $e->getMessage(); |
234 | 234 | die; |
235 | 235 | } |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | date_default_timezone_set('UTC'); |
251 | 251 | |
252 | 252 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
253 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
253 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
254 | 254 | |
255 | 255 | try { |
256 | 256 | $sth = $this->db->prepare($query); |
257 | 257 | $sth->execute(array(':id' => $id)); |
258 | - } catch(PDOException $e) { |
|
258 | + } catch (PDOException $e) { |
|
259 | 259 | echo $e->getMessage(); |
260 | 260 | die; |
261 | 261 | } |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | date_default_timezone_set('UTC'); |
277 | 277 | |
278 | 278 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
279 | - $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
279 | + $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
280 | 280 | |
281 | 281 | try { |
282 | 282 | $sth = $this->db->prepare($query); |
283 | 283 | $sth->execute(array(':id' => $id)); |
284 | - } catch(PDOException $e) { |
|
284 | + } catch (PDOException $e) { |
|
285 | 285 | echo $e->getMessage(); |
286 | 286 | die; |
287 | 287 | } |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | date_default_timezone_set('UTC'); |
304 | 304 | |
305 | 305 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
306 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
306 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
307 | 307 | // $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident"; |
308 | 308 | |
309 | 309 | try { |
310 | 310 | $sth = $this->db->prepare($query); |
311 | 311 | $sth->execute(array(':ident' => $ident)); |
312 | - } catch(PDOException $e) { |
|
312 | + } catch (PDOException $e) { |
|
313 | 313 | echo $e->getMessage(); |
314 | 314 | die; |
315 | 315 | } |
@@ -326,13 +326,13 @@ discard block |
||
326 | 326 | * @return Array the spotter information |
327 | 327 | * |
328 | 328 | */ |
329 | - public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
329 | + public function getTrackerArchiveData($ident, $famtrackid, $date) |
|
330 | 330 | { |
331 | 331 | $Tracker = new Tracker($this->db); |
332 | 332 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
333 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
333 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
334 | 334 | |
335 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
335 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':famtrackid' => $famtrackid, ':date' => $date.'%')); |
|
336 | 336 | |
337 | 337 | return $spotter_array; |
338 | 338 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | try { |
349 | 349 | $sth = $this->db->prepare($query); |
350 | 350 | $sth->execute(); |
351 | - } catch(PDOException $e) { |
|
351 | + } catch (PDOException $e) { |
|
352 | 352 | echo $e->getMessage(); |
353 | 353 | die; |
354 | 354 | } |
@@ -360,24 +360,24 @@ discard block |
||
360 | 360 | * @return Array the spotter information |
361 | 361 | * |
362 | 362 | */ |
363 | - public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
363 | + public function getMinLiveTrackerData($begindate, $enddate, $filter = array()) |
|
364 | 364 | { |
365 | 365 | global $globalDBdriver, $globalLiveInterval; |
366 | 366 | date_default_timezone_set('UTC'); |
367 | 367 | |
368 | 368 | $filter_query = ''; |
369 | 369 | if (isset($filter['source']) && !empty($filter['source'])) { |
370 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
370 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
371 | 371 | } |
372 | 372 | // Use spotter_output also ? |
373 | 373 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
374 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
374 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
375 | 375 | } |
376 | 376 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
377 | 377 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
378 | 378 | } |
379 | 379 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
380 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
380 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid |
397 | 397 | AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
398 | 398 | */ |
399 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
399 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
400 | 400 | FROM tracker_archive |
401 | 401 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
402 | 402 | WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
403 | 403 | '.$filter_query.' ORDER BY famtrackid'; |
404 | 404 | } else { |
405 | 405 | //$query = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao'; |
406 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
406 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
407 | 407 | FROM tracker_archive |
408 | 408 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
409 | 409 | WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".' |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | try { |
414 | 414 | $sth = $this->db->prepare($query); |
415 | 415 | $sth->execute(); |
416 | - } catch(PDOException $e) { |
|
416 | + } catch (PDOException $e) { |
|
417 | 417 | echo $e->getMessage(); |
418 | 418 | die; |
419 | 419 | } |
@@ -428,24 +428,24 @@ discard block |
||
428 | 428 | * @return Array the spotter information |
429 | 429 | * |
430 | 430 | */ |
431 | - public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
431 | + public function getMinLiveTrackerDataPlayback($begindate, $enddate, $filter = array()) |
|
432 | 432 | { |
433 | 433 | global $globalDBdriver, $globalLiveInterval; |
434 | 434 | date_default_timezone_set('UTC'); |
435 | 435 | |
436 | 436 | $filter_query = ''; |
437 | 437 | if (isset($filter['source']) && !empty($filter['source'])) { |
438 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
438 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
439 | 439 | } |
440 | 440 | // Should use spotter_output also ? |
441 | 441 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
442 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
442 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
443 | 443 | } |
444 | 444 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
445 | 445 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
446 | 446 | } |
447 | 447 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
448 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
448 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | FROM tracker_archive |
456 | 456 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
457 | 457 | */ |
458 | - $query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk |
|
458 | + $query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk |
|
459 | 459 | FROM tracker_archive_output |
460 | 460 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive_output.aircraft_icao = a.icao |
461 | 461 | WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
471 | 471 | '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow'; |
472 | 472 | */ |
473 | - $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
473 | + $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
474 | 474 | FROM tracker_archive_output |
475 | 475 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
476 | 476 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | try { |
483 | 483 | $sth = $this->db->prepare($query); |
484 | 484 | $sth->execute(); |
485 | - } catch(PDOException $e) { |
|
485 | + } catch (PDOException $e) { |
|
486 | 486 | echo $e->getMessage(); |
487 | 487 | die; |
488 | 488 | } |
@@ -497,23 +497,23 @@ discard block |
||
497 | 497 | * @return Array the spotter information |
498 | 498 | * |
499 | 499 | */ |
500 | - public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
500 | + public function getLiveTrackerCount($begindate, $enddate, $filter = array()) |
|
501 | 501 | { |
502 | 502 | global $globalDBdriver, $globalLiveInterval; |
503 | 503 | date_default_timezone_set('UTC'); |
504 | 504 | |
505 | 505 | $filter_query = ''; |
506 | 506 | if (isset($filter['source']) && !empty($filter['source'])) { |
507 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
507 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
508 | 508 | } |
509 | 509 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
510 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
510 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
511 | 511 | } |
512 | 512 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
513 | 513 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
514 | 514 | } |
515 | 515 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
516 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
516 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | try { |
529 | 529 | $sth = $this->db->prepare($query); |
530 | 530 | $sth->execute(); |
531 | - } catch(PDOException $e) { |
|
531 | + } catch (PDOException $e) { |
|
532 | 532 | echo $e->getMessage(); |
533 | 533 | die; |
534 | 534 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @return Array the spotter information |
549 | 549 | * |
550 | 550 | */ |
551 | - public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
551 | + public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
552 | 552 | { |
553 | 553 | global $globalTimezone, $globalDBdriver; |
554 | 554 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | |
571 | 571 | $q_array = explode(" ", $q); |
572 | 572 | |
573 | - foreach ($q_array as $q_item){ |
|
573 | + foreach ($q_array as $q_item) { |
|
574 | 574 | $additional_query .= " AND ("; |
575 | 575 | $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
576 | 576 | $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | |
603 | 603 | if ($registration != "") |
604 | 604 | { |
605 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
605 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
606 | 606 | if (!is_string($registration)) |
607 | 607 | { |
608 | 608 | return false; |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | |
614 | 614 | if ($aircraft_icao != "") |
615 | 615 | { |
616 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
616 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
617 | 617 | if (!is_string($aircraft_icao)) |
618 | 618 | { |
619 | 619 | return false; |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | |
625 | 625 | if ($aircraft_manufacturer != "") |
626 | 626 | { |
627 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
627 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
628 | 628 | if (!is_string($aircraft_manufacturer)) |
629 | 629 | { |
630 | 630 | return false; |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | |
646 | 646 | if ($airline_icao != "") |
647 | 647 | { |
648 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
648 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
649 | 649 | if (!is_string($airline_icao)) |
650 | 650 | { |
651 | 651 | return false; |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | |
657 | 657 | if ($airline_country != "") |
658 | 658 | { |
659 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
659 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
660 | 660 | if (!is_string($airline_country)) |
661 | 661 | { |
662 | 662 | return false; |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | |
668 | 668 | if ($airline_type != "") |
669 | 669 | { |
670 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
670 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
671 | 671 | if (!is_string($airline_type)) |
672 | 672 | { |
673 | 673 | return false; |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | |
690 | 690 | if ($airport != "") |
691 | 691 | { |
692 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
692 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
693 | 693 | if (!is_string($airport)) |
694 | 694 | { |
695 | 695 | return false; |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | |
701 | 701 | if ($airport_country != "") |
702 | 702 | { |
703 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
703 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
704 | 704 | if (!is_string($airport_country)) |
705 | 705 | { |
706 | 706 | return false; |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | |
712 | 712 | if ($callsign != "") |
713 | 713 | { |
714 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
714 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
715 | 715 | if (!is_string($callsign)) |
716 | 716 | { |
717 | 717 | return false; |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | $translate = $Translation->ident2icao($callsign); |
720 | 720 | if ($translate != $callsign) { |
721 | 721 | $additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)"; |
722 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
722 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
723 | 723 | } else { |
724 | 724 | $additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')"; |
725 | 725 | } |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | |
729 | 729 | if ($owner != "") |
730 | 730 | { |
731 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
731 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
732 | 732 | if (!is_string($owner)) |
733 | 733 | { |
734 | 734 | return false; |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | |
740 | 740 | if ($pilot_name != "") |
741 | 741 | { |
742 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
742 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
743 | 743 | if (!is_string($pilot_name)) |
744 | 744 | { |
745 | 745 | return false; |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | |
751 | 751 | if ($pilot_id != "") |
752 | 752 | { |
753 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
753 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
754 | 754 | if (!is_string($pilot_id)) |
755 | 755 | { |
756 | 756 | return false; |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | |
762 | 762 | if ($departure_airport_route != "") |
763 | 763 | { |
764 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
764 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
765 | 765 | if (!is_string($departure_airport_route)) |
766 | 766 | { |
767 | 767 | return false; |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | |
773 | 773 | if ($arrival_airport_route != "") |
774 | 774 | { |
775 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
775 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
776 | 776 | if (!is_string($arrival_airport_route)) |
777 | 777 | { |
778 | 778 | return false; |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | { |
786 | 786 | $altitude_array = explode(",", $altitude); |
787 | 787 | |
788 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
789 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
788 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
789 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
790 | 790 | |
791 | 791 | |
792 | 792 | if ($altitude_array[1] != "") |
@@ -804,8 +804,8 @@ discard block |
||
804 | 804 | { |
805 | 805 | $date_array = explode(",", $date_posted); |
806 | 806 | |
807 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
808 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
807 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
808 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
809 | 809 | |
810 | 810 | if ($globalTimezone != '') { |
811 | 811 | date_default_timezone_set($globalTimezone); |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | { |
838 | 838 | $limit_array = explode(",", $limit); |
839 | 839 | |
840 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
841 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
840 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
841 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
842 | 842 | |
843 | 843 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
844 | 844 | { |
@@ -849,8 +849,8 @@ discard block |
||
849 | 849 | |
850 | 850 | |
851 | 851 | if ($origLat != "" && $origLon != "" && $dist != "") { |
852 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
853 | - $query="SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
852 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
853 | + $query = "SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
854 | 854 | FROM tracker_archive_output, tracker_archive WHERE spotter_output_archive.famtrackid = tracker_archive.famtrackid AND spotter_output.ident <> '' ".$additional_query."AND CAST(tracker_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(tracker_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
855 | 855 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
856 | 856 | } else { |
@@ -867,12 +867,12 @@ discard block |
||
867 | 867 | $additional_query .= " AND (tracker_archive_output.waypoints <> '')"; |
868 | 868 | } |
869 | 869 | |
870 | - $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
870 | + $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
871 | 871 | WHERE tracker_archive_output.ident <> '' |
872 | 872 | ".$additional_query." |
873 | 873 | ".$filter_query.$orderby_query; |
874 | 874 | } |
875 | - $spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query); |
|
875 | + $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
|
876 | 876 | |
877 | 877 | return $spotter_array; |
878 | 878 | } |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | try { |
890 | 890 | $sth = $this->db->prepare($query); |
891 | 891 | $sth->execute(); |
892 | - } catch(PDOException $e) { |
|
892 | + } catch (PDOException $e) { |
|
893 | 893 | return "error"; |
894 | 894 | } |
895 | 895 | } |
@@ -926,8 +926,8 @@ discard block |
||
926 | 926 | { |
927 | 927 | $limit_array = explode(",", $limit); |
928 | 928 | |
929 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
930 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
929 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
930 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
931 | 931 | |
932 | 932 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
933 | 933 | { |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | $query_values = array(); |
969 | 969 | $limit_query = ''; |
970 | 970 | $additional_query = ''; |
971 | - $filter_query = $this->getFilter($filter,true,true); |
|
971 | + $filter_query = $this->getFilter($filter, true, true); |
|
972 | 972 | |
973 | 973 | if ($owner != "") |
974 | 974 | { |
@@ -985,8 +985,8 @@ discard block |
||
985 | 985 | { |
986 | 986 | $limit_array = explode(",", $limit); |
987 | 987 | |
988 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
989 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
988 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
989 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
990 | 990 | |
991 | 991 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
992 | 992 | { |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | $query_values = array(); |
1027 | 1027 | $limit_query = ''; |
1028 | 1028 | $additional_query = ''; |
1029 | - $filter_query = $this->getFilter($filter,true,true); |
|
1029 | + $filter_query = $this->getFilter($filter, true, true); |
|
1030 | 1030 | |
1031 | 1031 | if ($pilot != "") |
1032 | 1032 | { |
@@ -1038,8 +1038,8 @@ discard block |
||
1038 | 1038 | { |
1039 | 1039 | $limit_array = explode(",", $limit); |
1040 | 1040 | |
1041 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1042 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1041 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1042 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1043 | 1043 | |
1044 | 1044 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1045 | 1045 | { |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | * @return Array the airline country list |
1070 | 1070 | * |
1071 | 1071 | */ |
1072 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1072 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1073 | 1073 | { |
1074 | 1074 | global $globalDBdriver; |
1075 | 1075 | /* |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | $flight_array = array(); |
1099 | 1099 | $temp_array = array(); |
1100 | 1100 | |
1101 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1101 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1102 | 1102 | { |
1103 | 1103 | $temp_array['flight_count'] = $row['nb']; |
1104 | 1104 | $temp_array['flight_country'] = $row['name']; |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | * @return Array the airline country list |
1116 | 1116 | * |
1117 | 1117 | */ |
1118 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1118 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1119 | 1119 | { |
1120 | 1120 | global $globalDBdriver; |
1121 | 1121 | /* |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | $flight_array = array(); |
1145 | 1145 | $temp_array = array(); |
1146 | 1146 | |
1147 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1147 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1148 | 1148 | { |
1149 | 1149 | $temp_array['airline_icao'] = $row['airline_icao']; |
1150 | 1150 | $temp_array['flight_count'] = $row['nb']; |
@@ -1162,14 +1162,14 @@ discard block |
||
1162 | 1162 | * @return Array the spotter information |
1163 | 1163 | * |
1164 | 1164 | */ |
1165 | - public function getDateArchiveTrackerDataById($id,$date) |
|
1165 | + public function getDateArchiveTrackerDataById($id, $date) |
|
1166 | 1166 | { |
1167 | 1167 | $Tracker = new Tracker($this->db); |
1168 | 1168 | date_default_timezone_set('UTC'); |
1169 | 1169 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1170 | - $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1171 | - $date = date('c',$date); |
|
1172 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1170 | + $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1171 | + $date = date('c', $date); |
|
1172 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1173 | 1173 | return $spotter_array; |
1174 | 1174 | } |
1175 | 1175 | |
@@ -1179,14 +1179,14 @@ discard block |
||
1179 | 1179 | * @return Array the spotter information |
1180 | 1180 | * |
1181 | 1181 | */ |
1182 | - public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
1182 | + public function getDateArchiveTrackerDataByIdent($ident, $date) |
|
1183 | 1183 | { |
1184 | 1184 | $Tracker = new Tracker($this->db); |
1185 | 1185 | date_default_timezone_set('UTC'); |
1186 | 1186 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1187 | - $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1188 | - $date = date('c',$date); |
|
1189 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1187 | + $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1188 | + $date = date('c', $date); |
|
1189 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1190 | 1190 | return $spotter_array; |
1191 | 1191 | } |
1192 | 1192 | |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | * @return Array the spotter information |
1197 | 1197 | * |
1198 | 1198 | */ |
1199 | - public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1199 | + public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1200 | 1200 | { |
1201 | 1201 | global $global_query; |
1202 | 1202 | $Tracker = new Tracker($this->db); |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | $query_values = array(); |
1205 | 1205 | $limit_query = ''; |
1206 | 1206 | $additional_query = ''; |
1207 | - $filter_query = $this->getFilter($filters,true,true); |
|
1207 | + $filter_query = $this->getFilter($filters, true, true); |
|
1208 | 1208 | |
1209 | 1209 | if ($airport != "") |
1210 | 1210 | { |
@@ -1221,8 +1221,8 @@ discard block |
||
1221 | 1221 | { |
1222 | 1222 | $limit_array = explode(",", $limit); |
1223 | 1223 | |
1224 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1225 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1224 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1225 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1226 | 1226 | |
1227 | 1227 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1228 | 1228 | { |