Completed
Push — master ( 8eb35e...77cd33 )
by Yannick
09:48
created
install/class.update_schema.php 1 patch
Spacing   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
@@ -815,17 +815,17 @@  discard block
 block discarded – undo
815 815
 			try {
816 816
 				$sth = $Connection->db->prepare($query);
817 817
 				$sth->execute();
818
-			} catch(PDOException $e) {
818
+			} catch (PDOException $e) {
819 819
 				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
820 820
 			}
821 821
 		}
822
-		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
822
+		if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824 824
     			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828
-			} catch(PDOException $e) {
828
+			} catch (PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830 830
     			}
831 831
     		}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		try {
835 835
 			$sth = $Connection->db->prepare($query);
836 836
 			$sth->execute();
837
-		} catch(PDOException $e) {
837
+		} catch (PDOException $e) {
838 838
 			return "error (update schema_version) : ".$e->getMessage()."\n";
839 839
 		}
840 840
 		return $error;
@@ -850,23 +850,23 @@  discard block
 block discarded – undo
850 850
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 851
 		}
852 852
 		if ($error != '') return 'Import airlines.sql : '.$error;
853
-		if (!$Connection->checkColumnName('airlines','forsource')) {
853
+		if (!$Connection->checkColumnName('airlines', 'forsource')) {
854 854
 			// Add forsource to airlines
855 855
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
856 856
 			try {
857 857
 				$sth = $Connection->db->prepare($query);
858 858
 				$sth->execute();
859
-			} catch(PDOException $e) {
859
+			} catch (PDOException $e) {
860 860
 				return "error (add forsource column) : ".$e->getMessage()."\n";
861 861
 			}
862 862
 		}
863
-		if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) {
863
+		if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) {
864 864
 			// Add forsource to airlines
865 865
 			$query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
866 866
 			try {
867 867
 				$sth = $Connection->db->prepare($query);
868 868
 				$sth->execute();
869
-			} catch(PDOException $e) {
869
+			} catch (PDOException $e) {
870 870
 				return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n";
871 871
 			}
872 872
 			// Add unique key
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
 			try {
879 879
 				$sth = $Connection->db->prepare($query);
880 880
 				$sth->execute();
881
-			} catch(PDOException $e) {
881
+			} catch (PDOException $e) {
882 882
 				return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n";
883 883
 			}
884 884
 		}
885
-		if (!$Connection->checkColumnName('stats_airport','stats_airline')) {
885
+		if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) {
886 886
 			// Add forsource to airlines
887 887
 			$query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
888 888
 			try {
889 889
 				$sth = $Connection->db->prepare($query);
890 890
 				$sth->execute();
891
-			} catch(PDOException $e) {
891
+			} catch (PDOException $e) {
892 892
 				return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n";
893 893
 			}
894 894
 			// Add unique key
@@ -900,17 +900,17 @@  discard block
 block discarded – undo
900 900
 			try {
901 901
 				$sth = $Connection->db->prepare($query);
902 902
 				$sth->execute();
903
-			} catch(PDOException $e) {
903
+			} catch (PDOException $e) {
904 904
 				return "error (add unique key in stats_airport) : ".$e->getMessage()."\n";
905 905
 			}
906 906
 		}
907
-		if (!$Connection->checkColumnName('stats_country','stats_airline')) {
907
+		if (!$Connection->checkColumnName('stats_country', 'stats_airline')) {
908 908
 			// Add forsource to airlines
909 909
 			$query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
910 910
 			try {
911 911
 				$sth = $Connection->db->prepare($query);
912 912
 				$sth->execute();
913
-			} catch(PDOException $e) {
913
+			} catch (PDOException $e) {
914 914
 				return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n";
915 915
 			}
916 916
 			// Add unique key
@@ -922,36 +922,36 @@  discard block
 block discarded – undo
922 922
 			try {
923 923
 				$sth = $Connection->db->prepare($query);
924 924
 				$sth->execute();
925
-			} catch(PDOException $e) {
925
+			} catch (PDOException $e) {
926 926
 				return "error (add unique key in stats_airline) : ".$e->getMessage()."\n";
927 927
 			}
928 928
 		}
929
-		if (!$Connection->checkColumnName('stats_flight','stats_airline')) {
929
+		if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) {
930 930
 			// Add forsource to airlines
931 931
 			$query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
932 932
 			try {
933 933
 				$sth = $Connection->db->prepare($query);
934 934
 				$sth->execute();
935
-			} catch(PDOException $e) {
935
+			} catch (PDOException $e) {
936 936
 				return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n";
937 937
 			}
938 938
 		}
939
-		if (!$Connection->checkColumnName('stats','stats_airline')) {
939
+		if (!$Connection->checkColumnName('stats', 'stats_airline')) {
940 940
 			// Add forsource to airlines
941 941
 			$query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
942 942
 			try {
943 943
 				$sth = $Connection->db->prepare($query);
944 944
 				$sth->execute();
945
-			} catch(PDOException $e) {
945
+			} catch (PDOException $e) {
946 946
 				return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n";
947 947
 			}
948
-			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) {
948
+			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) {
949 949
 				// Add unique key
950 950
 				$query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);";
951 951
 				try {
952 952
 					$sth = $Connection->db->prepare($query);
953 953
 					$sth->execute();
954
-				} catch(PDOException $e) {
954
+				} catch (PDOException $e) {
955 955
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
956 956
 				}
957 957
 			} else {
@@ -964,18 +964,18 @@  discard block
 block discarded – undo
964 964
 				try {
965 965
 					$sth = $Connection->db->prepare($query);
966 966
 					$sth->execute();
967
-				} catch(PDOException $e) {
967
+				} catch (PDOException $e) {
968 968
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
969 969
 				}
970 970
 			}
971 971
 		}
972
-		if (!$Connection->checkColumnName('stats_registration','stats_airline')) {
972
+		if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) {
973 973
 			// Add forsource to airlines
974 974
 			$query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
975 975
 			try {
976 976
 				$sth = $Connection->db->prepare($query);
977 977
 				$sth->execute();
978
-			} catch(PDOException $e) {
978
+			} catch (PDOException $e) {
979 979
 				return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n";
980 980
 			}
981 981
 			// Add unique key
@@ -987,17 +987,17 @@  discard block
 block discarded – undo
987 987
 			try {
988 988
 				$sth = $Connection->db->prepare($query);
989 989
 				$sth->execute();
990
-			} catch(PDOException $e) {
990
+			} catch (PDOException $e) {
991 991
 				return "error (add unique key in stats_registration) : ".$e->getMessage()."\n";
992 992
 			}
993 993
 		}
994
-		if (!$Connection->checkColumnName('stats_callsign','filter_name')) {
994
+		if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) {
995 995
 			// Add forsource to airlines
996 996
 			$query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''";
997 997
 			try {
998 998
 				$sth = $Connection->db->prepare($query);
999 999
 				$sth->execute();
1000
-			} catch(PDOException $e) {
1000
+			} catch (PDOException $e) {
1001 1001
 				return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n";
1002 1002
 			}
1003 1003
 			// Add unique key
@@ -1009,17 +1009,17 @@  discard block
 block discarded – undo
1009 1009
 			try {
1010 1010
 				$sth = $Connection->db->prepare($query);
1011 1011
 				$sth->execute();
1012
-			} catch(PDOException $e) {
1012
+			} catch (PDOException $e) {
1013 1013
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1014 1014
 			}
1015 1015
 		}
1016
-		if (!$Connection->checkColumnName('stats_airline','filter_name')) {
1016
+		if (!$Connection->checkColumnName('stats_airline', 'filter_name')) {
1017 1017
 			// Add forsource to airlines
1018 1018
 			$query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1019 1019
 			try {
1020 1020
 				$sth = $Connection->db->prepare($query);
1021 1021
 				$sth->execute();
1022
-			} catch(PDOException $e) {
1022
+			} catch (PDOException $e) {
1023 1023
 				return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n";
1024 1024
 			}
1025 1025
 			// Add unique key
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 			try {
1032 1032
 				$sth = $Connection->db->prepare($query);
1033 1033
 				$sth->execute();
1034
-			} catch(PDOException $e) {
1034
+			} catch (PDOException $e) {
1035 1035
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1036 1036
 			}
1037 1037
 		}
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 		try {
1041 1041
 			$sth = $Connection->db->prepare($query);
1042 1042
 			$sth->execute();
1043
-		} catch(PDOException $e) {
1043
+		} catch (PDOException $e) {
1044 1044
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1045 1045
 		}
1046 1046
 		return $error;
@@ -1050,13 +1050,13 @@  discard block
 block discarded – undo
1050 1050
 		global $globalDBdriver;
1051 1051
 		$Connection = new Connection();
1052 1052
 		$error = '';
1053
-		if (!$Connection->checkColumnName('stats_owner','stats_airline')) {
1053
+		if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) {
1054 1054
 			// Add forsource to airlines
1055 1055
 			$query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1056 1056
 			try {
1057 1057
 				$sth = $Connection->db->prepare($query);
1058 1058
 				$sth->execute();
1059
-			} catch(PDOException $e) {
1059
+			} catch (PDOException $e) {
1060 1060
 				return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n";
1061 1061
 			}
1062 1062
 			// Add unique key
@@ -1068,17 +1068,17 @@  discard block
 block discarded – undo
1068 1068
 			try {
1069 1069
 				$sth = $Connection->db->prepare($query);
1070 1070
 				$sth->execute();
1071
-			} catch(PDOException $e) {
1071
+			} catch (PDOException $e) {
1072 1072
 				return "error (add unique key in stats_owner) : ".$e->getMessage()."\n";
1073 1073
 			}
1074 1074
 		}
1075
-		if (!$Connection->checkColumnName('stats_pilot','stats_airline')) {
1075
+		if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) {
1076 1076
 			// Add forsource to airlines
1077 1077
 			$query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1078 1078
 			try {
1079 1079
 				$sth = $Connection->db->prepare($query);
1080 1080
 				$sth->execute();
1081
-			} catch(PDOException $e) {
1081
+			} catch (PDOException $e) {
1082 1082
 				return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n";
1083 1083
 			}
1084 1084
 			// Add unique key
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 			try {
1091 1091
 				$sth = $Connection->db->prepare($query);
1092 1092
 				$sth->execute();
1093
-			} catch(PDOException $e) {
1093
+			} catch (PDOException $e) {
1094 1094
 				return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n";
1095 1095
 			}
1096 1096
 		}
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 		try {
1099 1099
 			$sth = $Connection->db->prepare($query);
1100 1100
 			$sth->execute();
1101
-		} catch(PDOException $e) {
1101
+		} catch (PDOException $e) {
1102 1102
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1103 1103
 		}
1104 1104
 		return $error;
@@ -1108,12 +1108,12 @@  discard block
 block discarded – undo
1108 1108
 		global $globalDBdriver;
1109 1109
 		$Connection = new Connection();
1110 1110
 		$error = '';
1111
-		if (!$Connection->checkColumnName('atc','format_source')) {
1111
+		if (!$Connection->checkColumnName('atc', 'format_source')) {
1112 1112
 			$query = "ALTER TABLE atc ADD format_source VARCHAR(255) DEFAULT NULL, ADD source_name VARCHAR(255) DEFAULT NULL";
1113 1113
 			try {
1114 1114
 				$sth = $Connection->db->prepare($query);
1115 1115
 				$sth->execute();
1116
-			} catch(PDOException $e) {
1116
+			} catch (PDOException $e) {
1117 1117
 				return "error (add format_source & source_name column in atc) : ".$e->getMessage()."\n";
1118 1118
 			}
1119 1119
 		}
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 		try {
1122 1122
 			$sth = $Connection->db->prepare($query);
1123 1123
 			$sth->execute();
1124
-		} catch(PDOException $e) {
1124
+		} catch (PDOException $e) {
1125 1125
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1126 1126
 		}
1127 1127
 		return $error;
@@ -1131,13 +1131,13 @@  discard block
 block discarded – undo
1131 1131
 		global $globalDBdriver;
1132 1132
 		$Connection = new Connection();
1133 1133
 		$error = '';
1134
-		if (!$Connection->checkColumnName('stats_pilot','format_source')) {
1134
+		if (!$Connection->checkColumnName('stats_pilot', 'format_source')) {
1135 1135
 			// Add forsource to airlines
1136 1136
 			$query = "ALTER TABLE stats_pilot ADD format_source VARCHAR(255) NULL DEFAULT ''";
1137 1137
 			try {
1138 1138
 				$sth = $Connection->db->prepare($query);
1139 1139
 				$sth->execute();
1140
-			} catch(PDOException $e) {
1140
+			} catch (PDOException $e) {
1141 1141
 				return "error (add format_source column in stats_pilot) : ".$e->getMessage()."\n";
1142 1142
 			}
1143 1143
 			// Add unique key
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			try {
1150 1150
 				$sth = $Connection->db->prepare($query);
1151 1151
 				$sth->execute();
1152
-			} catch(PDOException $e) {
1152
+			} catch (PDOException $e) {
1153 1153
 				return "error (modify unique key in stats_pilot) : ".$e->getMessage()."\n";
1154 1154
 			}
1155 1155
 		}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 		try {
1158 1158
 			$sth = $Connection->db->prepare($query);
1159 1159
 			$sth->execute();
1160
-		} catch(PDOException $e) {
1160
+		} catch (PDOException $e) {
1161 1161
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1162 1162
 		}
1163 1163
 		return $error;
@@ -1167,23 +1167,23 @@  discard block
 block discarded – undo
1167 1167
 		global $globalDBdriver;
1168 1168
 		$Connection = new Connection();
1169 1169
 		$error = '';
1170
-		if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live','latitude')) {
1170
+		if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live', 'latitude')) {
1171 1171
 			// Add unique key
1172 1172
 			$query = "alter table spotter_live add index(latitude,longitude)";
1173 1173
 			try {
1174 1174
 				$sth = $Connection->db->prepare($query);
1175 1175
 				$sth->execute();
1176
-			} catch(PDOException $e) {
1176
+			} catch (PDOException $e) {
1177 1177
 				return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n";
1178 1178
 			}
1179 1179
                 }
1180
-		if (!$Connection->checkColumnName('aircraft','mfr')) {
1180
+		if (!$Connection->checkColumnName('aircraft', 'mfr')) {
1181 1181
 			// Add mfr to aircraft
1182 1182
 			$query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL";
1183 1183
 			try {
1184 1184
 				$sth = $Connection->db->prepare($query);
1185 1185
 				$sth->execute();
1186
-			} catch(PDOException $e) {
1186
+			} catch (PDOException $e) {
1187 1187
 				return "error (add mfr column in aircraft) : ".$e->getMessage()."\n";
1188 1188
 			}
1189 1189
 		}
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 		try {
1200 1200
 			$sth = $Connection->db->prepare($query);
1201 1201
 			$sth->execute();
1202
-		} catch(PDOException $e) {
1202
+		} catch (PDOException $e) {
1203 1203
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1204 1204
 		}
1205 1205
 		return $error;
@@ -1209,13 +1209,13 @@  discard block
 block discarded – undo
1209 1209
 		global $globalDBdriver;
1210 1210
 		$Connection = new Connection();
1211 1211
 		$error = '';
1212
-		if ($Connection->checkColumnName('aircraft','mfr')) {
1212
+		if ($Connection->checkColumnName('aircraft', 'mfr')) {
1213 1213
 			// drop mfr to aircraft
1214 1214
 			$query = "ALTER TABLE aircraft DROP COLUMN mfr";
1215 1215
 			try {
1216 1216
 				$sth = $Connection->db->prepare($query);
1217 1217
 				$sth->execute();
1218
-			} catch(PDOException $e) {
1218
+			} catch (PDOException $e) {
1219 1219
 				return "error (drop mfr column in aircraft) : ".$e->getMessage()."\n";
1220 1220
 			}
1221 1221
 		}
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 		try {
1232 1232
 			$sth = $Connection->db->prepare($query);
1233 1233
 			$sth->execute();
1234
-		} catch(PDOException $e) {
1234
+		} catch (PDOException $e) {
1235 1235
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1236 1236
 		}
1237 1237
 		return $error;
@@ -1241,33 +1241,33 @@  discard block
 block discarded – undo
1241 1241
 		global $globalDBdriver;
1242 1242
 		$Connection = new Connection();
1243 1243
 		$error = '';
1244
-		if (!$Connection->indexExists('notam','ref_idx')) {
1244
+		if (!$Connection->indexExists('notam', 'ref_idx')) {
1245 1245
 			// Add index key
1246 1246
 			$query = "create index ref_idx on notam (ref)";
1247 1247
 			try {
1248 1248
 				$sth = $Connection->db->prepare($query);
1249 1249
 				$sth->execute();
1250
-			} catch(PDOException $e) {
1250
+			} catch (PDOException $e) {
1251 1251
 				return "error (add index ref on notam) : ".$e->getMessage()."\n";
1252 1252
 			}
1253 1253
                 }
1254
-		if (!$Connection->indexExists('accidents','registration_idx')) {
1254
+		if (!$Connection->indexExists('accidents', 'registration_idx')) {
1255 1255
 			// Add index key
1256 1256
 			$query = "create index registration_idx on accidents (registration)";
1257 1257
 			try {
1258 1258
 				$sth = $Connection->db->prepare($query);
1259 1259
 				$sth->execute();
1260
-			} catch(PDOException $e) {
1260
+			} catch (PDOException $e) {
1261 1261
 				return "error (add index registration on accidents) : ".$e->getMessage()."\n";
1262 1262
 			}
1263 1263
                 }
1264
-		if (!$Connection->indexExists('accidents','rdts')) {
1264
+		if (!$Connection->indexExists('accidents', 'rdts')) {
1265 1265
 			// Add index key
1266 1266
 			$query = "create index rdts on accidents (registration,date,type,source)";
1267 1267
 			try {
1268 1268
 				$sth = $Connection->db->prepare($query);
1269 1269
 				$sth->execute();
1270
-			} catch(PDOException $e) {
1270
+			} catch (PDOException $e) {
1271 1271
 				return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n";
1272 1272
 			}
1273 1273
                 }
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 		try {
1277 1277
 			$sth = $Connection->db->prepare($query);
1278 1278
 			$sth->execute();
1279
-		} catch(PDOException $e) {
1279
+		} catch (PDOException $e) {
1280 1280
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1281 1281
 		}
1282 1282
 		return $error;
@@ -1286,23 +1286,23 @@  discard block
 block discarded – undo
1286 1286
 		global $globalDBdriver;
1287 1287
 		$Connection = new Connection();
1288 1288
 		$error = '';
1289
-		if (!$Connection->checkColumnName('accidents','airline_name')) {
1289
+		if (!$Connection->checkColumnName('accidents', 'airline_name')) {
1290 1290
 			// Add airline_name to accidents
1291 1291
 			$query = "ALTER TABLE accidents ADD airline_name VARCHAR(255) NULL";
1292 1292
 			try {
1293 1293
 				$sth = $Connection->db->prepare($query);
1294 1294
 				$sth->execute();
1295
-			} catch(PDOException $e) {
1295
+			} catch (PDOException $e) {
1296 1296
 				return "error (add airline_name column in accidents) : ".$e->getMessage()."\n";
1297 1297
 			}
1298 1298
 		}
1299
-		if (!$Connection->checkColumnName('accidents','airline_icao')) {
1299
+		if (!$Connection->checkColumnName('accidents', 'airline_icao')) {
1300 1300
 			// Add airline_icao to accidents
1301 1301
 			$query = "ALTER TABLE accidents ADD airline_icao VARCHAR(10) NULL";
1302 1302
 			try {
1303 1303
 				$sth = $Connection->db->prepare($query);
1304 1304
 				$sth->execute();
1305
-			} catch(PDOException $e) {
1305
+			} catch (PDOException $e) {
1306 1306
 				return "error (add airline_icao column in accidents) : ".$e->getMessage()."\n";
1307 1307
 			}
1308 1308
 		}
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 		try {
1311 1311
 			$sth = $Connection->db->prepare($query);
1312 1312
 			$sth->execute();
1313
-		} catch(PDOException $e) {
1313
+		} catch (PDOException $e) {
1314 1314
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1315 1315
 		}
1316 1316
 		return $error;
@@ -1320,13 +1320,13 @@  discard block
 block discarded – undo
1320 1320
 		global $globalDBdriver, $globalVATSIM, $globalIVAO;
1321 1321
 		$Connection = new Connection();
1322 1322
 		$error = '';
1323
-		if (!$Connection->checkColumnName('airlines','alliance')) {
1323
+		if (!$Connection->checkColumnName('airlines', 'alliance')) {
1324 1324
 			// Add alliance to airlines
1325 1325
 			$query = "ALTER TABLE airlines ADD alliance VARCHAR(255) NULL";
1326 1326
 			try {
1327 1327
 				$sth = $Connection->db->prepare($query);
1328 1328
 				$sth->execute();
1329
-			} catch(PDOException $e) {
1329
+			} catch (PDOException $e) {
1330 1330
 				return "error (add alliance column in airlines) : ".$e->getMessage()."\n";
1331 1331
 			}
1332 1332
 		}
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 		try {
1354 1354
 			$sth = $Connection->db->prepare($query);
1355 1355
 			$sth->execute();
1356
-		} catch(PDOException $e) {
1356
+		} catch (PDOException $e) {
1357 1357
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1358 1358
 		}
1359 1359
 		return $error;
@@ -1363,13 +1363,13 @@  discard block
 block discarded – undo
1363 1363
 		global $globalDBdriver, $globalVATSIM, $globalIVAO;
1364 1364
 		$Connection = new Connection();
1365 1365
 		$error = '';
1366
-		if (!$Connection->checkColumnName('airlines','ban_eu')) {
1366
+		if (!$Connection->checkColumnName('airlines', 'ban_eu')) {
1367 1367
 			// Add ban_eu to airlines
1368 1368
 			$query = "ALTER TABLE airlines ADD ban_eu INTEGER NOT NULL DEFAULT '0'";
1369 1369
 			try {
1370 1370
 				$sth = $Connection->db->prepare($query);
1371 1371
 				$sth->execute();
1372
-			} catch(PDOException $e) {
1372
+			} catch (PDOException $e) {
1373 1373
 				return "error (add ban_eu column in airlines) : ".$e->getMessage()."\n";
1374 1374
 			}
1375 1375
 		}
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 		try {
1378 1378
 			$sth = $Connection->db->prepare($query);
1379 1379
 			$sth->execute();
1380
-		} catch(PDOException $e) {
1380
+		} catch (PDOException $e) {
1381 1381
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1382 1382
 		}
1383 1383
 		return $error;
@@ -1388,19 +1388,19 @@  discard block
 block discarded – undo
1388 1388
 		$Connection = new Connection();
1389 1389
 		$error = '';
1390 1390
 		if ($globalDBdriver == 'mysql') {
1391
-			if ($Connection->getColumnType('spotter_output','date') == 'TIMESTAMP' && $Connection->getColumnType('spotter_output','last_seen') != 'TIMESTAMP') {
1391
+			if ($Connection->getColumnType('spotter_output', 'date') == 'TIMESTAMP' && $Connection->getColumnType('spotter_output', 'last_seen') != 'TIMESTAMP') {
1392 1392
 				$query = "ALTER TABLE spotter_output CHANGE date date TIMESTAMP NULL DEFAULT NULL";
1393 1393
 				try {
1394 1394
 					$sth = $Connection->db->prepare($query);
1395 1395
 					$sth->execute();
1396
-				} catch(PDOException $e) {
1396
+				} catch (PDOException $e) {
1397 1397
 					return "error (delete default timestamp spotter_output) : ".$e->getMessage()."\n";
1398 1398
 				}
1399 1399
 				$query = "ALTER TABLE spotter_output MODIFY COLUMN last_seen timestamp not null default current_timestamp()";
1400 1400
 				try {
1401 1401
 					$sth = $Connection->db->prepare($query);
1402 1402
 					$sth->execute();
1403
-				} catch(PDOException $e) {
1403
+				} catch (PDOException $e) {
1404 1404
 					return "error (convert spotter_output last_seen to timestamp) : ".$e->getMessage()."\n";
1405 1405
 				}
1406 1406
 				
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
 				try {
1409 1409
 					$sth = $Connection->db->prepare($query);
1410 1410
 					$sth->execute();
1411
-				} catch(PDOException $e) {
1411
+				} catch (PDOException $e) {
1412 1412
 					return "error (delete default timestamp spotter_output) : ".$e->getMessage()."\n";
1413 1413
 				}
1414 1414
 				/*$query = "SELECT date,last_seen FROM spotter_output WHERE last_seen < date ORDER BY date DESC LIMIT 150";
@@ -1459,7 +1459,7 @@  discard block
 block discarded – undo
1459 1459
 				try {
1460 1460
 					$sth = $Connection->db->prepare($query);
1461 1461
 					$sth->execute();
1462
-				} catch(PDOException $e) {
1462
+				} catch (PDOException $e) {
1463 1463
 					return "error (fix date) : ".$e->getMessage()."\n";
1464 1464
 				}
1465 1465
 			}
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
 		try {
1545 1545
 			$sth = $Connection->db->prepare($query);
1546 1546
 			$sth->execute();
1547
-		} catch(PDOException $e) {
1547
+		} catch (PDOException $e) {
1548 1548
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1549 1549
 		}
1550 1550
 		return $error;
@@ -1553,13 +1553,13 @@  discard block
 block discarded – undo
1553 1553
 		global $globalDBdriver;
1554 1554
 		$Connection = new Connection();
1555 1555
 		$error = '';
1556
-		if (!$Connection->indexExists('accidents','type')) {
1556
+		if (!$Connection->indexExists('accidents', 'type')) {
1557 1557
 			// Add index key
1558 1558
 			$query = "create index type on accidents (type,date)";
1559 1559
 			try {
1560 1560
 				$sth = $Connection->db->prepare($query);
1561 1561
 				$sth->execute();
1562
-			} catch(PDOException $e) {
1562
+			} catch (PDOException $e) {
1563 1563
 				return "error (add index type on accidents) : ".$e->getMessage()."\n";
1564 1564
 			}
1565 1565
                 }
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
 		try {
1568 1568
 			$sth = $Connection->db->prepare($query);
1569 1569
 			$sth->execute();
1570
-		} catch(PDOException $e) {
1570
+		} catch (PDOException $e) {
1571 1571
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1572 1572
 		}
1573 1573
 		return $error;
@@ -1577,12 +1577,12 @@  discard block
 block discarded – undo
1577 1577
 		global $globalDBdriver;
1578 1578
 		$Connection = new Connection();
1579 1579
 		$error = '';
1580
-		if (!$Connection->checkColumnName('aircraft_modes','source_type')) {
1580
+		if (!$Connection->checkColumnName('aircraft_modes', 'source_type')) {
1581 1581
 			$query = "ALTER TABLE aircraft_modes ADD source_type VARCHAR(255) DEFAULT 'modes'";
1582 1582
 			try {
1583 1583
 				$sth = $Connection->db->prepare($query);
1584 1584
 				$sth->execute();
1585
-			} catch(PDOException $e) {
1585
+			} catch (PDOException $e) {
1586 1586
 				return "error (add source_type column in aircraft_modes) : ".$e->getMessage()."\n";
1587 1587
 			}
1588 1588
 		}
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
 		try {
1649 1649
 			$sth = $Connection->db->prepare($query);
1650 1650
 			$sth->execute();
1651
-		} catch(PDOException $e) {
1651
+		} catch (PDOException $e) {
1652 1652
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1653 1653
 		}
1654 1654
 		return $error;
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
 			try {
1697 1697
 				$sth = $Connection->db->prepare($query);
1698 1698
 				$sth->execute();
1699
-			} catch(PDOException $e) {
1699
+			} catch (PDOException $e) {
1700 1700
 				return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
1701 1701
 			}
1702 1702
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -1705,18 +1705,18 @@  discard block
 block discarded – undo
1705 1705
 				try {
1706 1706
 					$sth = $Connection->db->prepare($query);
1707 1707
 					$sth->execute();
1708
-				} catch(PDOException $e) {
1708
+				} catch (PDOException $e) {
1709 1709
 					return "error (Change table format from archive to InnoDB for spotter_archive) : ".$e->getMessage()."\n";
1710 1710
 				}
1711 1711
 			}
1712 1712
 		}
1713
-		if (!$Connection->indexExists('spotter_archive','flightaware_id_date_idx') && !$Connection->indexExists('spotter_archive','flightaware_id')) {
1713
+		if (!$Connection->indexExists('spotter_archive', 'flightaware_id_date_idx') && !$Connection->indexExists('spotter_archive', 'flightaware_id')) {
1714 1714
 			// Add index key
1715 1715
 			$query = "create index flightaware_id_date_idx on spotter_archive (flightaware_id,date)";
1716 1716
 			try {
1717 1717
 				$sth = $Connection->db->prepare($query);
1718 1718
 				$sth->execute();
1719
-			} catch(PDOException $e) {
1719
+			} catch (PDOException $e) {
1720 1720
 				return "error (add index flightaware_id, date on spotter_archive) : ".$e->getMessage()."\n";
1721 1721
 			}
1722 1722
                 }
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
 		try {
1725 1725
 			$sth = $Connection->db->prepare($query);
1726 1726
 			$sth->execute();
1727
-		} catch(PDOException $e) {
1727
+		} catch (PDOException $e) {
1728 1728
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1729 1729
 		}
1730 1730
 		return $error;
@@ -1735,148 +1735,148 @@  discard block
 block discarded – undo
1735 1735
 		$Connection = new Connection();
1736 1736
 		$error = '';
1737 1737
 		if ($globalDBdriver == 'mysql') {
1738
-			if (!$Connection->checkColumnName('marine_output','type_id')) {
1738
+			if (!$Connection->checkColumnName('marine_output', 'type_id')) {
1739 1739
 				$query = "ALTER TABLE marine_output ADD COLUMN type_id int(11) DEFAULT NULL";
1740 1740
 				try {
1741 1741
 					$sth = $Connection->db->prepare($query);
1742 1742
 					$sth->execute();
1743
-				} catch(PDOException $e) {
1743
+				} catch (PDOException $e) {
1744 1744
 					return "error (add column type_id in marine_output) : ".$e->getMessage()."\n";
1745 1745
 				}
1746 1746
 			}
1747
-			if (!$Connection->checkColumnName('marine_live','type_id')) {
1747
+			if (!$Connection->checkColumnName('marine_live', 'type_id')) {
1748 1748
 				$query = "ALTER TABLE marine_live ADD COLUMN type_id int(11) DEFAULT NULL";
1749 1749
 				try {
1750 1750
 					$sth = $Connection->db->prepare($query);
1751 1751
 					$sth->execute();
1752
-				} catch(PDOException $e) {
1752
+				} catch (PDOException $e) {
1753 1753
 					return "error (add column type_id in marine_live) : ".$e->getMessage()."\n";
1754 1754
 				}
1755 1755
 			}
1756
-			if (!$Connection->checkColumnName('marine_archive','type_id')) {
1756
+			if (!$Connection->checkColumnName('marine_archive', 'type_id')) {
1757 1757
 				$query = "ALTER TABLE marine_archive ADD COLUMN type_id int(11) DEFAULT NULL";
1758 1758
 				try {
1759 1759
 					$sth = $Connection->db->prepare($query);
1760 1760
 					$sth->execute();
1761
-				} catch(PDOException $e) {
1761
+				} catch (PDOException $e) {
1762 1762
 					return "error (add column type_id in marine_archive) : ".$e->getMessage()."\n";
1763 1763
 				}
1764 1764
 			}
1765
-			if (!$Connection->checkColumnName('marine_archive_output','type_id')) {
1765
+			if (!$Connection->checkColumnName('marine_archive_output', 'type_id')) {
1766 1766
 				$query = "ALTER TABLE marine_archive_output ADD COLUMN type_id int(11) DEFAULT NULL";
1767 1767
 				try {
1768 1768
 					$sth = $Connection->db->prepare($query);
1769 1769
 					$sth->execute();
1770
-				} catch(PDOException $e) {
1770
+				} catch (PDOException $e) {
1771 1771
 					return "error (add column type_id in marine_archive_output) : ".$e->getMessage()."\n";
1772 1772
 				}
1773 1773
 			}
1774
-			if (!$Connection->checkColumnName('marine_output','status_id')) {
1774
+			if (!$Connection->checkColumnName('marine_output', 'status_id')) {
1775 1775
 				$query = "ALTER TABLE marine_output ADD COLUMN status_id int(11) DEFAULT NULL";
1776 1776
 				try {
1777 1777
 					$sth = $Connection->db->prepare($query);
1778 1778
 					$sth->execute();
1779
-				} catch(PDOException $e) {
1779
+				} catch (PDOException $e) {
1780 1780
 					return "error (add column status_id in marine_output) : ".$e->getMessage()."\n";
1781 1781
 				}
1782 1782
 			}
1783
-			if (!$Connection->checkColumnName('marine_live','status_id')) {
1783
+			if (!$Connection->checkColumnName('marine_live', 'status_id')) {
1784 1784
 				$query = "ALTER TABLE marine_live ADD COLUMN status_id int(11) DEFAULT NULL";
1785 1785
 				try {
1786 1786
 					$sth = $Connection->db->prepare($query);
1787 1787
 					$sth->execute();
1788
-				} catch(PDOException $e) {
1788
+				} catch (PDOException $e) {
1789 1789
 					return "error (add column status_id in marine_live) : ".$e->getMessage()."\n";
1790 1790
 				}
1791 1791
 			}
1792
-			if (!$Connection->checkColumnName('marine_archive','status_id')) {
1792
+			if (!$Connection->checkColumnName('marine_archive', 'status_id')) {
1793 1793
 				$query = "ALTER TABLE marine_archive ADD COLUMN status_id int(11) DEFAULT NULL";
1794 1794
 				try {
1795 1795
 					$sth = $Connection->db->prepare($query);
1796 1796
 					$sth->execute();
1797
-				} catch(PDOException $e) {
1797
+				} catch (PDOException $e) {
1798 1798
 					return "error (add column status_id in marine_archive) : ".$e->getMessage()."\n";
1799 1799
 				}
1800 1800
 			}
1801
-			if (!$Connection->checkColumnName('marine_archive_output','status_id')) {
1801
+			if (!$Connection->checkColumnName('marine_archive_output', 'status_id')) {
1802 1802
 				$query = "ALTER TABLE marine_archive_output ADD COLUMN status_id int(11) DEFAULT NULL";
1803 1803
 				try {
1804 1804
 					$sth = $Connection->db->prepare($query);
1805 1805
 					$sth->execute();
1806
-				} catch(PDOException $e) {
1806
+				} catch (PDOException $e) {
1807 1807
 					return "error (add column status_id in marine_archive_output) : ".$e->getMessage()."\n";
1808 1808
 				}
1809 1809
 			}
1810 1810
 		} else {
1811
-			if (!$Connection->checkColumnName('marine_output','type_id')) {
1811
+			if (!$Connection->checkColumnName('marine_output', 'type_id')) {
1812 1812
 				$query = "ALTER TABLE marine_output ADD COLUMN type_id integer DEFAULT NULL";
1813 1813
 				try {
1814 1814
 					$sth = $Connection->db->prepare($query);
1815 1815
 					$sth->execute();
1816
-				} catch(PDOException $e) {
1816
+				} catch (PDOException $e) {
1817 1817
 					return "error (add column type_id in marine_output) : ".$e->getMessage()."\n";
1818 1818
 				}
1819 1819
 			}
1820
-			if (!$Connection->checkColumnName('marine_live','type_id')) {
1820
+			if (!$Connection->checkColumnName('marine_live', 'type_id')) {
1821 1821
 				$query = "ALTER TABLE marine_live ADD COLUMN type_id integer DEFAULT NULL";
1822 1822
 				try {
1823 1823
 					$sth = $Connection->db->prepare($query);
1824 1824
 					$sth->execute();
1825
-				} catch(PDOException $e) {
1825
+				} catch (PDOException $e) {
1826 1826
 					return "error (add column type_id in marine_live) : ".$e->getMessage()."\n";
1827 1827
 				}
1828 1828
 			}
1829
-			if (!$Connection->checkColumnName('marine_archive','type_id')) {
1829
+			if (!$Connection->checkColumnName('marine_archive', 'type_id')) {
1830 1830
 				$query = "ALTER TABLE marine_archive ADD COLUMN type_id integer DEFAULT NULL";
1831 1831
 				try {
1832 1832
 					$sth = $Connection->db->prepare($query);
1833 1833
 					$sth->execute();
1834
-				} catch(PDOException $e) {
1834
+				} catch (PDOException $e) {
1835 1835
 					return "error (add column type_id in marine_archive) : ".$e->getMessage()."\n";
1836 1836
 				}
1837 1837
 			}
1838
-			if (!$Connection->checkColumnName('marine_archive_output','type_id')) {
1838
+			if (!$Connection->checkColumnName('marine_archive_output', 'type_id')) {
1839 1839
 				$query = "ALTER TABLE marine_archive_output ADD COLUMN type_id integer DEFAULT NULL";
1840 1840
 				try {
1841 1841
 					$sth = $Connection->db->prepare($query);
1842 1842
 					$sth->execute();
1843
-				} catch(PDOException $e) {
1843
+				} catch (PDOException $e) {
1844 1844
 					return "error (add column type_id in marine_archive_output) : ".$e->getMessage()."\n";
1845 1845
 				}
1846 1846
 			}
1847
-			if (!$Connection->checkColumnName('marine_output','status_id')) {
1847
+			if (!$Connection->checkColumnName('marine_output', 'status_id')) {
1848 1848
 				$query = "ALTER TABLE marine_output ADD COLUMN status_id integer DEFAULT NULL";
1849 1849
 				try {
1850 1850
 					$sth = $Connection->db->prepare($query);
1851 1851
 					$sth->execute();
1852
-				} catch(PDOException $e) {
1852
+				} catch (PDOException $e) {
1853 1853
 					return "error (add column status_id in marine_output) : ".$e->getMessage()."\n";
1854 1854
 				}
1855 1855
 			}
1856
-			if (!$Connection->checkColumnName('marine_live','status_id')) {
1856
+			if (!$Connection->checkColumnName('marine_live', 'status_id')) {
1857 1857
 				$query = "ALTER TABLE marine_live ADD COLUMN status_id integer DEFAULT NULL";
1858 1858
 				try {
1859 1859
 					$sth = $Connection->db->prepare($query);
1860 1860
 					$sth->execute();
1861
-				} catch(PDOException $e) {
1861
+				} catch (PDOException $e) {
1862 1862
 					return "error (add column status_id in marine_live) : ".$e->getMessage()."\n";
1863 1863
 				}
1864 1864
 			}
1865
-			if (!$Connection->checkColumnName('marine_archive','status_id')) {
1865
+			if (!$Connection->checkColumnName('marine_archive', 'status_id')) {
1866 1866
 				$query = "ALTER TABLE marine_archive ADD COLUMN status_id integer DEFAULT NULL";
1867 1867
 				try {
1868 1868
 					$sth = $Connection->db->prepare($query);
1869 1869
 					$sth->execute();
1870
-				} catch(PDOException $e) {
1870
+				} catch (PDOException $e) {
1871 1871
 					return "error (add column status_id in marine_archive) : ".$e->getMessage()."\n";
1872 1872
 				}
1873 1873
 			}
1874
-			if (!$Connection->checkColumnName('marine_archive_output','status_id')) {
1874
+			if (!$Connection->checkColumnName('marine_archive_output', 'status_id')) {
1875 1875
 				$query = "ALTER TABLE marine_archive_output ADD COLUMN status_id integer DEFAULT NULL";
1876 1876
 				try {
1877 1877
 					$sth = $Connection->db->prepare($query);
1878 1878
 					$sth->execute();
1879
-				} catch(PDOException $e) {
1879
+				} catch (PDOException $e) {
1880 1880
 					return "error (add column status_id in marine_archive_output) : ".$e->getMessage()."\n";
1881 1881
 				}
1882 1882
 			}
@@ -1885,7 +1885,7 @@  discard block
 block discarded – undo
1885 1885
 		try {
1886 1886
 			$sth = $Connection->db->prepare($query);
1887 1887
 			$sth->execute();
1888
-		} catch(PDOException $e) {
1888
+		} catch (PDOException $e) {
1889 1889
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1890 1890
 		}
1891 1891
 		return $error;
@@ -1900,14 +1900,14 @@  discard block
 block discarded – undo
1900 1900
 			try {
1901 1901
 				$sth = $Connection->db->prepare($query);
1902 1902
 				$sth->execute();
1903
-			} catch(PDOException $e) {
1903
+			} catch (PDOException $e) {
1904 1904
 				return "error (change pilot_id type to varchar in stats_pilot) : ".$e->getMessage()."\n";
1905 1905
 			}
1906 1906
 			$query = "ALTER TABLE marine_identity MODIFY COLUMN mmsi varchar(255) DEFAULT NULL";
1907 1907
 			try {
1908 1908
 				$sth = $Connection->db->prepare($query);
1909 1909
 				$sth->execute();
1910
-			} catch(PDOException $e) {
1910
+			} catch (PDOException $e) {
1911 1911
 				return "error (change mmsi type to varchar in marine_identity) : ".$e->getMessage()."\n";
1912 1912
 			}
1913 1913
 		} else {
@@ -1915,14 +1915,14 @@  discard block
 block discarded – undo
1915 1915
 			try {
1916 1916
 				$sth = $Connection->db->prepare($query);
1917 1917
 				$sth->execute();
1918
-			} catch(PDOException $e) {
1918
+			} catch (PDOException $e) {
1919 1919
 				return "error (change pilot_id type to varchar in stats_pilot) : ".$e->getMessage()."\n";
1920 1920
 			}
1921 1921
 			$query = "alter table marine_identity alter column mmsi type varchar(255)";
1922 1922
 			try {
1923 1923
 				$sth = $Connection->db->prepare($query);
1924 1924
 				$sth->execute();
1925
-			} catch(PDOException $e) {
1925
+			} catch (PDOException $e) {
1926 1926
 				return "error (change mmsi type to varchar in marine_identity) : ".$e->getMessage()."\n";
1927 1927
 			}
1928 1928
 		}
@@ -1930,7 +1930,7 @@  discard block
 block discarded – undo
1930 1930
 		try {
1931 1931
 			$sth = $Connection->db->prepare($query);
1932 1932
 			$sth->execute();
1933
-		} catch(PDOException $e) {
1933
+		} catch (PDOException $e) {
1934 1934
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1935 1935
 		}
1936 1936
 		return $error;
@@ -1952,7 +1952,7 @@  discard block
 block discarded – undo
1952 1952
 		    try {
1953 1953
             		$sth = $Connection->db->prepare($query);
1954 1954
 		        $sth->execute();
1955
-		    } catch(PDOException $e) {
1955
+		    } catch (PDOException $e) {
1956 1956
 			return "error : ".$e->getMessage()."\n";
1957 1957
     		    }
1958 1958
     		    $result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -55,23 +55,23 @@  discard block
 block discarded – undo
55 55
 $min = true;
56 56
 $allhistory = false;
57 57
 $filter['source'] = array();
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
60
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
62
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
63
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
67
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
58
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
59
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
60
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
61
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
62
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
63
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
64
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
65
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
66
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
67
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
68 68
 
69 69
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
70 70
 	$min = true;
71 71
 } else $min = false;
72 72
 
73 73
 if (isset($_GET['ident'])) {
74
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
74
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
75 75
 	if ($tracker) {
76 76
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
77 77
 	} elseif ($marine) {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	}
86 86
 	$allhistory = true;
87 87
 } elseif (isset($_GET['flightaware_id'])) {
88
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
88
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
89 89
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
90 90
 	if (empty($spotter_array)) {
91 91
 		$from_archive = true;
@@ -93,44 +93,44 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 	$allhistory = true;
95 95
 } elseif (isset($_GET['famtrack_id'])) {
96
-	$famtrack_id = filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING);
96
+	$famtrack_id = filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING);
97 97
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
98 98
 	$allhistory = true;
99 99
 } elseif (isset($_GET['fammarine_id'])) {
100
-	$fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING);
100
+	$fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING);
101 101
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
102 102
 	$allhistory = true;
103 103
 } elseif (isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
104 104
 //} elseif (isset($_GET['coord'])) {
105 105
 	$usecoord = true;
106
-	$coord = explode(',',$_GET['coord']);
106
+	$coord = explode(',', $_GET['coord']);
107 107
 	if ($tracker) {
108
-		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
108
+		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter);
109 109
 	} elseif ($marine) {
110
-		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter);
110
+		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter);
111 111
 	} else {
112
-		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
112
+		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
113 113
 	}
114 114
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) {
115 115
 	$usecoord = true;
116
-	$coord = explode(',',$_GET['coord']);
116
+	$coord = explode(',', $_GET['coord']);
117 117
 	if ($tracker) {
118
-		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
118
+		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
119 119
 	} elseif ($marine) {
120
-		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
120
+		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
121 121
 	} else {
122
-		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
122
+		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
123 123
 	}
124 124
 } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) {
125 125
 	$from_archive = true;
126 126
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
127 127
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
128
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
129
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
130
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
131
-	$begindate = date('Y-m-d H:i:s',$begindate);
132
-	$enddate = date('Y-m-d H:i:s',$enddate);
133
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
128
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
129
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
130
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
131
+	$begindate = date('Y-m-d H:i:s', $begindate);
132
+	$enddate = date('Y-m-d H:i:s', $enddate);
133
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
134 134
 } elseif ($min) {
135 135
 	if ($tracker) {
136 136
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -142,18 +142,18 @@  discard block
 block discarded – undo
142 142
 #	$min = true;
143 143
 } else {
144 144
 	if ($tracker) {
145
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
145
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
146 146
 	} elseif ($marine) {
147
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
147
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
148 148
 	} else {
149
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
149
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
150 150
 	}
151 151
 }
152 152
 
153 153
 if (!empty($spotter_array) || $usecoord) {
154 154
 	if ($usecoord) {
155 155
 		if (isset($_GET['archive'])) {
156
-			$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
156
+			$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
157 157
 		} else {
158 158
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
159 159
 		}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	if ($flightcnt == '') $flightcnt = 0;
162 162
 } else $flightcnt = 0;
163 163
 
164
-$sqltime = round(microtime(true)-$begintime,2);
164
+$sqltime = round(microtime(true) - $begintime, 2);
165 165
 
166 166
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
167 167
 else $usenextlatlon = true;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		if (!empty($spotter_array) && is_array($spotter_array))
179 179
 		{
180 180
 			$output .= '"features": [';
181
-			foreach($spotter_array as $spotter_item)
181
+			foreach ($spotter_array as $spotter_item)
182 182
 			{
183 183
 				$j++;
184 184
 				date_default_timezone_set('UTC');
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 */
235 235
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
236 236
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
237
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
238
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
237
+							if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
238
+							else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",';
239 239
 							//"
240 240
 						} else {
241 241
 							if ($compress) $output .= '"c": "NA",';
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
245 245
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
246 246
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
247
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
247
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
248 248
 						} elseif (isset($spotter_item['aircraft_type'])) {
249 249
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
250 250
 						} elseif (!$min) {
@@ -384,16 +384,16 @@  discard block
 block discarded – undo
384 384
 						else $output .= '"heading": "'.$spotter_item['heading'].'",';
385 385
 						
386 386
 						if (isset($archivespeed)) {
387
-							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
387
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
388 388
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
389 389
 						} elseif ($usenextlatlon) {
390
-							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
390
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
391 391
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
392 392
 						}
393 393
 
394 394
 						if (!$min) $output .= '"image": "'.$image.'",';
395 395
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
396
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
396
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
397 397
 						}
398 398
 						if (isset($spotter_item['image_source_website'])) {
399 399
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
416 416
 						}
417 417
 						if (isset($spotter_item['acars'])) {
418
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
418
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
419 419
 						}
420 420
 						// type when not aircraft ?
421 421
 						if (isset($spotter_item['type'])) {
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
                 
494 494
 			}
495 495
 */
496
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
496
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
497 497
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
498 498
 				
499 499
 				if (
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
502 502
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
503 503
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
504
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
504
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
505 505
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
506
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
506
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
507 507
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
508
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
508
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
509 509
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
510 510
 				    ) {
511 511
 					if ($tracker) {
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
543 543
 							}
544 544
 							$output_history .= '[';
545
-							$output_history .=  $spotter_history['longitude'].', ';
546
-							$output_history .=  $spotter_history['latitude'].', ';
547
-							$output_history .=  $spotter_history['altitude']*30.48;
545
+							$output_history .= $spotter_history['longitude'].', ';
546
+							$output_history .= $spotter_history['latitude'].', ';
547
+							$output_history .= $spotter_history['altitude']*30.48;
548 548
 							$output_history .= '],';
549 549
 							/*
550 550
 							if ($from_archive === false) {
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
563 563
 							} else $d = true;
564 564
 							$output_history .= '[';
565
-							$output_history .=  $spotter_history['longitude'].', ';
566
-							$output_history .=  $spotter_history['latitude'];
565
+							$output_history .= $spotter_history['longitude'].', ';
566
+							$output_history .= $spotter_history['latitude'];
567 567
 							$output_history .= '],';
568 568
 							/*
569 569
 							if ($from_archive === false) {
@@ -579,9 +579,9 @@  discard block
 block discarded – undo
579 579
 					
580 580
 						if ($from_archive === false) {
581 581
 							$output_historyd = '[';
582
-							$output_historyd .=  $spotter_item['longitude'].', ';
583
-							$output_historyd .=  $spotter_item['latitude'];
584
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
582
+							$output_historyd .= $spotter_item['longitude'].', ';
583
+							$output_historyd .= $spotter_item['latitude'];
584
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
585 585
 							$output_historyd .= '],';
586 586
 							//$output_history = $output_historyd.$output_history;
587 587
 							$output_history = $output_history.$output_historyd;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 					}
596 596
 				}
597 597
 				
598
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
598
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
599 599
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
600 600
 				     && (isset($spotter_item['departure_airport']) 
601 601
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 
631 631
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
632 632
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
633
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
633
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
634 634
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
635 635
 				     && (isset($spotter_item['arrival_airport']) 
636 636
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 			$output  = substr($output, 0, -1);
662 662
 			$output .= ']';
663 663
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
664
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
664
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
665 665
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
666 666
 			$output .= '"fc": "'.$j.'"';
667 667
 		} else {
Please login to merge, or discard this patch.
require/class.SpotterImport.php 1 patch
Spacing   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 		$currentdate = date('Y-m-d');
34 34
 		$sourcestat = $Stats->getStatsSource($currentdate);
35 35
 		if (!empty($sourcestat)) {
36
-		    foreach($sourcestat as $srcst) {
36
+		    foreach ($sourcestat as $srcst) {
37 37
 		    	$type = $srcst['stats_type'];
38 38
 			if ($type == 'polar' || $type == 'hist') {
39 39
 			    $source = $srcst['source_name'];
40 40
 			    $data = $srcst['source_data'];
41
-			    $this->stats[$currentdate][$source][$type] = json_decode($data,true);
41
+			    $this->stats[$currentdate][$source][$type] = json_decode($data, true);
42 42
 	    		}
43 43
 		    }
44 44
 		}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     }
52 52
 
53
-    public function get_Schedule($id,$ident) {
53
+    public function get_Schedule($id, $ident) {
54 54
 	global $globalDebug, $globalFork, $globalSchedulesFetch;
55 55
 	// Get schedule here, so it's done only one time
56 56
 	
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 		$schedule = $Schedule->fetchSchedule($operator);
76 76
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
77 77
 		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
78
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
79
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
78
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime']));
79
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime']));
80 80
 		    // Should also check if route schedule = route from DB
81 81
 		    if ($schedule['DepartureAirportIATA'] != '') {
82 82
 			if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			    }
97 97
 			}
98 98
 		    }
99
-		    $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']);
99
+		    $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']);
100 100
 		}
101 101
 	    } else $scheduleexist = true;
102 102
 	} else $scheduleexist = true;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
        if ($scheduleexist) {
105 105
 		if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n";
106 106
     		$sch = $Schedule->getSchedule($operator);
107
-		$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']));
107
+		$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']));
108 108
        }
109 109
 	$Spotter->db = null;
110 110
 	$Schedule->db = null;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		    //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
132 132
     		    $Spotter = new Spotter($this->db);
133 133
         	    $real_arrival = $this->arrival($key);
134
-        	    if (isset($this->all_flights[$key]['altitude'])) $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']);
134
+        	    if (isset($this->all_flights[$key]['altitude'])) $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']);
135 135
         	}
136 136
 	    }
137 137
 	}
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         $airport_time = '';
146 146
         if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
147 147
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
148
-	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
148
+	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist);
149 149
     	    if (isset($closestAirports[0])) {
150 150
         	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
151 151
         	    $airport_icao = $closestAirports[0]['icao'];
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         		    break;
161 161
         		}
162 162
         	    }
163
-        	} 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))) {
163
+        	} 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))) {
164 164
         		$airport_icao = $closestAirports[0]['icao'];
165 165
         		$airport_time = $this->all_flights[$key]['datetime'];
166 166
         	} else {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         } else {
174 174
         	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
175 175
         }
176
-        return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
176
+        return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time);
177 177
     }
178 178
 
179 179
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
185 185
 	foreach ($this->all_flights as $key => $flight) {
186 186
 	    if (isset($flight['lastupdate'])) {
187
-		if ($flight['lastupdate'] < (time()-5900)) {
187
+		if ($flight['lastupdate'] < (time() - 5900)) {
188 188
 		    $this->delKey($key);
189 189
 		}
190 190
 	    }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			$real_arrival = $this->arrival($key);
201 201
 			$Spotter = new Spotter($this->db);
202 202
 			if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
203
-				$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']);
203
+				$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']);
204 204
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
205 205
 			}
206 206
 		}
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	$send = false;
234 234
 	
235 235
 	// SBS format is CSV format
236
-	if(is_array($line) && (isset($line['hex']) || isset($line['id']))) {
236
+	if (is_array($line) && (isset($line['hex']) || isset($line['id']))) {
237 237
 	    //print_r($line);
238 238
 	    if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']);
239 239
   	    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)) {
@@ -268,25 +268,25 @@  discard block
 block discarded – undo
268 268
 		
269 269
 		if (!isset($this->all_flights[$id])) {
270 270
 		    $this->all_flights[$id] = array();
271
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
272
-		    $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' => ''));
273
-		    if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
271
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0));
272
+		    $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' => ''));
273
+		    if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time()));
274 274
 		    if (!isset($line['id'])) {
275 275
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
276 276
 //			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')));
277 277
 //			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')));
278
-			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' || $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')));
278
+			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' || $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')));
279 279
 		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
280
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
280
+		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id']));
281 281
 		    if ($globalAllFlights !== FALSE) $dataFound = true;
282 282
 		}
283 283
 		if (isset($line['source_type']) && $line['source_type'] != '') {
284
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
284
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_type' => $line['source_type']));
285 285
 		}
286 286
 		
287 287
 		//print_r($this->all_flights);
288 288
 		if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) {
289
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
289
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => trim($line['hex'])));
290 290
 		    //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
291 291
 			//$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
292 292
 		    //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
@@ -295,13 +295,13 @@  discard block
 block discarded – undo
295 295
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
296 296
 			    $Spotter = new Spotter($this->db);
297 297
 			    if (isset($this->all_flights[$id]['source_type'])) {
298
-				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']);
298
+				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']), $this->all_flights[$id]['source_type']);
299 299
 			    } else {
300 300
 				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']));
301 301
 			    }
302 302
 			    $Spotter->db = null;
303
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
304
-			    if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
303
+			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
304
+			    if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao));
305 305
 			}
306 306
 		    }
307 307
 		    if ($globalAllFlights !== FALSE) $dataFound = true;
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 			$Spotter = new Spotter($this->db);
313 313
 			if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao];
314 314
 			$Spotter->db = null;
315
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao));
315
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $icao));
316 316
 		}
317 317
 		if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_name'])) {
318 318
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 				$Spotter = new Spotter($this->db);
321 321
 				$aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']);
322 322
 				$Spotter->db = null;
323
-				if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
323
+				if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao));
324 324
 			}
325 325
 		}
326 326
 		if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) {
@@ -328,15 +328,15 @@  discard block
 block discarded – undo
328 328
 			elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
329 329
 			elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
330 330
 			elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
331
-			if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
331
+			if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao));
332 332
 		}
333 333
 		if (!isset($this->all_flights[$id]['aircraft_icao'])) {
334
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA'));
334
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA'));
335 335
 		}
336 336
 		//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
337
-		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
337
+		if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) {
338 338
 		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
339
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
339
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime']));
340 340
 		    } else {
341 341
 				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";
342 342
 				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";
@@ -347,31 +347,31 @@  discard block
 block discarded – undo
347 347
 				*/
348 348
 				return '';
349 349
 		    }
350
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
350
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) {
351 351
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!";
352 352
 			return '';
353
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) {
353
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) {
354 354
 			if ($globalDebug) echo "!!! Date is in the future ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!";
355 355
 			return '';
356 356
 		} elseif (!isset($line['datetime'])) {
357 357
 			date_default_timezone_set('UTC');
358
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
358
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s')));
359 359
 		} else {
360 360
 			if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!";
361 361
 			return '';
362 362
 		}
363 363
 
364 364
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
365
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
365
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration']));
366 366
 		}
367 367
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
368
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
368
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints']));
369 369
 		}
370 370
 		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
371
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id'])));
371
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => trim($line['pilot_id'])));
372 372
 		}
373 373
 		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
374
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name'])));
374
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => trim($line['pilot_name'])));
375 375
 		}
376 376
  
377 377
 		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'])) {
@@ -379,13 +379,13 @@  discard block
 block discarded – undo
379 379
 		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
380 380
 			if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 2300) {
381 381
 				if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n";
382
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
383
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
384
-				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' || $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')));
385
-				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
386
-				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']));
382
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0));
383
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1));
384
+				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' || $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')));
385
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id']));
386
+				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']));
387 387
 			} else {
388
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
388
+			    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident'])));
389 389
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
390 390
 				$timeelapsed = microtime(true);
391 391
             			$Spotter = new Spotter($this->db);
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
 				elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
396 396
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
397 397
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
398
-            			$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
398
+            			$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource);
399 399
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
400 400
 				$Spotter->db = null;
401
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
401
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
402 402
 			    }
403 403
 			}
404
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
404
+		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident'])));
405 405
 		    
406 406
 /*
407 407
 		    if (!isset($line['id'])) {
@@ -411,25 +411,25 @@  discard block
 block discarded – undo
411 411
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
412 412
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
413 413
   */
414
-		    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']));
414
+		    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']));
415 415
 
416 416
 		    //$putinarchive = true;
417 417
 		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
418
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
418
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time']));
419 419
 		    }
420 420
 		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
421
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
421
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time']));
422 422
 		    }
423 423
 		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
424
-		    		$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' => ''));
424
+		    		$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' => ''));
425 425
 		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
426 426
 			$timeelapsed = microtime(true);
427 427
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
428 428
 				$Spotter = new Spotter($this->db);
429 429
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
430 430
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
431
-		    		$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' => ''));
432
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
431
+		    		$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' => ''));
432
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
433 433
                         }
434 434
 		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
435 435
 			$timeelapsed = microtime(true);
@@ -443,34 +443,34 @@  discard block
 block discarded – undo
443 443
 				$Translation->db = null;
444 444
 			    }
445 445
 			    $Spotter->db = null;
446
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
446
+			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
447 447
                     	}
448 448
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
449 449
 			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
450 450
 			    if ($route['fromairport_icao'] != $route['toairport_icao']) {
451 451
 				//    $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']));
452
-		    		$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']));
452
+		    		$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']));
453 453
 		    	    }
454 454
 			}
455 455
 			if (!isset($globalFork)) $globalFork = TRUE;
456 456
 			if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
457
-				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
457
+				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident']));
458 458
 			}
459 459
 		    }
460 460
 		}
461 461
 
462 462
 		if (isset($line['speed']) && $line['speed'] != '') {
463 463
 		//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
464
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
465
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
464
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed'])));
465
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true));
466 466
 		    //$dataFound = true;
467 467
 		} 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'])) {
468
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
468
+		    $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm');
469 469
 		    if ($distance > 1000 && $distance < 10000) {
470 470
 		    // use datetime
471 471
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
472 472
 			$speed = $speed*3.6;
473
-			if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
473
+			if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed)));
474 474
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
475 475
 		    }
476 476
 		}
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 
479 479
 
480 480
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude']) && !is_int($line['latitude']) && !is_int($line['longitude'])) {
481
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
481
+	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']);
482 482
 	    	    else unset($timediff);
483
-	    	    if ($this->tmd > 5 || (isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) {
483
+	    	    if ($this->tmd > 5 || (isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')))) {
484 484
 			if (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'])) {
485
-			    if ((isset($timediff) && $timediff > $globalAircraftMaxUpdate) || !$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'])) {
485
+			    if ((isset($timediff) && $timediff > $globalAircraftMaxUpdate) || !$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'])) {
486 486
 				$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
487 487
 				$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
488 488
 				$this->all_flights[$id]['putinarchive'] = true;
@@ -492,11 +492,11 @@  discard block
 block discarded – undo
492 492
 				    $timeelapsed = microtime(true);
493 493
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
494 494
 					$Spotter = new Spotter($this->db);
495
-					$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
495
+					$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']);
496 496
 					if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2'];
497 497
 					else $this->all_flights[$id]['over_country'] = '';
498 498
 					$Spotter->db = null;
499
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
499
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
500 500
 					if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
501 501
 				    }
502 502
 				}
@@ -506,13 +506,13 @@  discard block
 block discarded – undo
506 506
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
507 507
 			    //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
508 508
 				if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude'];
509
-				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') {
509
+				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') {
510 510
 				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
511 511
 				    $dataFound = true;
512 512
 				    $this->all_flights[$id]['time_last_coord'] = time();
513 513
 				}
514 514
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
515
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude']));
515
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude']));
516 516
 				/*
517 517
 				if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) {
518 518
 				    $this->all_flights[$id]['archive_latitude'] = $line['latitude'];
@@ -530,13 +530,13 @@  discard block
 block discarded – undo
530 530
 			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
531 531
 			    //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
532 532
 				if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude'];
533
-				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') {
533
+				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') {
534 534
 				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
535 535
 				    $dataFound = true;
536 536
 				    $this->all_flights[$id]['time_last_coord'] = time();
537 537
 				}
538 538
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
539
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude']));
539
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude']));
540 540
 				/*
541 541
 				if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) {
542 542
 				    $this->all_flights[$id]['archive_longitude'] = $line['longitude'];
@@ -554,46 +554,46 @@  discard block
 block discarded – undo
554 554
 		    } else if ($globalDebug && $timediff > 30) {
555 555
 			$this->tmd = $this->tmd + 1;
556 556
 			echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n";
557
-			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -";
558
-			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
557
+			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -";
558
+			echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - ";
559 559
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
560 560
 		    }
561 561
 		}
562 562
 		if (isset($line['last_update']) && $line['last_update'] != '') {
563 563
 		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
564
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
564
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update']));
565 565
 		}
566 566
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
567
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
567
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate']));
568 568
 		    //$dataFound = true;
569 569
 		}
570 570
 		if (isset($line['format_source']) && $line['format_source'] != '') {
571
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
571
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source']));
572 572
 		}
573 573
 		if (isset($line['source_name']) && $line['source_name'] != '') {
574
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
574
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name']));
575 575
 		}
576 576
 		if (isset($line['emergency']) && $line['emergency'] != '') {
577
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
577
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency']));
578 578
 		    //$dataFound = true;
579 579
 		}
580 580
 		if (isset($line['ground']) && $line['ground'] != '') {
581 581
 		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
582 582
 			// Here we force archive of flight because after ground it's a new one (or should be)
583
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
584
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
585
-			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' || $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')));
586
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
587
-			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']));
583
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0));
584
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1));
585
+			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' || $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')));
586
+		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id']));
587
+			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']));
588 588
 		    }
589 589
 		    if ($line['ground'] != 1) $line['ground'] = 0;
590
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
590
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground']));
591 591
 		    //$dataFound = true;
592 592
 		}
593 593
 		if (isset($line['squawk']) && $line['squawk'] != '') {
594 594
 		    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'])) {
595 595
 			    if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
596
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
596
+			    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk']));
597 597
 			    $highlight = '';
598 598
 			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
599 599
 			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
@@ -602,59 +602,59 @@  discard block
 block discarded – undo
602 602
 				$timeelapsed = microtime(true);
603 603
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
604 604
 				    $Spotter = new Spotter($this->db);
605
-				    $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
605
+				    $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight);
606 606
 				    $Spotter->db = null;
607
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
607
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
608 608
 				}
609 609
 				//$putinarchive = true;
610 610
 				//$highlight = '';
611 611
 			    }
612 612
 			    
613
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
613
+		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk']));
614 614
 		    //$dataFound = true;
615 615
 		}
616 616
 
617 617
 		if (isset($line['altitude']) && $line['altitude'] != '') {
618 618
 		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
619
-			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;
620
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
621
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
619
+			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;
620
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100)));
621
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude']));
622 622
 			//$dataFound = true;
623 623
 		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
624 624
 		    if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) {
625 625
 			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() - 2300) {
626 626
 				if ($globalDebug) echo '--- Reset because of altitude'."\n";
627
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
628
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
629
-				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' || $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')));
630
-				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
631
-				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']));
627
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0));
628
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1));
629
+				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' || $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')));
630
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id']));
631
+				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']));
632 632
 			}
633 633
 		    }
634
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude']));
634
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_previous' => $line['altitude']));
635 635
 		}
636 636
 
637 637
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
638
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
638
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true));
639 639
 		}
640 640
 		
641 641
 		if (isset($line['heading']) && $line['heading'] != '') {
642
-		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
643
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
644
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
642
+		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
643
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading'])));
644
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true));
645 645
 		    //$dataFound = true;
646 646
   		} 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']) {
647
-  		    $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']);
648
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
649
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
647
+  		    $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']);
648
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading)));
649
+		    if (abs($this->all_flights[$id]['heading'] - round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
650 650
   		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
651 651
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
652 652
   		    // If not enough messages and ACARS set heading to 0
653
-  		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
653
+  		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0));
654 654
   		}
655
-		if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
656
-		elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
657
-		elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalMinupdate) $dataFound = false;
655
+		if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
656
+		elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
657
+		elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalMinupdate) $dataFound = false;
658 658
 
659 659
 //		print_r($this->all_flights[$id]);
660 660
 		//gets the callsign from the last hour
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 		if ($dataFound === true && isset($this->all_flights[$id]['hex'])) {
665 665
 		    $this->all_flights[$id]['lastupdate'] = time();
666 666
 		    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) {
667
-		        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'])) {
667
+		        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'])) {
668 668
 			    //print_r($this->all_flights);
669 669
 			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
670 670
 			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
@@ -675,61 +675,61 @@  discard block
 block discarded – undo
675 675
 				    $SpotterLive = new SpotterLive($this->db);
676 676
 				    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' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
677 677
 					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
678
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
678
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
679 679
 				    } elseif (isset($line['id'])) {
680 680
 					$recent_ident = $SpotterLive->checkIdRecent($line['id']);
681
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
681
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
682 682
 				    } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
683 683
 					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
684
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
684
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
685 685
 				    } else $recent_ident = '';
686
-				    $SpotterLive->db=null;
686
+				    $SpotterLive->db = null;
687 687
 				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
688 688
 				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
689 689
 				} else $recent_ident = '';
690 690
 			    } else {
691 691
 				$recent_ident = '';
692
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
692
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0));
693 693
 			    }
694 694
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
695
-			    if($recent_ident == "")
695
+			    if ($recent_ident == "")
696 696
 			    {
697 697
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
698 698
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
699 699
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
700 700
 				//adds the spotter data for the archive
701 701
 				$ignoreImport = false;
702
-				foreach($globalAirportIgnore as $airportIgnore) {
702
+				foreach ($globalAirportIgnore as $airportIgnore) {
703 703
 				    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
704 704
 					$ignoreImport = true;
705 705
 				    }
706 706
 				}
707 707
 				if (count($globalAirportAccept) > 0) {
708 708
 				    $ignoreImport = true;
709
-				    foreach($globalAirportIgnore as $airportIgnore) {
709
+				    foreach ($globalAirportIgnore as $airportIgnore) {
710 710
 					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
711 711
 					    $ignoreImport = false;
712 712
 					}
713 713
 				    }
714 714
 				}
715 715
 				if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
716
-				    foreach($globalAirlineIgnore as $airlineIgnore) {
717
-					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)) {
716
+				    foreach ($globalAirlineIgnore as $airlineIgnore) {
717
+					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)) {
718 718
 					    $ignoreImport = true;
719 719
 					}
720 720
 				    }
721 721
 				}
722 722
 				if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
723 723
 				    $ignoreImport = true;
724
-				    foreach($globalAirlineAccept as $airlineAccept) {
725
-					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)) {
724
+				    foreach ($globalAirlineAccept as $airlineAccept) {
725
+					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)) {
726 726
 					    $ignoreImport = false;
727 727
 					}
728 728
 				    }
729 729
 				}
730 730
 				if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
731 731
 				    $ignoreImport = true;
732
-				    foreach($globalPilotIdAccept as $pilotIdAccept) {
732
+				    foreach ($globalPilotIdAccept as $pilotIdAccept) {
733 733
 					if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
734 734
 					    $ignoreImport = false;
735 735
 					}
@@ -741,32 +741,32 @@  discard block
 block discarded – undo
741 741
 				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
742 742
 				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
743 743
 				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
744
-				    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')));
744
+				    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')));
745 745
 				    $timeelapsed = microtime(true);
746 746
 				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
747 747
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
748 748
 					    $Spotter = new Spotter($this->db);
749
-					    $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']);
749
+					    $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']);
750 750
 					    $Spotter->db = null;
751 751
 					    if ($globalDebug && isset($result)) echo $result."\n";
752 752
 					}
753 753
 				    }
754
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
754
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
755 755
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
756 756
 
757 757
 				    // Add source stat in DB
758 758
 				    $Stats = new Stats($this->db);
759 759
 				    if (!empty($this->stats)) {
760 760
 					if ($globalDebug) echo 'Add source stats : ';
761
-				        foreach($this->stats as $date => $data) {
762
-					    foreach($data as $source => $sourced) {
761
+				        foreach ($this->stats as $date => $data) {
762
+					    foreach ($data as $source => $sourced) {
763 763
 					        //print_r($sourced);
764
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
765
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
764
+				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date);
765
+				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date);
766 766
 				    		if (isset($sourced['msg'])) {
767 767
 				    		    if (time() - $sourced['msg']['date'] > 10) {
768 768
 				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
769
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
769
+				    		        echo $Stats->addStatSource($nbmsg, $source, 'msg', $date);
770 770
 			    			        unset($this->stats[$date][$source]['msg']);
771 771
 			    			    }
772 772
 			    			}
@@ -804,14 +804,14 @@  discard block
 block discarded – undo
804 804
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
805 805
 					    $SpotterLive = new SpotterLive($this->db);
806 806
 					    $SpotterLive->deleteLiveSpotterData();
807
-					    $SpotterLive->db=null;
807
+					    $SpotterLive->db = null;
808 808
 					}
809 809
 				    }
810 810
 				    if ($globalDebug) echo " Done\n";
811 811
 				    $this->last_delete = time();
812 812
 				}
813 813
 			    } else {
814
-				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' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs')) {
814
+				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' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs')) {
815 815
 				    $this->all_flights[$id]['id'] = $recent_ident;
816 816
 				    $this->all_flights[$id]['addedSpotter'] = 1;
817 817
 				}
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
820 820
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
821 821
 					    $Spotter = new Spotter($this->db);
822
-					    $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']);
822
+					    $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']);
823 823
 					    $Spotter->db = null;
824 824
 					}
825 825
 				    }
@@ -845,37 +845,37 @@  discard block
 block discarded – undo
845 845
 		    if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
846 846
 		    if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
847 847
 
848
-		    foreach($globalAirportIgnore as $airportIgnore) {
848
+		    foreach ($globalAirportIgnore as $airportIgnore) {
849 849
 		        if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
850 850
 			    $ignoreImport = true;
851 851
 			}
852 852
 		    }
853 853
 		    if (count($globalAirportAccept) > 0) {
854 854
 		        $ignoreImport = true;
855
-		        foreach($globalAirportIgnore as $airportIgnore) {
855
+		        foreach ($globalAirportIgnore as $airportIgnore) {
856 856
 			    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
857 857
 				$ignoreImport = false;
858 858
 			    }
859 859
 			}
860 860
 		    }
861 861
 		    if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
862
-			foreach($globalAirlineIgnore as $airlineIgnore) {
863
-			    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)) {
862
+			foreach ($globalAirlineIgnore as $airlineIgnore) {
863
+			    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)) {
864 864
 				$ignoreImport = true;
865 865
 			    }
866 866
 			}
867 867
 		    }
868 868
 		    if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
869 869
 			$ignoreImport = true;
870
-			foreach($globalAirlineAccept as $airlineAccept) {
871
-			    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)) {
870
+			foreach ($globalAirlineAccept as $airlineAccept) {
871
+			    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)) {
872 872
 				$ignoreImport = false;
873 873
 			    }
874 874
 			}
875 875
 		    }
876 876
 		    if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
877 877
 			$ignoreImport = true;
878
-			foreach($globalPilotIdAccept as $pilotIdAccept) {
878
+			foreach ($globalPilotIdAccept as $pilotIdAccept) {
879 879
 			    if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
880 880
 			        $ignoreImport = false;
881 881
 			    }
@@ -883,23 +883,23 @@  discard block
 block discarded – undo
883 883
 		    }
884 884
 
885 885
 		    if (!$ignoreImport) {
886
-			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'])) {
887
-				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')));
886
+			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'])) {
887
+				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')));
888 888
 				$timeelapsed = microtime(true);
889 889
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
890 890
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
891 891
 					if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
892 892
 					$SpotterLive = new SpotterLive($this->db);
893
-					$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']);
893
+					$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']);
894 894
 					$SpotterLive->db = null;
895 895
 					if ($globalDebug) echo $result."\n";
896 896
 				    }
897 897
 				}
898 898
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) {
899
-					$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']);
899
+					$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']);
900 900
 				}
901 901
 				$this->all_flights[$id]['putinarchive'] = false;
902
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
902
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
903 903
 
904 904
 				// Put statistics in $this->stats variable
905 905
 				//if ($line['format_source'] != 'aprs') {
@@ -918,19 +918,19 @@  discard block
 block discarded – undo
918 918
 							$latitude = $globalCenterLatitude;
919 919
 							$longitude = $globalCenterLongitude;
920 920
 						}
921
-						$this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude);
921
+						$this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude);
922 922
 					} else {
923 923
 						$latitude = $this->source_location[$source]['latitude'];
924 924
 						$longitude = $this->source_location[$source]['longitude'];
925 925
 					}
926
-					$stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
926
+					$stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']);
927 927
 					//$stats_heading = $stats_heading%22.5;
928 928
 					$stats_heading = round($stats_heading/22.5);
929
-					$stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
929
+					$stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']);
930 930
 					$current_date = date('Y-m-d');
931 931
 					if ($stats_heading == 16) $stats_heading = 0;
932 932
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
933
-						for ($i=0;$i<=15;$i++) {
933
+						for ($i = 0; $i <= 15; $i++) {
934 934
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
935 935
 						}
936 936
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
@@ -945,9 +945,9 @@  discard block
 block discarded – undo
945 945
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
946 946
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
947 947
 						    end($this->stats[$current_date][$source]['hist']);
948
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
948
+						    $mini = key($this->stats[$current_date][$source]['hist']) + 10;
949 949
 						} else $mini = 0;
950
-						for ($i=$mini;$i<=$distance;$i+=10) {
950
+						for ($i = $mini; $i <= $distance; $i += 10) {
951 951
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
952 952
 						}
953 953
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 				$this->all_flights[$id]['lastupdate'] = time();
961 961
 				if ($this->all_flights[$id]['putinarchive']) $send = true;
962 962
 				//if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
963
-			} 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";
963
+			} 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";
964 964
 			//$this->del();
965 965
 			
966 966
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
Please login to merge, or discard this patch.
install/index.php 1 patch
Spacing   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 require_once(dirname(__FILE__).'/class.create_db.php');
11 11
 require_once(dirname(__FILE__).'/class.update_schema.php');
12 12
 require_once(dirname(__FILE__).'/class.settings.php');
13
-$title="Install";
13
+$title = "Install";
14 14
 require(dirname(__FILE__).'/../require/settings.php');
15 15
 require(dirname(__FILE__).'/header.php');
16 16
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 if (!extension_loaded('curl')) {
70 70
 	$error[] = "Curl is not loaded.";
71 71
 }
72
-if(function_exists('apache_get_modules') ){
73
-	if(!in_array('mod_rewrite',apache_get_modules())) {
72
+if (function_exists('apache_get_modules')) {
73
+	if (!in_array('mod_rewrite', apache_get_modules())) {
74 74
 		$error[] = "mod_rewrite is not available.";
75 75
 	}
76 76
 /*
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>';
87 87
 if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) {
88 88
 	if (function_exists('get_headers')) {
89
-		$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"])));
90
-		if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
89
+		$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"])));
90
+		if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) {
91 91
 			print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>';
92 92
 		}
93 93
 	}
@@ -441,13 +441,13 @@  discard block
 block discarded – undo
441 441
 ?>
442 442
 							<tr>
443 443
 								<?php
444
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
444
+								    if (filter_var($source['host'], FILTER_VALIDATE_URL)) {
445 445
 								?>
446 446
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
447 447
 								<td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td>
448 448
 								<?php
449 449
 								    } else {
450
-									$hostport = explode(':',$source['host']);
450
+									$hostport = explode(':', $source['host']);
451 451
 									if (isset($hostport[1])) {
452 452
 										$host = $hostport[0];
453 453
 										$port = $hostport[1];
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 			<br />
796 796
 			<p>
797 797
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
798
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
798
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" />
799 799
 			</p>
800 800
 			<br />
801 801
 			<p>
@@ -846,14 +846,14 @@  discard block
 block discarded – undo
846 846
 $error = '';
847 847
 
848 848
 if (isset($_POST['dbtype'])) {
849
-	$dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING);
850
-	$dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING);
851
-	$dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING);
852
-	$dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING);
853
-	$dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING);
854
-	$dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING);
855
-	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
856
-	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
849
+	$dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING);
850
+	$dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING);
851
+	$dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING);
852
+	$dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING);
853
+	$dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING);
854
+	$dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING);
855
+	$dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING);
856
+	$dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING);
857 857
 
858 858
 	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
859 859
 	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
@@ -873,48 +873,48 @@  discard block
 block discarded – undo
873 873
 	} else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
874 874
 	*/
875 875
 	
876
-	$settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
876
+	$settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname));
877 877
 
878
-	$sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING);
879
-	$siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING);
880
-	$timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING);
881
-	$language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING);
882
-	$settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language));
878
+	$sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING);
879
+	$siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING);
880
+	$timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING);
881
+	$language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
882
+	$settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language));
883 883
 
884
-	$mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING);
885
-	$mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING);
886
-	$mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING);
887
-	$googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING);
888
-	$bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING);
889
-	$mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING);
890
-	$hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING);
891
-	$hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING);
892
-	$settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey));
884
+	$mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING);
885
+	$mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING);
886
+	$mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING);
887
+	$googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING);
888
+	$bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING);
889
+	$mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING);
890
+	$hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING);
891
+	$hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING);
892
+	$settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey));
893 893
 	
894
-	$latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING);
895
-	$latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING);
896
-	$longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING);
897
-	$longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING);
898
-	$livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT);
899
-	$settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom));
894
+	$latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING);
895
+	$latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING);
896
+	$longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING);
897
+	$longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING);
898
+	$livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT);
899
+	$settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom));
900 900
 
901
-	$squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING);
902
-	$settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country));
901
+	$squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING);
902
+	$settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country));
903 903
 
904
-	$latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING);
905
-	$longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING);
906
-	$settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter));
904
+	$latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING);
905
+	$longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING);
906
+	$settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter));
907 907
 
908
-	$acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING);
908
+	$acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING);
909 909
 	if ($acars == 'acars') {
910
-		$settings = array_merge($settings,array('globalACARS' => 'TRUE'));
910
+		$settings = array_merge($settings, array('globalACARS' => 'TRUE'));
911 911
 	} else {
912
-		$settings = array_merge($settings,array('globalACARS' => 'FALSE'));
912
+		$settings = array_merge($settings, array('globalACARS' => 'FALSE'));
913 913
 	}
914 914
 
915
-	$flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING);
916
-	$flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING);
917
-	$settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword));
915
+	$flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING);
916
+	$flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING);
917
+	$settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword));
918 918
 	
919 919
 	$source_name = $_POST['source_name'];
920 920
 	$source_latitude = $_POST['source_latitude'];
@@ -928,8 +928,8 @@  discard block
 block discarded – undo
928 928
 	
929 929
 	$sources = array();
930 930
 	foreach ($source_name as $keys => $name) {
931
-	    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]);
932
-	    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]);
931
+	    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]);
932
+	    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]);
933 933
 	}
934 934
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
935 935
 
@@ -942,24 +942,24 @@  discard block
 block discarded – undo
942 942
 	$sbsurl = $_POST['sbsurl'];
943 943
 	*/
944 944
 
945
-	$globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING);
946
-	$globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING);
947
-	$globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING);
948
-	$globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING);
949
-	$globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING);
950
-	$globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING);
951
-	$globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING);
952
-	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
945
+	$globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING);
946
+	$globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING);
947
+	$globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING);
948
+	$globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING);
949
+	$globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING);
950
+	$globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING);
951
+	$globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING);
952
+	$datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING);
953 953
 
954
-	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
955
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
956
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
957
-	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
958
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
959
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
960
-	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
961
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
962
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
954
+	$globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING);
955
+	if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE'));
956
+	else $settings = array_merge($settings, array('globalAircraft' => 'FALSE'));
957
+	$globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING);
958
+	if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE'));
959
+	else $settings = array_merge($settings, array('globalTracker' => 'FALSE'));
960
+	$globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING);
961
+	if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE'));
962
+	else $settings = array_merge($settings, array('globalMarine' => 'FALSE'));
963 963
 
964 964
 /*	
965 965
 	$globalSBS1Hosts = array();
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
 	}
976 976
 	$settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts));
977 977
 */
978
-	$settings_comment = array_merge($settings_comment,array('globalSBS1Hosts'));
978
+	$settings_comment = array_merge($settings_comment, array('globalSBS1Hosts'));
979 979
 	$host = $_POST['host'];
980 980
 	$port = $_POST['port'];
981 981
 	$name = $_POST['name'];
@@ -990,96 +990,96 @@  discard block
 block discarded – undo
990 990
 		else $cov = 'FALSE';
991 991
 		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
992 992
 		else $arch = 'FALSE';
993
-		if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch);
993
+		if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch);
994 994
 	}
995
-	$settings = array_merge($settings,array('globalSources' => $gSources));
995
+	$settings = array_merge($settings, array('globalSources' => $gSources));
996 996
 
997 997
 /*
998 998
 	$sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT);
999 999
 	$settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout));
1000 1000
 */
1001
-	$acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING);
1002
-	$acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT);
1003
-	$settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport));
1001
+	$acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING);
1002
+	$acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT);
1003
+	$settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport));
1004 1004
 
1005
-	$bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING);
1006
-	$settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly));
1005
+	$bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING);
1006
+	$settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly));
1007 1007
 
1008
-	$notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING);
1009
-	$settings = array_merge($settings,array('globalNOTAMSource' => $notamsource));
1010
-	$metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING);
1011
-	$settings = array_merge($settings,array('globalMETARurl' => $metarsource));
1008
+	$notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING);
1009
+	$settings = array_merge($settings, array('globalNOTAMSource' => $notamsource));
1010
+	$metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING);
1011
+	$settings = array_merge($settings, array('globalMETARurl' => $metarsource));
1012 1012
 
1013
-	$zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING);
1014
-	$zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING);
1015
-	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1013
+	$zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING);
1014
+	$zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING);
1015
+	$zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT);
1016 1016
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1017
-		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1018
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1017
+		$settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance)));
1018
+	} else $settings = array_merge($settings, array('globalDistanceIgnore' => array()));
1019 1019
 
1020
-	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1021
-	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
1022
-	$maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT);
1023
-	$settings = array_merge($settings,array('globalMapRefresh' => $maprefresh));
1024
-	$mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT);
1025
-	$settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle));
1026
-	$closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT);
1027
-	$settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist));
1020
+	$refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT);
1021
+	$settings = array_merge($settings, array('globalLiveInterval' => $refresh));
1022
+	$maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT);
1023
+	$settings = array_merge($settings, array('globalMapRefresh' => $maprefresh));
1024
+	$mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT);
1025
+	$settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle));
1026
+	$closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT);
1027
+	$settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist));
1028 1028
 
1029
-	$aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT);
1030
-	$settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize));
1029
+	$aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT);
1030
+	$settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize));
1031 1031
 
1032
-	$archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT);
1033
-	$settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths));
1032
+	$archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT);
1033
+	$settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths));
1034 1034
 	
1035
-	$archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING);
1035
+	$archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING);
1036 1036
 	if ($archiveyear == "archiveyear") {
1037
-		$settings = array_merge($settings,array('globalArchiveYear' => 'TRUE'));
1037
+		$settings = array_merge($settings, array('globalArchiveYear' => 'TRUE'));
1038 1038
 	} else {
1039
-		$settings = array_merge($settings,array('globalArchiveYear' => 'FALSE'));
1039
+		$settings = array_merge($settings, array('globalArchiveYear' => 'FALSE'));
1040 1040
 	}
1041
-	$archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT);
1042
-	$settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths));
1043
-	$archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT);
1044
-	$settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1041
+	$archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT);
1042
+	$settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths));
1043
+	$archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT);
1044
+	$settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1045 1045
 
1046
-	$britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING);
1047
-	$settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways));
1048
-	$transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING);
1049
-	$settings = array_merge($settings,array('globalTransaviaKey' => $transavia));
1046
+	$britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING);
1047
+	$settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways));
1048
+	$transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING);
1049
+	$settings = array_merge($settings, array('globalTransaviaKey' => $transavia));
1050 1050
 
1051
-	$lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING);
1052
-	$lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING);
1053
-	$settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret)));
1051
+	$lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING);
1052
+	$lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING);
1053
+	$settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret)));
1054 1054
 
1055 1055
 	// Create in settings.php keys not yet configurable if not already here
1056 1056
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1057
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1057
+	if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE'));
1058 1058
 
1059
-	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1059
+	$resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING);
1060 1060
 	if ($resetyearstats == 'resetyearstats') {
1061
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE'));
1061
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE'));
1062 1062
 	} else {
1063
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE'));
1063
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE'));
1064 1064
 	}
1065 1065
 
1066
-	$archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING);
1066
+	$archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING);
1067 1067
 	if ($archive == 'archive') {
1068
-		$settings = array_merge($settings,array('globalArchive' => 'TRUE'));
1068
+		$settings = array_merge($settings, array('globalArchive' => 'TRUE'));
1069 1069
 	} else {
1070
-		$settings = array_merge($settings,array('globalArchive' => 'FALSE'));
1070
+		$settings = array_merge($settings, array('globalArchive' => 'FALSE'));
1071 1071
 	}
1072
-	$daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING);
1072
+	$daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING);
1073 1073
 	if ($daemon == 'daemon') {
1074
-		$settings = array_merge($settings,array('globalDaemon' => 'TRUE'));
1074
+		$settings = array_merge($settings, array('globalDaemon' => 'TRUE'));
1075 1075
 	} else {
1076
-		$settings = array_merge($settings,array('globalDaemon' => 'FALSE'));
1076
+		$settings = array_merge($settings, array('globalDaemon' => 'FALSE'));
1077 1077
 	}
1078
-	$schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING);
1078
+	$schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING);
1079 1079
 	if ($schedules == 'schedules') {
1080
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE'));
1080
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE'));
1081 1081
 	} else {
1082
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE'));
1082
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE'));
1083 1083
 	}
1084 1084
 
1085 1085
 /*
@@ -1090,201 +1090,201 @@  discard block
 block discarded – undo
1090 1090
 		$settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE'));
1091 1091
 	}
1092 1092
 */
1093
-	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1094
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1095
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1096
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1097
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1093
+	$settings = array_merge($settings, array('globalFlightAware' => 'FALSE'));
1094
+	if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE'));
1095
+	else $settings = array_merge($settings, array('globalSBS1' => 'FALSE'));
1096
+	if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE'));
1097
+	else $settings = array_merge($settings, array('globalAPRS' => 'FALSE'));
1098 1098
 	$va = false;
1099 1099
 	if ($globalivao == 'ivao') {
1100
-		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1100
+		$settings = array_merge($settings, array('globalIVAO' => 'TRUE'));
1101 1101
 		$va = true;
1102
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1102
+	} else $settings = array_merge($settings, array('globalIVAO' => 'FALSE'));
1103 1103
 	if ($globalvatsim == 'vatsim') {
1104
-		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1104
+		$settings = array_merge($settings, array('globalVATSIM' => 'TRUE'));
1105 1105
 		$va = true;
1106
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1106
+	} else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE'));
1107 1107
 	if ($globalphpvms == 'phpvms') {
1108
-		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1108
+		$settings = array_merge($settings, array('globalphpVMS' => 'TRUE'));
1109 1109
 		$va = true;
1110
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1110
+	} else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE'));
1111 1111
 	if ($globalvam == 'vam') {
1112
-		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1112
+		$settings = array_merge($settings, array('globalVAM' => 'TRUE'));
1113 1113
 		$va = true;
1114
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1114
+	} else $settings = array_merge($settings, array('globalVAM' => 'FALSE'));
1115 1115
 	if ($va) {
1116
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1117
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1116
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE'));
1117
+	} else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE'));
1118 1118
 	if ($globalva == 'va' || $va) {
1119
-		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1120
-	} else $settings = array_merge($settings,array('globalVA' => 'FALSE'));
1119
+		$settings = array_merge($settings, array('globalVA' => 'TRUE'));
1120
+	} else $settings = array_merge($settings, array('globalVA' => 'FALSE'));
1121 1121
 	
1122 1122
 
1123 1123
 
1124
-	$notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING);
1124
+	$notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING);
1125 1125
 	if ($notam == 'notam') {
1126
-		$settings = array_merge($settings,array('globalNOTAM' => 'TRUE'));
1126
+		$settings = array_merge($settings, array('globalNOTAM' => 'TRUE'));
1127 1127
 	} else {
1128
-		$settings = array_merge($settings,array('globalNOTAM' => 'FALSE'));
1128
+		$settings = array_merge($settings, array('globalNOTAM' => 'FALSE'));
1129 1129
 	}
1130
-	$owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING);
1130
+	$owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING);
1131 1131
 	if ($owner == 'owner') {
1132
-		$settings = array_merge($settings,array('globalOwner' => 'TRUE'));
1132
+		$settings = array_merge($settings, array('globalOwner' => 'TRUE'));
1133 1133
 	} else {
1134
-		$settings = array_merge($settings,array('globalOwner' => 'FALSE'));
1134
+		$settings = array_merge($settings, array('globalOwner' => 'FALSE'));
1135 1135
 	}
1136
-	$map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING);
1136
+	$map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING);
1137 1137
 	if ($map3d == 'map3d') {
1138
-		$settings = array_merge($settings,array('globalMap3D' => 'TRUE'));
1138
+		$settings = array_merge($settings, array('globalMap3D' => 'TRUE'));
1139 1139
 	} else {
1140
-		$settings = array_merge($settings,array('globalMap3D' => 'FALSE'));
1140
+		$settings = array_merge($settings, array('globalMap3D' => 'FALSE'));
1141 1141
 	}
1142
-	$crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING);
1142
+	$crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING);
1143 1143
 	if ($crash == 'crash') {
1144
-		$settings = array_merge($settings,array('globalAccidents' => 'TRUE'));
1144
+		$settings = array_merge($settings, array('globalAccidents' => 'TRUE'));
1145 1145
 	} else {
1146
-		$settings = array_merge($settings,array('globalAccidents' => 'FALSE'));
1146
+		$settings = array_merge($settings, array('globalAccidents' => 'FALSE'));
1147 1147
 	}
1148
-	$mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING);
1148
+	$mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING);
1149 1149
 	if ($mapsatellites == 'mapsatellites') {
1150
-		$settings = array_merge($settings,array('globalMapSatellites' => 'TRUE'));
1150
+		$settings = array_merge($settings, array('globalMapSatellites' => 'TRUE'));
1151 1151
 	} else {
1152
-		$settings = array_merge($settings,array('globalMapSatellites' => 'FALSE'));
1152
+		$settings = array_merge($settings, array('globalMapSatellites' => 'FALSE'));
1153 1153
 	}
1154
-	$map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING);
1154
+	$map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING);
1155 1155
 	if ($map3ddefault == 'map3ddefault') {
1156
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE'));
1156
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE'));
1157 1157
 	} else {
1158
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE'));
1158
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE'));
1159 1159
 	}
1160
-	$translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING);
1160
+	$translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING);
1161 1161
 	if ($translate == 'translate') {
1162
-		$settings = array_merge($settings,array('globalTranslate' => 'TRUE'));
1162
+		$settings = array_merge($settings, array('globalTranslate' => 'TRUE'));
1163 1163
 	} else {
1164
-		$settings = array_merge($settings,array('globalTranslate' => 'FALSE'));
1164
+		$settings = array_merge($settings, array('globalTranslate' => 'FALSE'));
1165 1165
 	}
1166
-	$realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING);
1166
+	$realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING);
1167 1167
 	if ($realairlines == 'realairlines') {
1168
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE'));
1168
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE'));
1169 1169
 	} else {
1170
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE'));
1170
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE'));
1171 1171
 	}
1172
-	$estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING);
1172
+	$estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING);
1173 1173
 	if ($estimation == 'estimation') {
1174
-		$settings = array_merge($settings,array('globalMapEstimation' => 'TRUE'));
1174
+		$settings = array_merge($settings, array('globalMapEstimation' => 'TRUE'));
1175 1175
 	} else {
1176
-		$settings = array_merge($settings,array('globalMapEstimation' => 'FALSE'));
1176
+		$settings = array_merge($settings, array('globalMapEstimation' => 'FALSE'));
1177 1177
 	}
1178
-	$metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING);
1178
+	$metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING);
1179 1179
 	if ($metar == 'metar') {
1180
-		$settings = array_merge($settings,array('globalMETAR' => 'TRUE'));
1180
+		$settings = array_merge($settings, array('globalMETAR' => 'TRUE'));
1181 1181
 	} else {
1182
-		$settings = array_merge($settings,array('globalMETAR' => 'FALSE'));
1182
+		$settings = array_merge($settings, array('globalMETAR' => 'FALSE'));
1183 1183
 	}
1184
-	$metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING);
1184
+	$metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING);
1185 1185
 	if ($metarcycle == 'metarcycle') {
1186
-		$settings = array_merge($settings,array('globalMETARcycle' => 'TRUE'));
1186
+		$settings = array_merge($settings, array('globalMETARcycle' => 'TRUE'));
1187 1187
 	} else {
1188
-		$settings = array_merge($settings,array('globalMETARcycle' => 'FALSE'));
1188
+		$settings = array_merge($settings, array('globalMETARcycle' => 'FALSE'));
1189 1189
 	}
1190
-	$fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING);
1190
+	$fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING);
1191 1191
 	if ($fork == 'fork') {
1192
-		$settings = array_merge($settings,array('globalFork' => 'TRUE'));
1192
+		$settings = array_merge($settings, array('globalFork' => 'TRUE'));
1193 1193
 	} else {
1194
-		$settings = array_merge($settings,array('globalFork' => 'FALSE'));
1194
+		$settings = array_merge($settings, array('globalFork' => 'FALSE'));
1195 1195
 	}
1196 1196
 
1197
-	$colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING);
1197
+	$colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING);
1198 1198
 	if ($colormap == 'colormap') {
1199
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE'));
1199
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE'));
1200 1200
 	} else {
1201
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE'));
1201
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE'));
1202 1202
 	}
1203 1203
 	
1204 1204
 	if (isset($_POST['aircrafticoncolor'])) {
1205
-		$aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING);
1206
-		$settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1)));
1205
+		$aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING);
1206
+		$settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1)));
1207 1207
 	}
1208 1208
 
1209
-	$airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT);
1210
-	$settings = array_merge($settings,array('globalAirportZoom' => $airportzoom));
1209
+	$airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT);
1210
+	$settings = array_merge($settings, array('globalAirportZoom' => $airportzoom));
1211 1211
 
1212
-	$unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING);
1213
-	$settings = array_merge($settings,array('globalUnitDistance' => $unitdistance));
1214
-	$unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING);
1215
-	$settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude));
1216
-	$unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING);
1217
-	$settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed));
1212
+	$unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING);
1213
+	$settings = array_merge($settings, array('globalUnitDistance' => $unitdistance));
1214
+	$unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING);
1215
+	$settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude));
1216
+	$unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING);
1217
+	$settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed));
1218 1218
 
1219
-	$mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING);
1219
+	$mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING);
1220 1220
 	if ($mappopup == 'mappopup') {
1221
-		$settings = array_merge($settings,array('globalMapPopup' => 'TRUE'));
1221
+		$settings = array_merge($settings, array('globalMapPopup' => 'TRUE'));
1222 1222
 	} else {
1223
-		$settings = array_merge($settings,array('globalMapPopup' => 'FALSE'));
1223
+		$settings = array_merge($settings, array('globalMapPopup' => 'FALSE'));
1224 1224
 	}
1225
-	$airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING);
1225
+	$airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING);
1226 1226
 	if ($airportpopup == 'airportpopup') {
1227
-		$settings = array_merge($settings,array('globalAirportPopup' => 'TRUE'));
1227
+		$settings = array_merge($settings, array('globalAirportPopup' => 'TRUE'));
1228 1228
 	} else {
1229
-		$settings = array_merge($settings,array('globalAirportPopup' => 'FALSE'));
1229
+		$settings = array_merge($settings, array('globalAirportPopup' => 'FALSE'));
1230 1230
 	}
1231
-	$maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING);
1231
+	$maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING);
1232 1232
 	if ($maphistory == 'maphistory') {
1233
-		$settings = array_merge($settings,array('globalMapHistory' => 'TRUE'));
1233
+		$settings = array_merge($settings, array('globalMapHistory' => 'TRUE'));
1234 1234
 	} else {
1235
-		$settings = array_merge($settings,array('globalMapHistory' => 'FALSE'));
1235
+		$settings = array_merge($settings, array('globalMapHistory' => 'FALSE'));
1236 1236
 	}
1237
-	$maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING);
1237
+	$maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING);
1238 1238
 	if ($maptooltip == 'maptooltip') {
1239
-		$settings = array_merge($settings,array('globalMapTooltip' => 'TRUE'));
1239
+		$settings = array_merge($settings, array('globalMapTooltip' => 'TRUE'));
1240 1240
 	} else {
1241
-		$settings = array_merge($settings,array('globalMapTooltip' => 'FALSE'));
1241
+		$settings = array_merge($settings, array('globalMapTooltip' => 'FALSE'));
1242 1242
 	}
1243
-	$flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING);
1243
+	$flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING);
1244 1244
 	if ($flightroute == 'flightroute') {
1245
-		$settings = array_merge($settings,array('globalMapRoute' => 'TRUE'));
1245
+		$settings = array_merge($settings, array('globalMapRoute' => 'TRUE'));
1246 1246
 	} else {
1247
-		$settings = array_merge($settings,array('globalMapRoute' => 'FALSE'));
1247
+		$settings = array_merge($settings, array('globalMapRoute' => 'FALSE'));
1248 1248
 	}
1249
-	$allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING);
1249
+	$allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING);
1250 1250
 	if ($allflights == 'allflights') {
1251
-		$settings = array_merge($settings,array('globalAllFlights' => 'TRUE'));
1251
+		$settings = array_merge($settings, array('globalAllFlights' => 'TRUE'));
1252 1252
 	} else {
1253
-		$settings = array_merge($settings,array('globalAllFlights' => 'FALSE'));
1253
+		$settings = array_merge($settings, array('globalAllFlights' => 'FALSE'));
1254 1254
 	}
1255
-	$bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING);
1255
+	$bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING);
1256 1256
 	if ($bbox == 'bbox') {
1257
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE'));
1257
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE'));
1258 1258
 	} else {
1259
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE'));
1259
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE'));
1260 1260
 	}
1261
-	$waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING);
1261
+	$waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING);
1262 1262
 	if ($waypoints == 'waypoints') {
1263
-		$settings = array_merge($settings,array('globalWaypoints' => 'TRUE'));
1263
+		$settings = array_merge($settings, array('globalWaypoints' => 'TRUE'));
1264 1264
 	} else {
1265
-		$settings = array_merge($settings,array('globalWaypoints' => 'FALSE'));
1265
+		$settings = array_merge($settings, array('globalWaypoints' => 'FALSE'));
1266 1266
 	}
1267
-	$noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING);
1267
+	$noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING);
1268 1268
 	if ($noairlines == 'noairlines') {
1269
-		$settings = array_merge($settings,array('globalNoAirlines' => 'TRUE'));
1269
+		$settings = array_merge($settings, array('globalNoAirlines' => 'TRUE'));
1270 1270
 	} else {
1271
-		$settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1271
+		$settings = array_merge($settings, array('globalNoAirlines' => 'FALSE'));
1272 1272
 	}
1273 1273
 
1274
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1274
+	if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE'));
1275 1275
 
1276 1276
 	// Set some defaults values...
1277 1277
 	if (!isset($globalAircraftImageSources)) {
1278
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1279
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1278
+	    $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
1279
+	    $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources));
1280 1280
 	}
1281 1281
 
1282 1282
 	if (!isset($globalSchedulesSources)) {
1283
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1284
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1283
+	    $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
1284
+    	    $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources));
1285 1285
     	}
1286 1286
 
1287
-	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1287
+	$settings = array_merge($settings, array('globalInstalled' => 'TRUE'));
1288 1288
 
1289 1289
 	if ($error == '') settings::modify_settings($settings);
1290 1290
 	if ($error == '') settings::comment_settings($settings_comment);
Please login to merge, or discard this patch.
require/class.NOTAM.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
 		try {
983 983
 			$sth = $this->db->prepare($query);
984 984
 			$sth->execute($query_values);
985
-		} catch(PDOException $e) {
985
+		} catch (PDOException $e) {
986 986
 			echo "error : ".$e->getMessage();
987 987
 		}
988 988
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1000,19 +1000,19 @@  discard block
 block discarded – undo
1000 1000
 		try {
1001 1001
 			$sth = $this->db->prepare($query);
1002 1002
 			$sth->execute($query_values);
1003
-		} catch(PDOException $e) {
1003
+		} catch (PDOException $e) {
1004 1004
 			echo "error : ".$e->getMessage();
1005 1005
 		}
1006 1006
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1007 1007
 		return $all;
1008 1008
 	}
1009 1009
 	public function getAllNOTAMtext() {
1010
-		$query  = 'SELECT full_notam FROM notam';
1010
+		$query = 'SELECT full_notam FROM notam';
1011 1011
 		$query_values = array();
1012 1012
 		try {
1013 1013
 			$sth = $this->db->prepare($query);
1014 1014
 			$sth->execute($query_values);
1015
-		} catch(PDOException $e) {
1015
+		} catch (PDOException $e) {
1016 1016
 			echo "error : ".$e->getMessage();
1017 1017
 		}
1018 1018
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1021,13 +1021,13 @@  discard block
 block discarded – undo
1021 1021
 	public function createNOTAMtextFile($filename) {
1022 1022
 		$allnotam_result = $this->getAllNOTAMtext();
1023 1023
 		$notamtext = '';
1024
-		foreach($allnotam_result as $notam) {
1024
+		foreach ($allnotam_result as $notam) {
1025 1025
 			$notamtext .= '%%'."\n";
1026 1026
 			$notamtext .= $notam['full_notam'];
1027 1027
 			$notamtext .= "\n".'%%'."\n";
1028 1028
 		}
1029 1029
 		//$allnotam = implode('\n%%%%\n',$allnotam_result);
1030
-		file_put_contents($filename,$notamtext);
1030
+		file_put_contents($filename, $notamtext);
1031 1031
 	}
1032 1032
 	public function parseNOTAMtextFile($filename) {
1033 1033
 		$data = file_get_contents($filename);
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 		try {
1049 1049
 			$sth = $this->db->prepare($query);
1050 1050
 			$sth->execute($query_values);
1051
-		} catch(PDOException $e) {
1051
+		} catch (PDOException $e) {
1052 1052
 			echo "error : ".$e->getMessage();
1053 1053
 		}
1054 1054
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1057,10 +1057,10 @@  discard block
 block discarded – undo
1057 1057
 	public function getAllNOTAMbyCoord($coord) {
1058 1058
 		global $globalDBdriver;
1059 1059
 		if (is_array($coord)) {
1060
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1061
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1062
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1063
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1060
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1061
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1062
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1063
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1064 1064
 			if ($minlat > $maxlat) {
1065 1065
 				$tmplat = $minlat;
1066 1066
 				$minlat = $maxlat;
@@ -1082,19 +1082,19 @@  discard block
 block discarded – undo
1082 1082
 		try {
1083 1083
 			$sth = $this->db->prepare($query);
1084 1084
 			$sth->execute($query_values);
1085
-		} catch(PDOException $e) {
1085
+		} catch (PDOException $e) {
1086 1086
 			echo "error : ".$e->getMessage();
1087 1087
 		}
1088 1088
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1089 1089
 		return $all;
1090 1090
 	}
1091
-	public function getAllNOTAMbyCoordScope($coord,$scope) {
1091
+	public function getAllNOTAMbyCoordScope($coord, $scope) {
1092 1092
 		global $globalDBdriver;
1093 1093
 		if (is_array($coord)) {
1094
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1095
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1096
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1097
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1094
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1095
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1096
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1097
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1098 1098
 		} else return array();
1099 1099
 		if ($globalDBdriver == 'mysql') {
1100 1100
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope';
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 		try {
1107 1107
 			$sth = $this->db->prepare($query);
1108 1108
 			$sth->execute($query_values);
1109
-		} catch(PDOException $e) {
1109
+		} catch (PDOException $e) {
1110 1110
 			echo "error : ".$e->getMessage();
1111 1111
 		}
1112 1112
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
 		try {
1119 1119
 			$sth = $this->db->prepare($query);
1120 1120
 			$sth->execute($query_values);
1121
-		} catch(PDOException $e) {
1121
+		} catch (PDOException $e) {
1122 1122
 			return "error : ".$e->getMessage();
1123 1123
 		}
1124 1124
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1126,13 +1126,13 @@  discard block
 block discarded – undo
1126 1126
 		else return array();
1127 1127
 	}
1128 1128
 
1129
-	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
1129
+	public function addNOTAM($ref, $title, $type, $fir, $code, $rules, $scope, $lower_limit, $upper_limit, $center_latitude, $center_longitude, $radius, $date_begin, $date_end, $permanent, $text, $full_notam) {
1130 1130
 		$query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)";
1131
-		$query_values = array(':ref' => $ref,':title' => $title,':type' => $type,':fir' => $fir,':code' => $code,':rules' => $rules,':scope' => $scope,':lower_limit' => $lower_limit,':upper_limit' => $upper_limit,':center_latitude' => $center_latitude,':center_longitude' => $center_longitude,':radius' => $radius,':date_begin' => $date_begin,':date_end' => $date_end,':permanent' => $permanent,':text' => $text,':full_notam' => $full_notam);
1131
+		$query_values = array(':ref' => $ref, ':title' => $title, ':type' => $type, ':fir' => $fir, ':code' => $code, ':rules' => $rules, ':scope' => $scope, ':lower_limit' => $lower_limit, ':upper_limit' => $upper_limit, ':center_latitude' => $center_latitude, ':center_longitude' => $center_longitude, ':radius' => $radius, ':date_begin' => $date_begin, ':date_end' => $date_end, ':permanent' => $permanent, ':text' => $text, ':full_notam' => $full_notam);
1132 1132
 		try {
1133 1133
 			$sth = $this->db->prepare($query);
1134 1134
 			$sth->execute($query_values);
1135
-		} catch(PDOException $e) {
1135
+		} catch (PDOException $e) {
1136 1136
 			return "error : ".$e->getMessage();
1137 1137
 		}
1138 1138
 	}
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
 		try {
1144 1144
 			$sth = $this->db->prepare($query);
1145 1145
 			$sth->execute($query_values);
1146
-		} catch(PDOException $e) {
1146
+		} catch (PDOException $e) {
1147 1147
 			return "error : ".$e->getMessage();
1148 1148
 		}
1149 1149
 	}
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 		try {
1159 1159
 			$sth = $this->db->prepare($query);
1160 1160
 			$sth->execute($query_values);
1161
-		} catch(PDOException $e) {
1161
+		} catch (PDOException $e) {
1162 1162
 			return "error : ".$e->getMessage();
1163 1163
 		}
1164 1164
 	}
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 		try {
1169 1169
 			$sth = $this->db->prepare($query);
1170 1170
 			$sth->execute($query_values);
1171
-		} catch(PDOException $e) {
1171
+		} catch (PDOException $e) {
1172 1172
 			return "error : ".$e->getMessage();
1173 1173
 		}
1174 1174
 	}
@@ -1177,7 +1177,7 @@  discard block
 block discarded – undo
1177 1177
 		try {
1178 1178
 			$sth = $this->db->prepare($query);
1179 1179
 			$sth->execute();
1180
-		} catch(PDOException $e) {
1180
+		} catch (PDOException $e) {
1181 1181
 			return "error : ".$e->getMessage();
1182 1182
 		}
1183 1183
 	}
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 		try {
1187 1187
 			$sth = $this->db->prepare($query);
1188 1188
 			$sth->execute();
1189
-		} catch(PDOException $e) {
1189
+		} catch (PDOException $e) {
1190 1190
 			return "error : ".$e->getMessage();
1191 1191
 		}
1192 1192
 	}
@@ -1194,14 +1194,14 @@  discard block
 block discarded – undo
1194 1194
 	public function updateNOTAM() {
1195 1195
 		global $globalNOTAMAirports;
1196 1196
 		if (isset($globalNOTAMAirports) && is_array($globalNOTAMAirports) && count($globalNOTAMAirports) > 0) {
1197
-			foreach (array_chunk($globalNOTAMAirports,10) as $airport) {
1198
-				$airport_icao = implode(',',$airport);
1197
+			foreach (array_chunk($globalNOTAMAirports, 10) as $airport) {
1198
+				$airport_icao = implode(',', $airport);
1199 1199
 				$alldata = $this->downloadNOTAM($airport_icao);
1200 1200
 				if (count($alldata) > 0) {
1201 1201
 					foreach ($alldata as $initial_data) {
1202 1202
 						$data = $this->parse($initial_data);
1203 1203
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1204
-						if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1204
+						if (count($notamref) == 0) $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1205 1205
 					}
1206 1206
 				}
1207 1207
 			}
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 			foreach ($alldata as $initial_data) {
1215 1215
 				$data = $this->parse($initial_data);
1216 1216
 				$notamref = $this->getNOTAMbyRef($data['ref']);
1217
-				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1217
+				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1218 1218
 			}
1219 1219
 		}
1220 1220
 	}
@@ -1223,12 +1223,12 @@  discard block
 block discarded – undo
1223 1223
 		global $globalTransaction;
1224 1224
 		$Spotter = new Spotter();
1225 1225
 		$allairports = $Spotter->getAllAirportInfo();
1226
-		foreach (array_chunk($allairports,20) as $airport) {
1226
+		foreach (array_chunk($allairports, 20) as $airport) {
1227 1227
 			$airports_icao = array();
1228
-			foreach($airport as $icao) {
1228
+			foreach ($airport as $icao) {
1229 1229
 				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1230 1230
 			}
1231
-			$airport_icao = implode(',',$airports_icao);
1231
+			$airport_icao = implode(',', $airports_icao);
1232 1232
 			$alldata = $this->downloadNOTAM($airport_icao);
1233 1233
 			if ($globalTransaction) $this->db->beginTransaction();
1234 1234
 			if (count($alldata) > 0) {
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
 						if (count($notamref) == 0) {
1242 1242
 							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1243 1243
 							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1244
-							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1244
+							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'], '', '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1245 1245
 						}
1246 1246
 					}
1247 1247
 				}
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 		date_default_timezone_set("UTC");
1256 1256
 		$Common = new Common();
1257 1257
 		//$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=DOMESTIC&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1258
-		$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1258
+		$url = str_replace('{icao}', $icao, 'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1259 1259
 		$data = $Common->getData($url);
1260 1260
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1261 1261
 		//print_r($matches);
@@ -1267,14 +1267,14 @@  discard block
 block discarded – undo
1267 1267
 		$Common = new Common();
1268 1268
 		$result = array();
1269 1269
 		$result['full_notam'] = $data;
1270
-		$data = str_ireplace(array("\r","\n",'\r','\n'),' ',$data);
1271
-		$data = preg_split('#(?=([A-Z]\)\s))#',$data);
1270
+		$data = str_ireplace(array("\r", "\n", '\r', '\n'), ' ', $data);
1271
+		$data = preg_split('#(?=([A-Z]\)\s))#', $data);
1272 1272
 		//print_r($data);
1273 1273
 		foreach ($data as $line) {
1274 1274
 			$line = trim($line);
1275
-			if (preg_match('#Q\) (.*)#',$line,$matches)) {
1276
-				$line = str_replace(' ','',$line);
1277
-				if (preg_match('#Q\)([A-Z]{3,4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3}|)#',$line,$matches)) {
1275
+			if (preg_match('#Q\) (.*)#', $line, $matches)) {
1276
+				$line = str_replace(' ', '', $line);
1277
+				if (preg_match('#Q\)([A-Z]{3,4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3}|)#', $line, $matches)) {
1278 1278
 				//if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#',$line,$matches)) {
1279 1279
 					//print_r($matches);
1280 1280
 					$result['fir'] = $matches[1];
@@ -1320,9 +1320,9 @@  discard block
 block discarded – undo
1320 1320
 					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1321 1321
 					$result['lower_limit'] = $matches[6];
1322 1322
 					$result['upper_limit'] = $matches[7];
1323
-					$latitude = $Common->convertDec($matches[8],'latitude');
1323
+					$latitude = $Common->convertDec($matches[8], 'latitude');
1324 1324
 					if ($matches[9] == 'S') $latitude = -$latitude;
1325
-					$longitude = $Common->convertDec($matches[10],'longitude');
1325
+					$longitude = $Common->convertDec($matches[10], 'longitude');
1326 1326
 					if ($matches[11] == 'W') $longitude = -$longitude;
1327 1327
 					$result['latitude'] = $latitude;
1328 1328
 					$result['longitude'] = $longitude;
@@ -1330,21 +1330,21 @@  discard block
 block discarded – undo
1330 1330
 					else $result['radius'] = 0;
1331 1331
 				} else echo 'ERROR : '.$line."\n";
1332 1332
 			}
1333
-			elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1333
+			elseif (preg_match('#A\) (.*)#', $line, $matches)) {
1334 1334
 				$result['icao'] = $matches[1];
1335 1335
 			}
1336
-			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1336
+			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#', $line, $matches)) {
1337 1337
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1338 1338
 				else $year = '20'.$matches[1];
1339 1339
 				$result['date_begin'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1340 1340
 			}
1341
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1341
+			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#', $line, $matches)) {
1342 1342
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1343 1343
 				else $year = '20'.$matches[1];
1344 1344
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1345 1345
 				$result['permanent'] = 0;
1346 1346
 			}
1347
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1347
+			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#', $line, $matches)) {
1348 1348
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1349 1349
 				else $year = '20'.$matches[1];
1350 1350
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
@@ -1353,26 +1353,26 @@  discard block
 block discarded – undo
1353 1353
 				if ($matches[6] == 'PERM') $result['permanent'] = 1;
1354 1354
 				else $result['permanent'] = 0;
1355 1355
 			}
1356
-			elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1356
+			elseif (preg_match('#C\) (EST|PERM)$#', $line, $matches)) {
1357 1357
 				$result['date_end'] = '2030/12/20 12:00';
1358 1358
 				if ($matches[1] == 'EST') $result['estimated'] = 1;
1359 1359
 				else $result['estimated'] = 0;
1360 1360
 				if ($matches[1] == 'PERM') $result['permanent'] = 1;
1361 1361
 				else $result['permanent'] = 0;
1362 1362
 			}
1363
-			elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1363
+			elseif (preg_match('#E\) (.*)#', $line, $matches)) {
1364 1364
 				$rtext = array();
1365
-				$text = explode(' ',$matches[1]);
1365
+				$text = explode(' ', $matches[1]);
1366 1366
 				foreach ($text as $word) {
1367 1367
 					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1368
-					elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1368
+					elseif (ctype_digit(strval(substr($word, 3))) && isset($this->abbr[substr($word, 0, 3)])) $rtext[] = strtoupper($this->abbr[substr($word, 0, 3)]).' '.substr($word, 3);
1369 1369
 					else $rtext[] = $word;
1370 1370
 				}
1371
-				$result['text'] = implode(' ',$rtext);
1371
+				$result['text'] = implode(' ', $rtext);
1372 1372
 			//} elseif (preg_match('#F\) (.*)#',$line,$matches)) {
1373 1373
 			//} elseif (preg_match('#G\) (.*)#',$line,$matches)) {
1374
-			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1375
-				$text = explode(' ',$line);
1374
+			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#', $line, $matches)) {
1375
+				$text = explode(' ', $line);
1376 1376
 				$result['ref'] = $text[0];
1377 1377
 				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1378 1378
 				if ($matches[1] == 'NOTAMC') {
Please login to merge, or discard this patch.
require/class.ATC.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@  discard block
 block discarded – undo
15 15
     * @param Array $filter the filter
16 16
     * @return Array the SQL part
17 17
     */
18
-    public function getFilter($filter = array(),$where = false,$and = false) {
18
+    public function getFilter($filter = array(), $where = false, $and = false) {
19 19
 	global $globalFilter, $globalStatsFilters, $globalFilterName;
20 20
 	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
21 21
 	    if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
22
-		foreach($globalStatsFilters[$globalFilterName] as $source) {
22
+		foreach ($globalStatsFilters[$globalFilterName] as $source) {
23 23
 			if (isset($source['source'])) $filter['source'][] = $source['source'];
24 24
 		}
25 25
 	    } else {
26 26
 		$filter = $globalStatsFilters[$globalFilterName];
27 27
 	    }
28 28
 	}
29
-	if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+	if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
30 30
 	$filter_query_join = '';
31 31
 	$filter_query_where = '';
32 32
 	if (isset($filter['source']) && !empty($filter['source'])) {
33
-	    $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
33
+	    $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
34 34
 	}
35 35
 	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
36 36
 	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                  try {
46 46
                         $sth = $this->db->prepare($query);
47 47
                         $sth->execute($query_values);
48
-                } catch(PDOException $e) {
48
+                } catch (PDOException $e) {
49 49
                         return "error : ".$e->getMessage();
50 50
                 }
51 51
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -53,66 +53,66 @@  discard block
 block discarded – undo
53 53
         }
54 54
 
55 55
 	public function getById($id) {
56
-    		$filter_query = $this->getFilter(array(),true);
56
+    		$filter_query = $this->getFilter(array(), true);
57 57
                 $query = "SELECT * FROM atc".$filter_query." atc_id = :id";
58 58
                 $query_values = array(':id' => $id);
59 59
                  try {
60 60
                         $sth = $this->db->prepare($query);
61 61
                         $sth->execute($query_values);
62
-                } catch(PDOException $e) {
62
+                } catch (PDOException $e) {
63 63
                         return "error : ".$e->getMessage();
64 64
                 }
65 65
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
66 66
                 return $all;
67 67
         }
68 68
 
69
-	public function getByIdent($ident,$format_source = '') {
70
-		$filter_query = $this->getFilter(array(),true);
69
+	public function getByIdent($ident, $format_source = '') {
70
+		$filter_query = $this->getFilter(array(), true);
71 71
 		if ($format_source == '') {
72 72
 			$query = "SELECT * FROM atc".$filter_query." ident = :ident";
73 73
 			$query_values = array(':ident' => $ident);
74 74
 		} else {
75 75
 			$query = "SELECT * FROM atc".$filter_query." ident = :ident AND format_source = :format_source";
76
-			$query_values = array(':ident' => $ident,':format_source' => $format_source);
76
+			$query_values = array(':ident' => $ident, ':format_source' => $format_source);
77 77
 		}
78 78
 		try {
79 79
 			$sth = $this->db->prepare($query);
80 80
 			$sth->execute($query_values);
81
-		} catch(PDOException $e) {
81
+		} catch (PDOException $e) {
82 82
 			return "error : ".$e->getMessage();
83 83
 		}
84 84
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
85 85
 		return $all;
86 86
 	}
87 87
 
88
-	public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
89
-		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
90
-		$info = str_replace('^','<br />',$info);
91
-		$info = str_replace('&amp;sect;','',$info);
92
-		$info = str_replace('"','',$info);
88
+	public function add($ident, $frequency, $latitude, $longitude, $range, $info, $date, $type = '', $ivao_id = '', $ivao_name = '', $format_source = '', $source_name = '') {
89
+		$info = preg_replace('/[^(\x20-\x7F)]*/', '', $info);
90
+		$info = str_replace('^', '<br />', $info);
91
+		$info = str_replace('&amp;sect;', '', $info);
92
+		$info = str_replace('"', '', $info);
93 93
 		if ($type == '') $type = NULL;
94 94
 		$query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
95
-		$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
95
+		$query_values = array(':ident' => $ident, ':frequency' => $frequency, ':latitude' => $latitude, ':longitude' => $longitude, ':range' => $range, ':info' => $info, ':date' => $date, ':ivao_id' => $ivao_id, ':ivao_name' => $ivao_name, ':type' => $type, ':format_source' => $format_source, ':source_name' => $source_name);
96 96
 		try {
97 97
 			$sth = $this->db->prepare($query);
98 98
 			$sth->execute($query_values);
99
-		} catch(PDOException $e) {
99
+		} catch (PDOException $e) {
100 100
 			return "error : ".$e->getMessage();
101 101
 		}
102 102
 	}
103 103
 
104
-	public function update($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
105
-		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
106
-		$info = str_replace('^','<br />',$info);
107
-		$info = str_replace('&amp;sect;','',$info);
108
-		$info = str_replace('"','',$info);
104
+	public function update($ident, $frequency, $latitude, $longitude, $range, $info, $date, $type = '', $ivao_id = '', $ivao_name = '', $format_source = '', $source_name = '') {
105
+		$info = preg_replace('/[^(\x20-\x7F)]*/', '', $info);
106
+		$info = str_replace('^', '<br />', $info);
107
+		$info = str_replace('&amp;sect;', '', $info);
108
+		$info = str_replace('"', '', $info);
109 109
 		if ($type == '') $type = NULL;
110 110
 		$query = "UPDATE atc SET frequency = :frequency,latitude = :latitude,longitude = :longitude,atc_range = :range,info = :info,atc_lastseen = :date,type = :type,ivao_id = :ivao_id,ivao_name = :ivao_name WHERE ident = :ident AND format_source = :format_source AND source_name = :source_name";
111
-		$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
111
+		$query_values = array(':ident' => $ident, ':frequency' => $frequency, ':latitude' => $latitude, ':longitude' => $longitude, ':range' => $range, ':info' => $info, ':date' => $date, ':ivao_id' => $ivao_id, ':ivao_name' => $ivao_name, ':type' => $type, ':format_source' => $format_source, ':source_name' => $source_name);
112 112
 		try {
113 113
 			$sth = $this->db->prepare($query);
114 114
 			$sth->execute($query_values);
115
-		} catch(PDOException $e) {
115
+		} catch (PDOException $e) {
116 116
 			return "error : ".$e->getMessage();
117 117
 		}
118 118
 	}
@@ -123,18 +123,18 @@  discard block
 block discarded – undo
123 123
                  try {
124 124
                         $sth = $this->db->prepare($query);
125 125
                         $sth->execute($query_values);
126
-                } catch(PDOException $e) {
126
+                } catch (PDOException $e) {
127 127
                         return "error : ".$e->getMessage();
128 128
                 }
129 129
         }
130 130
 
131
-       public function deleteByIdent($ident,$format_source) {
131
+       public function deleteByIdent($ident, $format_source) {
132 132
                 $query = "DELETE FROM atc WHERE ident = :ident AND format_source = :format_source";
133
-                $query_values = array(':ident' => $ident,':format_source' => $format_source);
133
+                $query_values = array(':ident' => $ident, ':format_source' => $format_source);
134 134
                  try {
135 135
                         $sth = $this->db->prepare($query);
136 136
                         $sth->execute($query_values);
137
-                } catch(PDOException $e) {
137
+                } catch (PDOException $e) {
138 138
                         return "error : ".$e->getMessage();
139 139
                 }
140 140
         }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                  try {
146 146
                         $sth = $this->db->prepare($query);
147 147
                         $sth->execute($query_values);
148
-                } catch(PDOException $e) {
148
+                } catch (PDOException $e) {
149 149
                         return "error : ".$e->getMessage();
150 150
                 }
151 151
         }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                 try {
161 161
                         $sth = $this->db->prepare($query);
162 162
                         $sth->execute();
163
-                } catch(PDOException $e) {
163
+                } catch (PDOException $e) {
164 164
                         return "error";
165 165
                 }
166 166
                 return "success";
Please login to merge, or discard this patch.
scripts/daemon-spotter.php 1 patch
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
 	    die;
46 46
 	}
47 47
 	//$hosts = array($globalSBS1Host.':'.$globalSBS1Port);
48
-	$globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port);
48
+	$globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port);
49 49
     }
50 50
 }
51 51
 
52
-$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver'));
52
+$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::', 'aprsserverhost::', 'aprsserverport::', 'format::', 'noaprsserver'));
53 53
 //if (isset($options['s'])) $hosts = array($options['s']);
54 54
 //elseif (isset($options['source'])) $hosts = array($options['source']);
55 55
 if (isset($options['s'])) {
56 56
     $globalSources = array();
57
-    if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']);
57
+    if (isset($options['format'])) $globalSources[] = array('host' => $options['s'], 'format' => $options['format']);
58 58
     else $globalSources[] = array('host' => $options['s']);
59 59
 } elseif (isset($options['source'])) {
60 60
     $globalSources = array();
61
-    if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']);
61
+    if (isset($options['format'])) $globalSources[] = array('host' => $options['source'], 'format' => $options['format']);
62 62
     else $globalSources[] = array('host' => $options['source']);
63 63
 }
64 64
 if (isset($options['aprsserverhost'])) {
@@ -75,27 +75,27 @@  discard block
 block discarded – undo
75 75
 else $id_source = 1;
76 76
 if (isset($globalServer) && $globalServer) {
77 77
     if ($globalDebug) echo "Using Server Mode\n";
78
-    $SI=new SpotterServer();
78
+    $SI = new SpotterServer();
79 79
 /*
80 80
     require_once(dirname(__FILE__).'/../require/class.APRS.php');
81 81
     $SI = new adsb2aprs();
82 82
     $SI->connect();
83 83
 */
84
-} else $SI=new SpotterImport($Connection->db);
84
+} else $SI = new SpotterImport($Connection->db);
85 85
 if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
86 86
 if (isset($globalMarine) && $globalMarine) {
87 87
     $AIS = new AIS();
88 88
     $MI = new MarineImport($Connection->db);
89 89
 }
90 90
 //$APRS=new APRS($Connection->db);
91
-$SBS=new SBS();
92
-$ACARS=new ACARS($Connection->db);
93
-$Common=new Common();
91
+$SBS = new SBS();
92
+$ACARS = new ACARS($Connection->db);
93
+$Common = new Common();
94 94
 date_default_timezone_set('UTC');
95 95
 //$servertz = system('date +%Z');
96 96
 // signal handler - playing nice with sockets and dump1090
97 97
 if (function_exists('pcntl_fork')) {
98
-    pcntl_signal(SIGINT,  function() {
98
+    pcntl_signal(SIGINT, function() {
99 99
         global $sockets;
100 100
         echo "\n\nctrl-c or kill signal received. Tidying up ... ";
101 101
         die("Bye!\n");
@@ -111,30 +111,30 @@  discard block
 block discarded – undo
111 111
 
112 112
 function connect_all($hosts) {
113 113
     //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
114
-    global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context;
114
+    global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context;
115 115
     $reset++;
116 116
     if ($globalDebug) echo 'Connect to all...'."\n";
117 117
     foreach ($hosts as $id => $value) {
118 118
 	$host = $value['host'];
119 119
 	$globalSources[$id]['last_exec'] = 0;
120 120
 	// Here we check type of source(s)
121
-	if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) {
122
-            if (preg_match('/deltadb.txt$/i',$host)) {
121
+	if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) {
122
+            if (preg_match('/deltadb.txt$/i', $host)) {
123 123
         	//$formats[$id] = 'deltadbtxt';
124 124
         	$globalSources[$id]['format'] = 'deltadbtxt';
125 125
         	//$last_exec['deltadbtxt'] = 0;
126 126
         	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
127
-            } else if (preg_match('/vatsim-data.txt$/i',$host)) {
127
+            } else if (preg_match('/vatsim-data.txt$/i', $host)) {
128 128
         	//$formats[$id] = 'vatsimtxt';
129 129
         	$globalSources[$id]['format'] = 'vatsimtxt';
130 130
         	//$last_exec['vatsimtxt'] = 0;
131 131
         	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
132
-    	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
132
+    	    } else if (preg_match('/aircraftlist.json$/i', $host)) {
133 133
         	//$formats[$id] = 'aircraftlistjson';
134 134
         	$globalSources[$id]['format'] = 'aircraftlistjson';
135 135
         	//$last_exec['aircraftlistjson'] = 0;
136 136
         	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
137
-    	    } else if (preg_match('/opensky/i',$host)) {
137
+    	    } else if (preg_match('/opensky/i', $host)) {
138 138
         	//$formats[$id] = 'aircraftlistjson';
139 139
         	$globalSources[$id]['format'] = 'opensky';
140 140
         	//$last_exec['aircraftlistjson'] = 0;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         	    exit(0);
152 152
         	}
153 153
     	    */
154
-    	    } else if (preg_match('/planeUpdateFAA.php$/i',$host)) {
154
+    	    } else if (preg_match('/planeUpdateFAA.php$/i', $host)) {
155 155
         	//$formats[$id] = 'planeupdatefaa';
156 156
         	$globalSources[$id]['format'] = 'planeupdatefaa';
157 157
         	//$last_exec['planeupdatefaa'] = 0;
@@ -160,26 +160,26 @@  discard block
 block discarded – undo
160 160
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
161 161
         	    exit(0);
162 162
         	}
163
-            } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) {
163
+            } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) {
164 164
         	//$formats[$id] = 'phpvmacars';
165 165
         	$globalSources[$id]['format'] = 'phpvmacars';
166 166
         	//$last_exec['phpvmacars'] = 0;
167 167
         	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
168
-            } else if (preg_match('/VAM-json.php$/i',$host)) {
168
+            } else if (preg_match('/VAM-json.php$/i', $host)) {
169 169
         	//$formats[$id] = 'phpvmacars';
170 170
         	$globalSources[$id]['format'] = 'vam';
171 171
         	if ($globalDebug) echo "Connect to Vam source (".$host.")...\n";
172
-            } else if (preg_match('/whazzup/i',$host)) {
172
+            } else if (preg_match('/whazzup/i', $host)) {
173 173
         	//$formats[$id] = 'whazzup';
174 174
         	$globalSources[$id]['format'] = 'whazzup';
175 175
         	//$last_exec['whazzup'] = 0;
176 176
         	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
177
-            } else if (preg_match('/recentpireps/i',$host)) {
177
+            } else if (preg_match('/recentpireps/i', $host)) {
178 178
         	//$formats[$id] = 'pirepsjson';
179 179
         	$globalSources[$id]['format'] = 'pirepsjson';
180 180
         	//$last_exec['pirepsjson'] = 0;
181 181
         	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
182
-            } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
182
+            } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) {
183 183
         	//$formats[$id] = 'fr24json';
184 184
         	$globalSources[$id]['format'] = 'fr24json';
185 185
         	//$last_exec['fr24json'] = 0;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
189 189
         	    exit(0);
190 190
         	}
191
-            } else if (preg_match(':myshiptracking.com/:i',$host)) {
191
+            } else if (preg_match(':myshiptracking.com/:i', $host)) {
192 192
         	//$formats[$id] = 'fr24json';
193 193
         	$globalSources[$id]['format'] = 'myshiptracking';
194 194
         	//$last_exec['fr24json'] = 0;
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
         	    exit(0);
199 199
         	}
200 200
             //} else if (preg_match('/10001/',$host)) {
201
-            } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
201
+            } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
202 202
         	//$formats[$id] = 'tsv';
203 203
         	$globalSources[$id]['format'] = 'tsv';
204 204
         	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
205 205
             }
206
-        } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
206
+        } elseif (filter_var($host, FILTER_VALIDATE_URL)) {
207 207
     		if ($globalSources[$id]['format'] == 'aisnmeahttp') {
208
-    		    $idf = fopen($globalSources[$id]['host'],'r',false,$context);
208
+    		    $idf = fopen($globalSources[$id]['host'], 'r', false, $context);
209 209
     		    if ($idf !== false) {
210 210
     			$httpfeeds[$id] = $idf;
211 211
         		if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n";
212 212
     		    }
213 213
     		    elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n";
214 214
     		} elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
215
-        } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
216
-	    $hostport = explode(':',$host);
215
+        } elseif (!filter_var($host, FILTER_VALIDATE_URL)) {
216
+	    $hostport = explode(':', $host);
217 217
 	    if (isset($hostport[1])) {
218 218
 		$port = $hostport[1];
219 219
 		$hostn = $hostport[0];
@@ -223,19 +223,19 @@  discard block
 block discarded – undo
223 223
 	    }
224 224
 	    $Common = new Common();
225 225
 	    if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) {
226
-        	$s = $Common->create_socket($hostn,$port, $errno, $errstr);
226
+        	$s = $Common->create_socket($hostn, $port, $errno, $errstr);
227 227
     	    } else {
228
-        	$s = $Common->create_socket_udp($hostn,$port, $errno, $errstr);
228
+        	$s = $Common->create_socket_udp($hostn, $port, $errno, $errstr);
229 229
 	    }
230 230
 	    if ($s) {
231 231
     	        $sockets[$id] = $s;
232 232
     	        if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') {
233
-		    if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') {
233
+		    if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') {
234 234
 			//$formats[$id] = 'aprs';
235 235
 			$globalSources[$id]['format'] = 'aprs';
236 236
 			//$aprs_connect = 0;
237 237
 			//$use_aprs = true;
238
-		    } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') {
238
+		    } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') {
239 239
 			$globalSources[$id]['format'] = 'vrstcp';
240 240
     		    } elseif ($port == '10001') {
241 241
         		//$formats[$id] = 'tsv';
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut;
275 275
 else $timeout = 20;
276 276
 $errno = '';
277
-$errstr='';
277
+$errstr = '';
278 278
 
279 279
 if (!isset($globalDaemon)) $globalDaemon = TRUE;
280 280
 /* Initiate connections to all the hosts simultaneously */
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 //connect_all($globalSources);
283 283
 
284 284
 if (isset($globalProxy) && $globalProxy) {
285
-    $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true)));
285
+    $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true)));
286 286
 } else {
287 287
     $context = stream_context_create(array('http' => array('timeout' => $timeout)));
288 288
 }
@@ -309,16 +309,16 @@  discard block
 block discarded – undo
309 309
 
310 310
 if ($use_aprs) {
311 311
 	require_once(dirname(__FILE__).'/../require/class.APRS.php');
312
-	$APRS=new APRS();
312
+	$APRS = new APRS();
313 313
 	$aprs_connect = 0;
314 314
 	$aprs_keep = 120;
315 315
 	$aprs_last_tx = time();
316 316
 	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
317
-	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
317
+	else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName);
318 318
 	if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid;
319
-	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
319
+	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8);
320 320
 	if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter;
321
-	else $aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
321
+	else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
322 322
 	if ($aprs_full) $aprs_filter = '';
323 323
 	if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass;
324 324
 	else $aprs_pass = '-1';
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 sleep(1);
333 333
 if ($globalDebug) echo "SCAN MODE \n\n";
334 334
 if (!isset($globalCronEnd)) $globalCronEnd = 60;
335
-$endtime = time()+$globalCronEnd;
335
+$endtime = time() + $globalCronEnd;
336 336
 $i = 1;
337 337
 $tt = array();
338 338
 // Delete all ATC
339 339
 if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
340
-	$ATC=new ATC($Connection->db);
340
+	$ATC = new ATC($Connection->db);
341 341
 }
342 342
 if (!$globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
343 343
 	$ATC->deleteAll();
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 
346 346
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
347 347
 while ($i > 0) {
348
-    if (!$globalDaemon) $i = $endtime-time();
348
+    if (!$globalDaemon) $i = $endtime - time();
349 349
     // Delete old ATC
350 350
     if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
351 351
 	if ($globalDebug) echo 'Delete old ATC...'."\n";
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	}
361 361
 	if ($max != $globalMinFetch) {
362 362
 	    if ($globalDebug) echo 'Sleeping...'."\n";
363
-	    sleep($globalMinFetch-$max+2);
363
+	    sleep($globalMinFetch - $max + 2);
364 364
 	}
365 365
     }
366 366
 
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
 	    //$buffer = $Common->getData($hosts[$id]);
374 374
 	    $buffer = $Common->getData($value['host']);
375 375
 	    if ($buffer != '') $reset = 0;
376
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
377
-	    $buffer = explode('\n',$buffer);
376
+    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
377
+	    $buffer = explode('\n', $buffer);
378 378
 	    foreach ($buffer as $line) {
379 379
     		if ($line != '' && count($line) > 7) {
380 380
     		    $line = explode(',', $line);
@@ -402,11 +402,11 @@  discard block
 block discarded – undo
402 402
     	    $last_exec[$id]['last'] = time();
403 403
 	} elseif ($value['format'] == 'aisnmeatxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) {
404 404
 	    date_default_timezone_set('CET');
405
-	    $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host']));
405
+	    $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host']));
406 406
 	    date_default_timezone_set('UTC');
407 407
 	    if ($buffer != '') $reset = 0;
408
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
409
-	    $buffer = explode('\n',$buffer);
408
+    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
409
+	    $buffer = explode('\n', $buffer);
410 410
 	    foreach ($buffer as $line) {
411 411
 		if ($line != '') {
412 412
 		    echo "'".$line."'\n";
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
425 425
 		    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
426 426
 		    if (isset($ais_data['timestamp'])) {
427
-			$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
427
+			$data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']);
428 428
 			if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) {
429 429
 			    $last_exec[$id]['timestamp'] = $ais_data['timestamp'];
430 430
 			    $add = true;
@@ -447,12 +447,12 @@  discard block
 block discarded – undo
447 447
 	    $w = $e = null;
448 448
 	    
449 449
 	    if (isset($arr[$id])) {
450
-		$nn = stream_select($arr,$w,$e,$timeout);
450
+		$nn = stream_select($arr, $w, $e, $timeout);
451 451
 		if ($nn > 0) {
452 452
 		    foreach ($httpfeeds as $feed) {
453
-			$buffer = stream_get_line($feed,2000,"\n");
454
-			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
455
-			$buffer = explode('\n',$buffer);
453
+			$buffer = stream_get_line($feed, 2000, "\n");
454
+			$buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
455
+			$buffer = explode('\n', $buffer);
456 456
 			foreach ($buffer as $line) {
457 457
 			    if ($line != '') {
458 458
 				$ais_data = $AIS->parse_line(trim($line));
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
 				if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
471 471
 				if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
472 472
 				if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
473
-				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
473
+				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']);
474 474
 				if (isset($ais_data['timestamp'])) {
475
-				    $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
475
+				    $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']);
476 476
 				} else {
477 477
 				    $data['datetime'] = date('Y-m-d H:i:s');
478 478
 				}
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
 		}
499 499
 	    }
500 500
 	} elseif ($value['format'] == 'myshiptracking' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) {
501
-	    $buffer = $Common->getData($value['host'],'get','','','','','20');
501
+	    $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20');
502 502
 	    if ($buffer != '') {
503 503
 		//echo $buffer;
504
-		$all_data = json_decode($buffer,true);
504
+		$all_data = json_decode($buffer, true);
505 505
 		//print_r($all_data);
506 506
 		if (isset($all_data[0]['DATA'])) {
507 507
 		    foreach ($all_data[0]['DATA'] as $line) {
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 			    //    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
517 517
 			    $data['imo'] = $line['IMO'];
518 518
 			    //$data['arrival_code'] = $ais_data['destination'];
519
-			    $data['datetime'] = date('Y-m-d H:i:s',$line['T']);
519
+			    $data['datetime'] = date('Y-m-d H:i:s', $line['T']);
520 520
 			    $data['format_source'] = 'myshiptracking';
521 521
 			    $data['id_source'] = $id_source;
522 522
 			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
 	    }
529 529
 	    $last_exec[$id]['last'] = time();
530 530
 	} elseif ($value['format'] == 'boatbeaconapp' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) {
531
-	    $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host']));
531
+	    $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host']));
532 532
 	    if ($buffer != '') {
533
-		$all_data = json_decode($buffer,true);
533
+		$all_data = json_decode($buffer, true);
534 534
 		if (isset($all_data[0]['mmsi'])) {
535 535
 		    foreach ($all_data as $line) {
536 536
 			if ($line != '') {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 	} elseif ($value['format'] == 'boatnerd' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) {
560 560
 	    $buffer = $Common->getData($value['host']);
561 561
 	    if ($buffer != '') {
562
-		$all_data = json_decode($buffer,true);
562
+		$all_data = json_decode($buffer, true);
563 563
 		if (isset($all_data['features'][0]['id'])) {
564 564
 		    foreach ($all_data['features'] as $line) {
565 565
 			$data = array();
@@ -587,27 +587,27 @@  discard block
 block discarded – undo
587 587
     	    $last_exec[$id]['last'] = time();
588 588
 	} elseif ($value['format'] == 'shipplotter' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) {
589 589
 	    echo 'download...';
590
-	    $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter');
590
+	    $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter');
591 591
 	    echo 'done !'."\n";
592 592
 	    if ($buffer != '') $reset = 0;
593
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
594
-	    $buffer = explode('\n',$buffer);
593
+    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
594
+	    $buffer = explode('\n', $buffer);
595 595
 	    foreach ($buffer as $line) {
596 596
 		if ($line != '') {
597 597
 		    $data = array();
598
-		    $data['mmsi'] = (int)substr($line,0,9);
599
-		    $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10));
598
+		    $data['mmsi'] = (int) substr($line, 0, 9);
599
+		    $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10));
600 600
 		    //$data['status'] = substr($line,21,2);
601 601
 		    //$data['type'] = substr($line,24,3);
602
-		    $data['latitude'] = substr($line,29,9);
603
-		    $data['longitude'] = substr($line,41,9);
604
-		    $data['speed'] = round(substr($line,51,5));
602
+		    $data['latitude'] = substr($line, 29, 9);
603
+		    $data['longitude'] = substr($line, 41, 9);
604
+		    $data['speed'] = round(substr($line, 51, 5));
605 605
 		    //$data['course'] = substr($line,57,5);
606
-		    $data['heading'] = round(substr($line,63,3));
606
+		    $data['heading'] = round(substr($line, 63, 3));
607 607
 		    //$data['draft'] = substr($line,67,4);
608 608
 		    //$data['length'] = substr($line,72,3);
609 609
 		    //$data['beam'] = substr($line,76,2);
610
-		    $data['ident'] = trim(utf8_encode(substr($line,79,20)));
610
+		    $data['ident'] = trim(utf8_encode(substr($line, 79, 20)));
611 611
 		    //$data['callsign'] = trim(substr($line,100,7);
612 612
 		    //$data['dest'] = substr($line,108,20);
613 613
 		    //$data['etaDate'] = substr($line,129,5);
@@ -626,8 +626,8 @@  discard block
 block discarded – undo
626 626
 	} elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch))) {
627 627
 	    //$buffer = $Common->getData($hosts[$id]);
628 628
 	    $buffer = $Common->getData($value['host']);
629
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
630
-	    $buffer = explode('\n',$buffer);
629
+    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
630
+	    $buffer = explode('\n', $buffer);
631 631
 	    $reset = 0;
632 632
 	    foreach ($buffer as $line) {
633 633
     		if ($line != '') {
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 			else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0];
639 639
 			$data['pilot_id'] = $line[1];
640 640
 			$data['pilot_name'] = $line[2];
641
-			$data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT);
641
+			$data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT);
642 642
 			$data['ident'] = $line[0]; // ident
643 643
 			if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude
644 644
 			$data['speed'] = $line[8]; // speed
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 			//$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37]));
655 655
 			//if (isset($line[37])) $data['last_update'] = $line[37];
656 656
 		        $data['departure_airport_icao'] = $line[11];
657
-		        $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':');
657
+		        $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':');
658 658
 		        $data['arrival_airport_icao'] = $line[13];
659 659
 			$data['frequency'] = $line[4];
660 660
 			$data['type'] = $line[18];
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
     			$data['id_source'] = $id_source;
664 664
 	    		//$data['arrival_airport_time'] = ;
665 665
 	    		if ($line[9] != '') {
666
-	    		    $aircraft_data = explode('/',$line[9]);
666
+	    		    $aircraft_data = explode('/', $line[9]);
667 667
 	    		    if (isset($aircraft_data[1])) {
668 668
 	    			$data['aircraft_icao'] = $aircraft_data[1];
669 669
 	    		    }
@@ -678,9 +678,9 @@  discard block
 block discarded – undo
678 678
     			if ($line[3] == 'PILOT') $SI->add($data);
679 679
 			elseif ($line[3] == 'ATC') {
680 680
 				//print_r($data);
681
-				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
682
-				$data['info'] = str_replace('&amp;sect;','',$data['info']);
683
-				$typec = substr($data['ident'],-3);
681
+				$data['info'] = str_replace('^&sect;', '<br />', $data['info']);
682
+				$data['info'] = str_replace('&amp;sect;', '', $data['info']);
683
+				$typec = substr($data['ident'], -3);
684 684
 				if ($typec == 'APP') $data['type'] = 'Approach';
685 685
 				elseif ($typec == 'TWR') $data['type'] = 'Tower';
686 686
 				elseif ($typec == 'OBS') $data['type'] = 'Observer';
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
 				elseif ($data['type'] == '') $data['type'] = 'Observer';
693 693
 				if (!isset($data['source_name'])) $data['source_name'] = '';
694 694
 				if (isset($ATC)) {
695
-					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']);
696
-					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']);
695
+					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']);
696
+					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']);
697 697
 				}
698 698
 			}
699 699
     			unset($data);
@@ -705,9 +705,9 @@  discard block
 block discarded – undo
705 705
     	    $last_exec[$id]['last'] = time();
706 706
     	//} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) {
707 707
     	} elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
708
-	    $buffer = $Common->getData($value['host'],'get','','','','','20');
708
+	    $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20');
709 709
 	    if ($buffer != '') {
710
-	    $all_data = json_decode($buffer,true);
710
+	    $all_data = json_decode($buffer, true);
711 711
 	    if (isset($all_data['acList'])) {
712 712
 		$reset = 0;
713 713
 		foreach ($all_data['acList'] as $line) {
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 		    $data['emergency'] = ''; // emergency
725 725
 		    if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
726 726
 		    
727
-		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
727
+		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000));
728 728
 		    else $data['datetime'] = date('Y-m-d H:i:s');
729 729
 		    
730 730
 		    //$data['datetime'] = date('Y-m-d H:i:s');
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 		    $data['verticalrate'] = $line['vrt']; // verticale rate
751 751
 		    $data['squawk'] = $line['squawk']; // squawk
752 752
 		    $data['emergency'] = ''; // emergency
753
-		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
753
+		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000));
754 754
 		    else $data['datetime'] = date('Y-m-d H:i:s');
755 755
 	    	    $data['format_source'] = 'aircraftlistjson';
756 756
     		    $data['id_source'] = $id_source;
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
     	//} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) {
767 767
     	} elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
768 768
 	    $buffer = $Common->getData($value['host']);
769
-	    $all_data = json_decode($buffer,true);
769
+	    $all_data = json_decode($buffer, true);
770 770
 	    if (isset($all_data['planes'])) {
771 771
 		$reset = 0;
772 772
 		foreach ($all_data['planes'] as $key => $line) {
@@ -783,12 +783,12 @@  discard block
 block discarded – undo
783 783
 		    $data['emergency'] = ''; // emergency
784 784
 		    $data['registration'] = $line[2];
785 785
 		    $data['aircraft_icao'] = $line[0];
786
-		    $deparr = explode('-',$line[1]);
786
+		    $deparr = explode('-', $line[1]);
787 787
 		    if (count($deparr) == 2) {
788 788
 			$data['departure_airport_icao'] = $deparr[0];
789 789
 			$data['arrival_airport_icao'] = $deparr[1];
790 790
 		    }
791
-		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
791
+		    $data['datetime'] = date('Y-m-d H:i:s', $line[9]);
792 792
 	    	    $data['format_source'] = 'planeupdatefaa';
793 793
     		    $data['id_source'] = $id_source;
794 794
 		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
     	    $last_exec[$id]['last'] = time();
802 802
     	} elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
803 803
 	    $buffer = $Common->getData($value['host']);
804
-	    $all_data = json_decode($buffer,true);
804
+	    $all_data = json_decode($buffer, true);
805 805
 	    if (isset($all_data['states'])) {
806 806
 		$reset = 0;
807 807
 		foreach ($all_data['states'] as $key => $line) {
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 		    //$data['emergency'] = ''; // emergency
819 819
 		    //$data['registration'] = $line[2];
820 820
 		    //$data['aircraft_icao'] = $line[0];
821
-		    $data['datetime'] = date('Y-m-d H:i:s',$line[3]);
821
+		    $data['datetime'] = date('Y-m-d H:i:s', $line[3]);
822 822
 	    	    $data['format_source'] = 'opensky';
823 823
     		    $data['id_source'] = $id_source;
824 824
 		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
     	} elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
833 833
 	    //$buffer = $Common->getData($hosts[$id]);
834 834
 	    $buffer = $Common->getData($value['host']);
835
-	    $all_data = json_decode($buffer,true);
835
+	    $all_data = json_decode($buffer, true);
836 836
 	    if (!empty($all_data)) $reset = 0;
837 837
 	    foreach ($all_data as $key => $line) {
838 838
 		if ($key != 'full_count' && $key != 'version' && $key != 'stats') {
@@ -865,11 +865,11 @@  discard block
 block discarded – undo
865 865
     	//} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) {
866 866
     	} elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
867 867
 	    //$buffer = $Common->getData($hosts[$id],'get','','','','','150');
868
-	    $buffer = $Common->getData($value['host'],'get','','','','','150');
868
+	    $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150');
869 869
 	    //echo $buffer;
870
-	    $buffer = str_replace(array("\n","\r"),"",$buffer);
871
-	    $buffer = preg_replace('/,"num":(.+)/','}',$buffer);
872
-	    $all_data = json_decode($buffer,true);
870
+	    $buffer = str_replace(array("\n", "\r"), "", $buffer);
871
+	    $buffer = preg_replace('/,"num":(.+)/', '}', $buffer);
872
+	    $all_data = json_decode($buffer, true);
873 873
 	    if (json_last_error() != JSON_ERROR_NONE) {
874 874
 		die(json_last_error_msg());
875 875
 	    }
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 			//$data['departure_airport_iata'] = $line[11];
893 893
 			//$data['arrival_airport_iata'] = $line[12];
894 894
 	    		//$data['emergency'] = ''; // emergency
895
-			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
895
+			$data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10]
896 896
 	    		$data['format_source'] = 'radarvirtueljson';
897 897
     			$data['id_source'] = $id_source;
898 898
 			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
@@ -908,14 +908,14 @@  discard block
 block discarded – undo
908 908
     	} elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
909 909
 	    //$buffer = $Common->getData($hosts[$id]);
910 910
 	    $buffer = $Common->getData($value['host'].'?'.time());
911
-	    $all_data = json_decode(utf8_encode($buffer),true);
911
+	    $all_data = json_decode(utf8_encode($buffer), true);
912 912
 	    
913 913
 	    if (isset($all_data['pireps'])) {
914 914
 		$reset = 0;
915 915
 	        foreach ($all_data['pireps'] as $line) {
916 916
 		    $data = array();
917 917
 		    $data['id'] = $line['id'];
918
-		    $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
918
+		    $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6);
919 919
 		    $data['ident'] = $line['callsign']; // ident
920 920
 		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
921 921
 		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
@@ -945,9 +945,9 @@  discard block
 block discarded – undo
945 945
 			$SI->add($data);
946 946
 		    //    print_r($data);
947 947
     		    } elseif ($line['icon'] == 'ct') {
948
-			$data['info'] = str_replace('^&sect;','<br />',$data['info']);
949
-			$data['info'] = str_replace('&amp;sect;','',$data['info']);
950
-			$typec = substr($data['ident'],-3);
948
+			$data['info'] = str_replace('^&sect;', '<br />', $data['info']);
949
+			$data['info'] = str_replace('&amp;sect;', '', $data['info']);
950
+			$typec = substr($data['ident'], -3);
951 951
 			$data['type'] = '';
952 952
 			if ($typec == 'APP') $data['type'] = 'Approach';
953 953
 			elseif ($typec == 'TWR') $data['type'] = 'Tower';
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 			elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
959 959
 			elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
960 960
 			else $data['type'] = 'Observer';
961
-			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']);
961
+			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']);
962 962
 		    }
963 963
 		    unset($data);
964 964
 		}
@@ -970,14 +970,14 @@  discard block
 block discarded – undo
970 970
 	    //$buffer = $Common->getData($hosts[$id]);
971 971
 	    if ($globalDebug) echo 'Get Data...'."\n";
972 972
 	    $buffer = $Common->getData($value['host']);
973
-	    $all_data = json_decode($buffer,true);
973
+	    $all_data = json_decode($buffer, true);
974 974
 	    if ($buffer != '' && is_array($all_data)) {
975 975
 		$reset = 0;
976 976
 		foreach ($all_data as $line) {
977 977
 	    	    $data = array();
978 978
 	    	    //$data['id'] = $line['id']; // id not usable
979 979
 	    	    if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
980
-	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
980
+	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex
981 981
 	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
982 982
 	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
983 983
 	    	    $data['ident'] = $line['flightnum']; // ident
@@ -1001,14 +1001,14 @@  discard block
 block discarded – undo
1001 1001
 		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1002 1002
 		    if (isset($line['aircraftname'])) {
1003 1003
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
1004
-			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
1005
-	    		$aircraft_data = explode('-',$line['aircraftname']);
1004
+			$line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']);
1005
+	    		$aircraft_data = explode('-', $line['aircraftname']);
1006 1006
 	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0];
1007 1007
 	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1];
1008 1008
 	    		else {
1009
-	    		    $aircraft_data = explode(' ',$line['aircraftname']);
1010
-	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]);
1011
-	    		    else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']);
1009
+	    		    $aircraft_data = explode(' ', $line['aircraftname']);
1010
+	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]);
1011
+	    		    else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']);
1012 1012
 	    		}
1013 1013
 	    	    }
1014 1014
     		    if (isset($line['route'])) $data['waypoints'] = $line['route'];
@@ -1028,14 +1028,14 @@  discard block
 block discarded – undo
1028 1028
 	    //$buffer = $Common->getData($hosts[$id]);
1029 1029
 	    if ($globalDebug) echo 'Get Data...'."\n";
1030 1030
 	    $buffer = $Common->getData($value['host']);
1031
-	    $all_data = json_decode($buffer,true);
1031
+	    $all_data = json_decode($buffer, true);
1032 1032
 	    if ($buffer != '' && is_array($all_data)) {
1033 1033
 		$reset = 0;
1034 1034
 		foreach ($all_data as $line) {
1035 1035
 	    	    $data = array();
1036 1036
 	    	    //$data['id'] = $line['id']; // id not usable
1037 1037
 	    	    $data['id'] = trim($line['flight_id']);
1038
-	    	    $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex
1038
+	    	    $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex
1039 1039
 	    	    $data['pilot_name'] = $line['pilot_name'];
1040 1040
 	    	    $data['pilot_id'] = $line['pilot_id'];
1041 1041
 	    	    $data['ident'] = trim($line['callsign']); // ident
@@ -1087,11 +1087,11 @@  discard block
 block discarded – undo
1087 1087
 		    //$value = $formats[$nb];
1088 1088
 		    $format = $globalSources[$nb]['format'];
1089 1089
 		    if ($format == 'sbs' || $format == 'aprs' || $format == 'famaprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') {
1090
-			$buffer = @socket_read($r, 6000,PHP_NORMAL_READ);
1090
+			$buffer = @socket_read($r, 6000, PHP_NORMAL_READ);
1091 1091
 		    } elseif ($format == 'vrstcp') {
1092 1092
 			$buffer = @socket_read($r, 6000);
1093 1093
 		    } else {
1094
-			$az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port);
1094
+			$az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port);
1095 1095
 		    }
1096 1096
 		    //$buffer = socket_read($r, 60000,PHP_NORMAL_READ);
1097 1097
 		    //echo $buffer."\n";
@@ -1100,8 +1100,8 @@  discard block
 block discarded – undo
1100 1100
 		    $error = false;
1101 1101
 		    //$SI::del();
1102 1102
 		    if ($format == 'vrstcp') {
1103
-			$buffer = explode('},{',$buffer);
1104
-		    } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
1103
+			$buffer = explode('},{', $buffer);
1104
+		    } else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer));
1105 1105
 		    // SBS format is CSV format
1106 1106
 		    if ($buffer !== FALSE && $buffer != '') {
1107 1107
 			$tt[$format] = 0;
@@ -1135,13 +1135,13 @@  discard block
 block discarded – undo
1135 1135
 			    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
1136 1136
 			    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
1137 1137
 			    if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
1138
-			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
1138
+			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']);
1139 1139
 			    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1140 1140
 			    if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1141 1141
 			    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1142 1142
 
1143 1143
 			    if (isset($ais_data['timestamp'])) {
1144
-				$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
1144
+				$data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']);
1145 1145
 			    } else {
1146 1146
 				$data['datetime'] = date('Y-m-d H:i:s');
1147 1147
 			    }
@@ -1152,10 +1152,10 @@  discard block
 block discarded – undo
1152 1152
                         } elseif ($format == 'flightgearsp') {
1153 1153
                     	    //echo $buffer."\n";
1154 1154
                     	    if (strlen($buffer) > 5) {
1155
-				$line = explode(',',$buffer);
1155
+				$line = explode(',', $buffer);
1156 1156
 				$data = array();
1157 1157
 				//XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p
1158
-				$data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6);
1158
+				$data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6);
1159 1159
 				$data['ident'] = $line[6];
1160 1160
 				$data['aircraft_name'] = $line[7];
1161 1161
 				$data['longitude'] = $line[1];
@@ -1167,21 +1167,21 @@  discard block
 block discarded – undo
1167 1167
 				$data['format_source'] = 'flightgearsp';
1168 1168
 				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1169 1169
 				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1170
-				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
1170
+				$send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0);
1171 1171
 			    }
1172 1172
                         } elseif ($format == 'acars') {
1173 1173
                     	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1174 1174
 			    $ACARS->add(trim($buffer));
1175
-			    socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
1175
+			    socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port);
1176 1176
 			    $ACARS->deleteLiveAcarsData();
1177 1177
 			} elseif ($format == 'flightgearmp') {
1178
-			    if (substr($buffer,0,1) != '#') {
1178
+			    if (substr($buffer, 0, 1) != '#') {
1179 1179
 				$data = array();
1180 1180
 				//echo $buffer."\n";
1181
-				$line = explode(' ',$buffer);
1181
+				$line = explode(' ', $buffer);
1182 1182
 				if (count($line) == 11) {
1183
-				    $userserver = explode('@',$line[0]);
1184
-				    $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex
1183
+				    $userserver = explode('@', $line[0]);
1184
+				    $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex
1185 1185
 				    $data['ident'] = $userserver[0];
1186 1186
 				    $data['registration'] = $userserver[0];
1187 1187
 				    $data['latitude'] = $line[4];
@@ -1189,8 +1189,8 @@  discard block
 block discarded – undo
1189 1189
 				    $data['altitude'] = $line[6];
1190 1190
 				    $data['datetime'] = date('Y-m-d H:i:s');
1191 1191
 				    $aircraft_type = $line[10];
1192
-				    $aircraft_type = preg_split(':/:',$aircraft_type);
1193
-				    $data['aircraft_name'] = substr(end($aircraft_type),0,-4);
1192
+				    $aircraft_type = preg_split(':/:', $aircraft_type);
1193
+				    $data['aircraft_name'] = substr(end($aircraft_type), 0, -4);
1194 1194
 				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1195 1195
 				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1196 1196
 				}
@@ -1199,8 +1199,8 @@  discard block
 block discarded – undo
1199 1199
 			    echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n";
1200 1200
 			    die;
1201 1201
 			} elseif ($format == 'vrstcp') {
1202
-			    foreach($buffer as $all_data) {
1203
-				$line = json_decode('{'.$all_data.'}',true);
1202
+			    foreach ($buffer as $all_data) {
1203
+				$line = json_decode('{'.$all_data.'}', true);
1204 1204
 				$data = array();
1205 1205
 				if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex
1206 1206
 				if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
@@ -1226,16 +1226,16 @@  discard block
 block discarded – undo
1226 1226
 				if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data);
1227 1227
 				unset($data);
1228 1228
 			    }
1229
-			} elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') {
1229
+			} elseif ($format == 'tsv' || substr($buffer, 0, 4) == 'clock') {
1230 1230
 			    $line = explode("\t", $buffer);
1231
-			    for($k = 0; $k < count($line); $k=$k+2) {
1231
+			    for ($k = 0; $k < count($line); $k = $k + 2) {
1232 1232
 				$key = $line[$k];
1233
-			        $lined[$key] = $line[$k+1];
1233
+			        $lined[$key] = $line[$k + 1];
1234 1234
 			    }
1235 1235
     			    if (count($lined) > 3) {
1236 1236
     				$data['hex'] = $lined['hexid'];
1237 1237
     				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
1238
-    				$data['datetime'] = date('Y-m-d H:i:s');;
1238
+    				$data['datetime'] = date('Y-m-d H:i:s'); ;
1239 1239
     				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
1240 1240
     				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
1241 1241
     				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
@@ -1254,22 +1254,22 @@  discard block
 block discarded – undo
1254 1254
     			    } else $error = true;
1255 1255
 			} elseif ($format == 'aprs' && $use_aprs) {
1256 1256
 			    if ($aprs_connect == 0) {
1257
-				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
1257
+				$send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0);
1258 1258
 				$aprs_connect = 1;
1259 1259
 			    }
1260 1260
 			    
1261
-			    if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) {
1261
+			    if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) {
1262 1262
 				$aprs_last_tx = time();
1263 1263
 				$data_aprs = "# Keep alive";
1264
-				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
1264
+				$send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0);
1265 1265
 			    }
1266 1266
 			    
1267 1267
 			    //echo 'Connect : '.$aprs_connect.' '.$buffer."\n";
1268 1268
 			    //echo 'APRS data : '.$buffer."\n";
1269
-			    $buffer = str_replace('APRS <- ','',$buffer);
1270
-			    $buffer = str_replace('APRS -> ','',$buffer);
1269
+			    $buffer = str_replace('APRS <- ', '', $buffer);
1270
+			    $buffer = str_replace('APRS -> ', '', $buffer);
1271 1271
 			    //echo $buffer."\n";
1272
-			    if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') {
1272
+			    if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') {
1273 1273
 				$line = $APRS->parse($buffer);
1274 1274
 				//if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) {
1275 1275
 				if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) {
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
 				    if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date'];
1285 1285
 				    if (isset($line['type_id'])) $data['type_id'] = $line['typeid'];
1286 1286
 				    if (isset($line['status_id'])) $data['status_id'] = $line['statusid'];
1287
-				    if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
1287
+				    if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']);
1288 1288
 				    else $data['datetime'] = date('Y-m-d H:i:s');
1289 1289
 				    //$data['datetime'] = date('Y-m-d H:i:s');
1290 1290
 				    if (isset($line['ident'])) $data['ident'] = $line['ident'];
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
 				connect_all($sourceee);
1414 1414
 				$sourceee = array();
1415 1415
 				//connect_all($globalSources);
1416
-				$tt[$format]=0;
1416
+				$tt[$format] = 0;
1417 1417
 				break;
1418 1418
 			    }
1419 1419
 			}
@@ -1422,14 +1422,14 @@  discard block
 block discarded – undo
1422 1422
 	    } else {
1423 1423
 		$error = socket_strerror(socket_last_error());
1424 1424
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) {
1425
-			if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
1425
+			if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n";
1426 1426
 			if (isset($globalDebug)) echo "Restarting...\n";
1427 1427
 			// Restart the script if possible
1428 1428
 			if (is_array($sockets)) {
1429 1429
 			    if ($globalDebug) echo "Shutdown all sockets...";
1430 1430
 			    
1431 1431
 			    foreach ($sockets as $sock) {
1432
-				@socket_shutdown($sock,2);
1432
+				@socket_shutdown($sock, 2);
1433 1433
 				@socket_close($sock);
1434 1434
 			    }
1435 1435
 			    
Please login to merge, or discard this patch.
atc-data.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 $ATC = new ATC();
6 6
 
7 7
 if (isset($_GET['atcid'])) {
8
-	$atcid = filter_input(INPUT_GET,'atcid',FILTER_SANITIZE_NUMBER_INT);
9
-	$atcident = filter_input(INPUT_GET,'atcident',FILTER_SANITIZE_STRING);
8
+	$atcid = filter_input(INPUT_GET, 'atcid', FILTER_SANITIZE_NUMBER_INT);
9
+	$atcident = filter_input(INPUT_GET, 'atcident', FILTER_SANITIZE_STRING);
10 10
 	$atc_data = $ATC->getById($atcid);
11 11
 	if (!isset($atc_data[0])) $atc_data = $ATC->getByIdent($atcident);
12 12
  ?>
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 print '</div>';
39 39
 
40 40
 //print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>';
41
-print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],3).', '.round($spotter_item['longitude'],3).'</div>';
41
+print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'], 3).', '.round($spotter_item['longitude'], 3).'</div>';
42 42
 if ($spotter_item['atc_range'] > 0) {
43 43
     print '<div><span>'._("Range").'</span>';
44 44
     print $spotter_item['atc_range'];
Please login to merge, or discard this patch.