@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | try { |
15 | 15 | $sth = $Connection->db->prepare($query); |
16 | 16 | $sth->execute(); |
17 | - } catch(PDOException $e) { |
|
17 | + } catch (PDOException $e) { |
|
18 | 18 | return "error : ".$e->getMessage()."\n"; |
19 | 19 | } |
20 | 20 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
21 | - $Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']); |
|
21 | + $Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | try { |
51 | 51 | $sth = $Connection->db->prepare($query); |
52 | 52 | $sth->execute(); |
53 | - } catch(PDOException $e) { |
|
53 | + } catch (PDOException $e) { |
|
54 | 54 | return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
55 | 55 | } |
56 | 56 | // Copy schedules data to routes table |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | try { |
61 | 61 | $sth = $Connection->db->prepare($query); |
62 | 62 | $sth->execute(); |
63 | - } catch(PDOException $e) { |
|
63 | + } catch (PDOException $e) { |
|
64 | 64 | return "error (delete schedule table) : ".$e->getMessage()."\n"; |
65 | 65 | } |
66 | 66 | // Add source column |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | try { |
69 | 69 | $sth = $Connection->db->prepare($query); |
70 | 70 | $sth->execute(); |
71 | - } catch(PDOException $e) { |
|
71 | + } catch (PDOException $e) { |
|
72 | 72 | return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n"; |
73 | 73 | } |
74 | 74 | // Delete unused column |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | try { |
77 | 77 | $sth = $Connection->db->prepare($query); |
78 | 78 | $sth->execute(); |
79 | - } catch(PDOException $e) { |
|
79 | + } catch (PDOException $e) { |
|
80 | 80 | return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n"; |
81 | 81 | } |
82 | 82 | // Add ModeS column |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | try { |
85 | 85 | $sth = $Connection->db->prepare($query); |
86 | 86 | $sth->execute(); |
87 | - } catch(PDOException $e) { |
|
87 | + } catch (PDOException $e) { |
|
88 | 88 | return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n"; |
89 | 89 | } |
90 | 90 | $query = "ALTER TABLE `spotter_live` ADD `ModeS` VARCHAR(255)"; |
91 | 91 | try { |
92 | 92 | $sth = $Connection->db->prepare($query); |
93 | 93 | $sth->execute(); |
94 | - } catch(PDOException $e) { |
|
94 | + } catch (PDOException $e) { |
|
95 | 95 | return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n"; |
96 | 96 | } |
97 | 97 | // Add auto_increment for aircraft_modes |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | try { |
100 | 100 | $sth = $Connection->db->prepare($query); |
101 | 101 | $sth->execute(); |
102 | - } catch(PDOException $e) { |
|
102 | + } catch (PDOException $e) { |
|
103 | 103 | return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n"; |
104 | 104 | } |
105 | 105 | $error = ''; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | try { |
111 | 111 | $sth = $Connection->db->prepare($query); |
112 | 112 | $sth->execute(); |
113 | - } catch(PDOException $e) { |
|
113 | + } catch (PDOException $e) { |
|
114 | 114 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
115 | 115 | } |
116 | 116 | return $error; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | try { |
124 | 124 | $sth = $Connection->db->prepare($query); |
125 | 125 | $sth->execute(); |
126 | - } catch(PDOException $e) { |
|
126 | + } catch (PDOException $e) { |
|
127 | 127 | return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
128 | 128 | } |
129 | 129 | $error = ''; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | try { |
135 | 135 | $sth = $Connection->db->prepare($query); |
136 | 136 | $sth->execute(); |
137 | - } catch(PDOException $e) { |
|
137 | + } catch (PDOException $e) { |
|
138 | 138 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
139 | 139 | } |
140 | 140 | return $error; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | try { |
148 | 148 | $sth = $Connection->db->prepare($query); |
149 | 149 | $sth->execute(); |
150 | - } catch(PDOException $e) { |
|
150 | + } catch (PDOException $e) { |
|
151 | 151 | return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n"; |
152 | 152 | } |
153 | 153 | // Add image_source_website column to spotter_image |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | try { |
156 | 156 | $sth = $Connection->db->prepare($query); |
157 | 157 | $sth->execute(); |
158 | - } catch(PDOException $e) { |
|
158 | + } catch (PDOException $e) { |
|
159 | 159 | return "error (add new columns to spotter_image) : ".$e->getMessage()."\n"; |
160 | 160 | } |
161 | 161 | $error = ''; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | try { |
165 | 165 | $sth = $Connection->db->prepare($query); |
166 | 166 | $sth->execute(); |
167 | - } catch(PDOException $e) { |
|
167 | + } catch (PDOException $e) { |
|
168 | 168 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
169 | 169 | } |
170 | 170 | return $error; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | try { |
183 | 183 | $sth = $Connection->db->prepare($query); |
184 | 184 | $sth->execute(); |
185 | - } catch(PDOException $e) { |
|
185 | + } catch (PDOException $e) { |
|
186 | 186 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
187 | 187 | } |
188 | 188 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | try { |
197 | 197 | $sth = $Connection->db->prepare($query); |
198 | 198 | $sth->execute(); |
199 | - } catch(PDOException $e) { |
|
199 | + } catch (PDOException $e) { |
|
200 | 200 | return "error (add new columns to translation) : ".$e->getMessage()."\n"; |
201 | 201 | } |
202 | 202 | // Add aircraft_shadow column to aircraft |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | try { |
205 | 205 | $sth = $Connection->db->prepare($query); |
206 | 206 | $sth->execute(); |
207 | - } catch(PDOException $e) { |
|
207 | + } catch (PDOException $e) { |
|
208 | 208 | return "error (add new column to aircraft) : ".$e->getMessage()."\n"; |
209 | 209 | } |
210 | 210 | // Add aircraft_shadow column to spotter_live |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | try { |
213 | 213 | $sth = $Connection->db->prepare($query); |
214 | 214 | $sth->execute(); |
215 | - } catch(PDOException $e) { |
|
215 | + } catch (PDOException $e) { |
|
216 | 216 | return "error (add new column to spotter_live) : ".$e->getMessage()."\n"; |
217 | 217 | } |
218 | 218 | $error = ''; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | try { |
226 | 226 | $sth = $Connection->db->prepare($query); |
227 | 227 | $sth->execute(); |
228 | - } catch(PDOException $e) { |
|
228 | + } catch (PDOException $e) { |
|
229 | 229 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
230 | 230 | } |
231 | 231 | return $error; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | private static function update_from_6() { |
235 | 235 | $Connection = new Connection(); |
236 | - if (!$Connection->indexExists('spotter_output','flightaware_id')) { |
|
236 | + if (!$Connection->indexExists('spotter_output', 'flightaware_id')) { |
|
237 | 237 | $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id); |
238 | 238 | ALTER TABLE spotter_output ADD INDEX(date); |
239 | 239 | ALTER TABLE spotter_output ADD INDEX(ident); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | try { |
251 | 251 | $sth = $Connection->db->prepare($query); |
252 | 252 | $sth->execute(); |
253 | - } catch(PDOException $e) { |
|
253 | + } catch (PDOException $e) { |
|
254 | 254 | return "error (add some indexes) : ".$e->getMessage()."\n"; |
255 | 255 | } |
256 | 256 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | try { |
266 | 266 | $sth = $Connection->db->prepare($query); |
267 | 267 | $sth->execute(); |
268 | - } catch(PDOException $e) { |
|
268 | + } catch (PDOException $e) { |
|
269 | 269 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
270 | 270 | } |
271 | 271 | return $error; |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | private static function update_from_7() { |
275 | 275 | global $globalDBname, $globalDBdriver; |
276 | 276 | $Connection = new Connection(); |
277 | - $query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
277 | + $query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
278 | 278 | ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;"; |
279 | 279 | try { |
280 | 280 | $sth = $Connection->db->prepare($query); |
281 | 281 | $sth->execute(); |
282 | - } catch(PDOException $e) { |
|
282 | + } catch (PDOException $e) { |
|
283 | 283 | return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
284 | 284 | } |
285 | 285 | if ($globalDBdriver == 'mysql') { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | try { |
288 | 288 | $sth = $Connection->db->prepare($query); |
289 | 289 | $sth->execute(); |
290 | - } catch(PDOException $e) { |
|
290 | + } catch (PDOException $e) { |
|
291 | 291 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
292 | 292 | } |
293 | 293 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -299,15 +299,15 @@ discard block |
||
299 | 299 | DROP TABLE spotter_archive; |
300 | 300 | RENAME TABLE copy TO spotter_archive;"; |
301 | 301 | } else { |
302 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
302 | + $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
303 | 303 | } |
304 | 304 | } else { |
305 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
305 | + $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
306 | 306 | } |
307 | 307 | try { |
308 | 308 | $sth = $Connection->db->prepare($query); |
309 | 309 | $sth->execute(); |
310 | - } catch(PDOException $e) { |
|
310 | + } catch (PDOException $e) { |
|
311 | 311 | return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n"; |
312 | 312 | } |
313 | 313 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | try { |
321 | 321 | $sth = $Connection->db->prepare($query); |
322 | 322 | $sth->execute(); |
323 | - } catch(PDOException $e) { |
|
323 | + } catch (PDOException $e) { |
|
324 | 324 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
325 | 325 | } |
326 | 326 | return $error; |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | try { |
340 | 340 | $sth = $Connection->db->prepare($query); |
341 | 341 | $sth->execute(); |
342 | - } catch(PDOException $e) { |
|
342 | + } catch (PDOException $e) { |
|
343 | 343 | return "error (insert last_update values) : ".$e->getMessage()."\n"; |
344 | 344 | } |
345 | 345 | $query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'"; |
346 | 346 | try { |
347 | 347 | $sth = $Connection->db->prepare($query); |
348 | 348 | $sth->execute(); |
349 | - } catch(PDOException $e) { |
|
349 | + } catch (PDOException $e) { |
|
350 | 350 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
351 | 351 | } |
352 | 352 | return $error; |
@@ -354,12 +354,12 @@ discard block |
||
354 | 354 | |
355 | 355 | private static function update_from_9() { |
356 | 356 | $Connection = new Connection(); |
357 | - $query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
357 | + $query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
358 | 358 | ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;"; |
359 | 359 | try { |
360 | 360 | $sth = $Connection->db->prepare($query); |
361 | 361 | $sth->execute(); |
362 | - } catch(PDOException $e) { |
|
362 | + } catch (PDOException $e) { |
|
363 | 363 | return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
364 | 364 | } |
365 | 365 | $error = ''; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | try { |
372 | 372 | $sth = $Connection->db->prepare($query); |
373 | 373 | $sth->execute(); |
374 | - } catch(PDOException $e) { |
|
374 | + } catch (PDOException $e) { |
|
375 | 375 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
376 | 376 | } |
377 | 377 | return $error; |
@@ -379,11 +379,11 @@ discard block |
||
379 | 379 | |
380 | 380 | private static function update_from_10() { |
381 | 381 | $Connection = new Connection(); |
382 | - $query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
382 | + $query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
383 | 383 | try { |
384 | 384 | $sth = $Connection->db->prepare($query); |
385 | 385 | $sth->execute(); |
386 | - } catch(PDOException $e) { |
|
386 | + } catch (PDOException $e) { |
|
387 | 387 | return "error (add new enum to ATC table) : ".$e->getMessage()."\n"; |
388 | 388 | } |
389 | 389 | $error = ''; |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | try { |
402 | 402 | $sth = $Connection->db->prepare($query); |
403 | 403 | $sth->execute(); |
404 | - } catch(PDOException $e) { |
|
404 | + } catch (PDOException $e) { |
|
405 | 405 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
406 | 406 | } |
407 | 407 | return $error; |
@@ -410,18 +410,18 @@ discard block |
||
410 | 410 | private static function update_from_11() { |
411 | 411 | global $globalDBdriver, $globalDBname; |
412 | 412 | $Connection = new Connection(); |
413 | - $query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
413 | + $query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
414 | 414 | try { |
415 | 415 | $sth = $Connection->db->prepare($query); |
416 | 416 | $sth->execute(); |
417 | - } catch(PDOException $e) { |
|
417 | + } catch (PDOException $e) { |
|
418 | 418 | return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n"; |
419 | 419 | } |
420 | - $query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
420 | + $query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
421 | 421 | try { |
422 | 422 | $sth = $Connection->db->prepare($query); |
423 | 423 | $sth->execute(); |
424 | - } catch(PDOException $e) { |
|
424 | + } catch (PDOException $e) { |
|
425 | 425 | return "error (format_source column to spotter_live) : ".$e->getMessage()."\n"; |
426 | 426 | } |
427 | 427 | if ($globalDBdriver == 'mysql') { |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | try { |
430 | 430 | $sth = $Connection->db->prepare($query); |
431 | 431 | $sth->execute(); |
432 | - } catch(PDOException $e) { |
|
432 | + } catch (PDOException $e) { |
|
433 | 433 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
434 | 434 | } |
435 | 435 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -441,15 +441,15 @@ discard block |
||
441 | 441 | DROP TABLE spotter_archive; |
442 | 442 | RENAME TABLE copy TO spotter_archive;"; |
443 | 443 | } else { |
444 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
444 | + $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
445 | 445 | } |
446 | 446 | } else { |
447 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
447 | + $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
448 | 448 | } |
449 | 449 | try { |
450 | 450 | $sth = $Connection->db->prepare($query); |
451 | 451 | $sth->execute(); |
452 | - } catch(PDOException $e) { |
|
452 | + } catch (PDOException $e) { |
|
453 | 453 | return "error (add columns to spotter_archive) : ".$e->getMessage()."\n"; |
454 | 454 | } |
455 | 455 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | try { |
460 | 460 | $sth = $Connection->db->prepare($query); |
461 | 461 | $sth->execute(); |
462 | - } catch(PDOException $e) { |
|
462 | + } catch (PDOException $e) { |
|
463 | 463 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
464 | 464 | } |
465 | 465 | return $error; |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | try { |
488 | 488 | $sth = $Connection->db->prepare($query); |
489 | 489 | $sth->execute(); |
490 | - } catch(PDOException $e) { |
|
490 | + } catch (PDOException $e) { |
|
491 | 491 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
492 | 492 | } |
493 | 493 | return $error; |
@@ -495,12 +495,12 @@ discard block |
||
495 | 495 | |
496 | 496 | private static function update_from_13() { |
497 | 497 | $Connection = new Connection(); |
498 | - if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) { |
|
499 | - $query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
498 | + if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) { |
|
499 | + $query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
500 | 500 | try { |
501 | 501 | $sth = $Connection->db->prepare($query); |
502 | 502 | $sth->execute(); |
503 | - } catch(PDOException $e) { |
|
503 | + } catch (PDOException $e) { |
|
504 | 504 | return "error (update spotter_archive_output) : ".$e->getMessage()."\n"; |
505 | 505 | } |
506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | try { |
510 | 510 | $sth = $Connection->db->prepare($query); |
511 | 511 | $sth->execute(); |
512 | - } catch(PDOException $e) { |
|
512 | + } catch (PDOException $e) { |
|
513 | 513 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
514 | 514 | } |
515 | 515 | return $error; |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | try { |
528 | 528 | $sth = $Connection->db->prepare($query); |
529 | 529 | $sth->execute(); |
530 | - } catch(PDOException $e) { |
|
530 | + } catch (PDOException $e) { |
|
531 | 531 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
532 | 532 | } |
533 | 533 | return $error; |
@@ -538,11 +538,11 @@ discard block |
||
538 | 538 | $Connection = new Connection(); |
539 | 539 | $error = ''; |
540 | 540 | // Add tables |
541 | - $query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
541 | + $query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
542 | 542 | try { |
543 | 543 | $sth = $Connection->db->prepare($query); |
544 | 544 | $sth->execute(); |
545 | - } catch(PDOException $e) { |
|
545 | + } catch (PDOException $e) { |
|
546 | 546 | return "error (update stats) : ".$e->getMessage()."\n"; |
547 | 547 | } |
548 | 548 | if ($error != '') return $error; |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | try { |
551 | 551 | $sth = $Connection->db->prepare($query); |
552 | 552 | $sth->execute(); |
553 | - } catch(PDOException $e) { |
|
553 | + } catch (PDOException $e) { |
|
554 | 554 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
555 | 555 | } |
556 | 556 | return $error; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | try { |
572 | 572 | $sth = $Connection->db->prepare($query); |
573 | 573 | $sth->execute(); |
574 | - } catch(PDOException $e) { |
|
574 | + } catch (PDOException $e) { |
|
575 | 575 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
576 | 576 | } |
577 | 577 | return $error; |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | try { |
590 | 590 | $sth = $Connection->db->prepare($query); |
591 | 591 | $sth->execute(); |
592 | - } catch(PDOException $e) { |
|
592 | + } catch (PDOException $e) { |
|
593 | 593 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
594 | 594 | } |
595 | 595 | return $error; |
@@ -598,12 +598,12 @@ discard block |
||
598 | 598 | $Connection = new Connection(); |
599 | 599 | $error = ''; |
600 | 600 | // Modify stats_airport table |
601 | - if (!$Connection->checkColumnName('stats_airport','airport_name')) { |
|
601 | + if (!$Connection->checkColumnName('stats_airport', 'airport_name')) { |
|
602 | 602 | $query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)"; |
603 | 603 | try { |
604 | 604 | $sth = $Connection->db->prepare($query); |
605 | 605 | $sth->execute(); |
606 | - } catch(PDOException $e) { |
|
606 | + } catch (PDOException $e) { |
|
607 | 607 | return "error (update stats) : ".$e->getMessage()."\n"; |
608 | 608 | } |
609 | 609 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | try { |
613 | 613 | $sth = $Connection->db->prepare($query); |
614 | 614 | $sth->execute(); |
615 | - } catch(PDOException $e) { |
|
615 | + } catch (PDOException $e) { |
|
616 | 616 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
617 | 617 | } |
618 | 618 | return $error; |
@@ -629,73 +629,73 @@ discard block |
||
629 | 629 | try { |
630 | 630 | $sth = $Connection->db->prepare($query); |
631 | 631 | $sth->execute(); |
632 | - } catch(PDOException $e) { |
|
632 | + } catch (PDOException $e) { |
|
633 | 633 | return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n"; |
634 | 634 | } |
635 | 635 | $query = "alter table spotter_archive add spotter_archive_id INT(11)"; |
636 | 636 | try { |
637 | 637 | $sth = $Connection->db->prepare($query); |
638 | 638 | $sth->execute(); |
639 | - } catch(PDOException $e) { |
|
639 | + } catch (PDOException $e) { |
|
640 | 640 | return "error (add id again on spotter_archive) : ".$e->getMessage()."\n"; |
641 | 641 | } |
642 | - if (!$Connection->checkColumnName('spotter_archive','over_country')) { |
|
642 | + if (!$Connection->checkColumnName('spotter_archive', 'over_country')) { |
|
643 | 643 | // Add column over_country |
644 | 644 | $query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
645 | 645 | try { |
646 | 646 | $sth = $Connection->db->prepare($query); |
647 | 647 | $sth->execute(); |
648 | - } catch(PDOException $e) { |
|
648 | + } catch (PDOException $e) { |
|
649 | 649 | return "error (add over_country) : ".$e->getMessage()."\n"; |
650 | 650 | } |
651 | 651 | } |
652 | - if (!$Connection->checkColumnName('spotter_live','over_country')) { |
|
652 | + if (!$Connection->checkColumnName('spotter_live', 'over_country')) { |
|
653 | 653 | // Add column over_country |
654 | 654 | $query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
655 | 655 | try { |
656 | 656 | $sth = $Connection->db->prepare($query); |
657 | 657 | $sth->execute(); |
658 | - } catch(PDOException $e) { |
|
658 | + } catch (PDOException $e) { |
|
659 | 659 | return "error (add over_country) : ".$e->getMessage()."\n"; |
660 | 660 | } |
661 | 661 | } |
662 | - if (!$Connection->checkColumnName('spotter_output','source_name')) { |
|
662 | + if (!$Connection->checkColumnName('spotter_output', 'source_name')) { |
|
663 | 663 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
664 | 664 | $query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
665 | 665 | try { |
666 | 666 | $sth = $Connection->db->prepare($query); |
667 | 667 | $sth->execute(); |
668 | - } catch(PDOException $e) { |
|
668 | + } catch (PDOException $e) { |
|
669 | 669 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
670 | 670 | } |
671 | 671 | } |
672 | - if (!$Connection->checkColumnName('spotter_live','source_name')) { |
|
672 | + if (!$Connection->checkColumnName('spotter_live', 'source_name')) { |
|
673 | 673 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
674 | 674 | $query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
675 | 675 | try { |
676 | 676 | $sth = $Connection->db->prepare($query); |
677 | 677 | $sth->execute(); |
678 | - } catch(PDOException $e) { |
|
678 | + } catch (PDOException $e) { |
|
679 | 679 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
680 | 680 | } |
681 | 681 | } |
682 | - if (!$Connection->checkColumnName('spotter_archive_output','source_name')) { |
|
682 | + if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) { |
|
683 | 683 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
684 | 684 | $query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
685 | 685 | try { |
686 | 686 | $sth = $Connection->db->prepare($query); |
687 | 687 | $sth->execute(); |
688 | - } catch(PDOException $e) { |
|
688 | + } catch (PDOException $e) { |
|
689 | 689 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
690 | 690 | } |
691 | 691 | } |
692 | - if (!$Connection->checkColumnName('spotter_archive','source_name')) { |
|
692 | + if (!$Connection->checkColumnName('spotter_archive', 'source_name')) { |
|
693 | 693 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
694 | 694 | $query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;"; |
695 | 695 | try { |
696 | 696 | $sth = $Connection->db->prepare($query); |
697 | 697 | $sth->execute(); |
698 | - } catch(PDOException $e) { |
|
698 | + } catch (PDOException $e) { |
|
699 | 699 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
700 | 700 | } |
701 | 701 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | try { |
705 | 705 | $sth = $Connection->db->prepare($query); |
706 | 706 | $sth->execute(); |
707 | - } catch(PDOException $e) { |
|
707 | + } catch (PDOException $e) { |
|
708 | 708 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
709 | 709 | } |
710 | 710 | return $error; |
@@ -719,13 +719,13 @@ discard block |
||
719 | 719 | $error .= create_db::import_file('../db/airlines.sql'); |
720 | 720 | if ($error != '') return 'Import airlines.sql : '.$error; |
721 | 721 | } |
722 | - if (!$Connection->checkColumnName('aircraft_modes','type_flight')) { |
|
722 | + if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) { |
|
723 | 723 | // Add column over_country |
724 | 724 | $query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;"; |
725 | 725 | try { |
726 | 726 | $sth = $Connection->db->prepare($query); |
727 | 727 | $sth->execute(); |
728 | - } catch(PDOException $e) { |
|
728 | + } catch (PDOException $e) { |
|
729 | 729 | return "error (add over_country) : ".$e->getMessage()."\n"; |
730 | 730 | } |
731 | 731 | } |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | try { |
742 | 742 | $sth = $Connection->db->prepare($query); |
743 | 743 | $sth->execute(); |
744 | - } catch(PDOException $e) { |
|
744 | + } catch (PDOException $e) { |
|
745 | 745 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
746 | 746 | } |
747 | 747 | return $error; |
@@ -750,13 +750,13 @@ discard block |
||
750 | 750 | private static function update_from_21() { |
751 | 751 | $Connection = new Connection(); |
752 | 752 | $error = ''; |
753 | - if (!$Connection->checkColumnName('stats_airport','stats_type')) { |
|
753 | + if (!$Connection->checkColumnName('stats_airport', 'stats_type')) { |
|
754 | 754 | // Rename type to stats_type |
755 | 755 | $query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);"; |
756 | 756 | try { |
757 | 757 | $sth = $Connection->db->prepare($query); |
758 | 758 | $sth->execute(); |
759 | - } catch(PDOException $e) { |
|
759 | + } catch (PDOException $e) { |
|
760 | 760 | return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n"; |
761 | 761 | } |
762 | 762 | if ($error != '') return $error; |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | try { |
766 | 766 | $sth = $Connection->db->prepare($query); |
767 | 767 | $sth->execute(); |
768 | - } catch(PDOException $e) { |
|
768 | + } catch (PDOException $e) { |
|
769 | 769 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
770 | 770 | } |
771 | 771 | return $error; |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | try { |
789 | 789 | $sth = $Connection->db->prepare($query); |
790 | 790 | $sth->execute(); |
791 | - } catch(PDOException $e) { |
|
791 | + } catch (PDOException $e) { |
|
792 | 792 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
793 | 793 | } |
794 | 794 | return $error; |
@@ -815,17 +815,17 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -1700,7 +1700,7 @@ discard block |
||
1700 | 1700 | try { |
1701 | 1701 | $sth = $Connection->db->prepare($query); |
1702 | 1702 | $sth->execute(); |
1703 | - } catch(PDOException $e) { |
|
1703 | + } catch (PDOException $e) { |
|
1704 | 1704 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
1705 | 1705 | } |
1706 | 1706 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -1709,18 +1709,18 @@ discard block |
||
1709 | 1709 | try { |
1710 | 1710 | $sth = $Connection->db->prepare($query); |
1711 | 1711 | $sth->execute(); |
1712 | - } catch(PDOException $e) { |
|
1712 | + } catch (PDOException $e) { |
|
1713 | 1713 | return "error (Change table format from archive to InnoDB for spotter_archive) : ".$e->getMessage()."\n"; |
1714 | 1714 | } |
1715 | 1715 | } |
1716 | 1716 | } |
1717 | - if (!$Connection->indexExists('spotter_archive','flightaware_id_date_idx') && !$Connection->indexExists('spotter_archive','flightaware_id')) { |
|
1717 | + if (!$Connection->indexExists('spotter_archive', 'flightaware_id_date_idx') && !$Connection->indexExists('spotter_archive', 'flightaware_id')) { |
|
1718 | 1718 | // Add index key |
1719 | 1719 | $query = "create index flightaware_id_date_idx on spotter_archive (flightaware_id,date)"; |
1720 | 1720 | try { |
1721 | 1721 | $sth = $Connection->db->prepare($query); |
1722 | 1722 | $sth->execute(); |
1723 | - } catch(PDOException $e) { |
|
1723 | + } catch (PDOException $e) { |
|
1724 | 1724 | return "error (add index flightaware_id, date on spotter_archive) : ".$e->getMessage()."\n"; |
1725 | 1725 | } |
1726 | 1726 | } |
@@ -1728,7 +1728,7 @@ discard block |
||
1728 | 1728 | try { |
1729 | 1729 | $sth = $Connection->db->prepare($query); |
1730 | 1730 | $sth->execute(); |
1731 | - } catch(PDOException $e) { |
|
1731 | + } catch (PDOException $e) { |
|
1732 | 1732 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1733 | 1733 | } |
1734 | 1734 | return $error; |
@@ -1739,148 +1739,148 @@ discard block |
||
1739 | 1739 | $Connection = new Connection(); |
1740 | 1740 | $error = ''; |
1741 | 1741 | if ($globalDBdriver == 'mysql') { |
1742 | - if (!$Connection->checkColumnName('marine_output','type_id')) { |
|
1742 | + if (!$Connection->checkColumnName('marine_output', 'type_id')) { |
|
1743 | 1743 | $query = "ALTER TABLE marine_output ADD COLUMN type_id int(11) DEFAULT NULL"; |
1744 | 1744 | try { |
1745 | 1745 | $sth = $Connection->db->prepare($query); |
1746 | 1746 | $sth->execute(); |
1747 | - } catch(PDOException $e) { |
|
1747 | + } catch (PDOException $e) { |
|
1748 | 1748 | return "error (add column type_id in marine_output) : ".$e->getMessage()."\n"; |
1749 | 1749 | } |
1750 | 1750 | } |
1751 | - if (!$Connection->checkColumnName('marine_live','type_id')) { |
|
1751 | + if (!$Connection->checkColumnName('marine_live', 'type_id')) { |
|
1752 | 1752 | $query = "ALTER TABLE marine_live ADD COLUMN type_id int(11) DEFAULT NULL"; |
1753 | 1753 | try { |
1754 | 1754 | $sth = $Connection->db->prepare($query); |
1755 | 1755 | $sth->execute(); |
1756 | - } catch(PDOException $e) { |
|
1756 | + } catch (PDOException $e) { |
|
1757 | 1757 | return "error (add column type_id in marine_live) : ".$e->getMessage()."\n"; |
1758 | 1758 | } |
1759 | 1759 | } |
1760 | - if (!$Connection->checkColumnName('marine_archive','type_id')) { |
|
1760 | + if (!$Connection->checkColumnName('marine_archive', 'type_id')) { |
|
1761 | 1761 | $query = "ALTER TABLE marine_archive ADD COLUMN type_id int(11) DEFAULT NULL"; |
1762 | 1762 | try { |
1763 | 1763 | $sth = $Connection->db->prepare($query); |
1764 | 1764 | $sth->execute(); |
1765 | - } catch(PDOException $e) { |
|
1765 | + } catch (PDOException $e) { |
|
1766 | 1766 | return "error (add column type_id in marine_archive) : ".$e->getMessage()."\n"; |
1767 | 1767 | } |
1768 | 1768 | } |
1769 | - if (!$Connection->checkColumnName('marine_archive_output','type_id')) { |
|
1769 | + if (!$Connection->checkColumnName('marine_archive_output', 'type_id')) { |
|
1770 | 1770 | $query = "ALTER TABLE marine_archive_output ADD COLUMN type_id int(11) DEFAULT NULL"; |
1771 | 1771 | try { |
1772 | 1772 | $sth = $Connection->db->prepare($query); |
1773 | 1773 | $sth->execute(); |
1774 | - } catch(PDOException $e) { |
|
1774 | + } catch (PDOException $e) { |
|
1775 | 1775 | return "error (add column type_id in marine_archive_output) : ".$e->getMessage()."\n"; |
1776 | 1776 | } |
1777 | 1777 | } |
1778 | - if (!$Connection->checkColumnName('marine_output','status_id')) { |
|
1778 | + if (!$Connection->checkColumnName('marine_output', 'status_id')) { |
|
1779 | 1779 | $query = "ALTER TABLE marine_output ADD COLUMN status_id int(11) DEFAULT NULL"; |
1780 | 1780 | try { |
1781 | 1781 | $sth = $Connection->db->prepare($query); |
1782 | 1782 | $sth->execute(); |
1783 | - } catch(PDOException $e) { |
|
1783 | + } catch (PDOException $e) { |
|
1784 | 1784 | return "error (add column status_id in marine_output) : ".$e->getMessage()."\n"; |
1785 | 1785 | } |
1786 | 1786 | } |
1787 | - if (!$Connection->checkColumnName('marine_live','status_id')) { |
|
1787 | + if (!$Connection->checkColumnName('marine_live', 'status_id')) { |
|
1788 | 1788 | $query = "ALTER TABLE marine_live ADD COLUMN status_id int(11) DEFAULT NULL"; |
1789 | 1789 | try { |
1790 | 1790 | $sth = $Connection->db->prepare($query); |
1791 | 1791 | $sth->execute(); |
1792 | - } catch(PDOException $e) { |
|
1792 | + } catch (PDOException $e) { |
|
1793 | 1793 | return "error (add column status_id in marine_live) : ".$e->getMessage()."\n"; |
1794 | 1794 | } |
1795 | 1795 | } |
1796 | - if (!$Connection->checkColumnName('marine_archive','status_id')) { |
|
1796 | + if (!$Connection->checkColumnName('marine_archive', 'status_id')) { |
|
1797 | 1797 | $query = "ALTER TABLE marine_archive ADD COLUMN status_id int(11) DEFAULT NULL"; |
1798 | 1798 | try { |
1799 | 1799 | $sth = $Connection->db->prepare($query); |
1800 | 1800 | $sth->execute(); |
1801 | - } catch(PDOException $e) { |
|
1801 | + } catch (PDOException $e) { |
|
1802 | 1802 | return "error (add column status_id in marine_archive) : ".$e->getMessage()."\n"; |
1803 | 1803 | } |
1804 | 1804 | } |
1805 | - if (!$Connection->checkColumnName('marine_archive_output','status_id')) { |
|
1805 | + if (!$Connection->checkColumnName('marine_archive_output', 'status_id')) { |
|
1806 | 1806 | $query = "ALTER TABLE marine_archive_output ADD COLUMN status_id int(11) DEFAULT NULL"; |
1807 | 1807 | try { |
1808 | 1808 | $sth = $Connection->db->prepare($query); |
1809 | 1809 | $sth->execute(); |
1810 | - } catch(PDOException $e) { |
|
1810 | + } catch (PDOException $e) { |
|
1811 | 1811 | return "error (add column status_id in marine_archive_output) : ".$e->getMessage()."\n"; |
1812 | 1812 | } |
1813 | 1813 | } |
1814 | 1814 | } else { |
1815 | - if (!$Connection->checkColumnName('marine_output','type_id')) { |
|
1815 | + if (!$Connection->checkColumnName('marine_output', 'type_id')) { |
|
1816 | 1816 | $query = "ALTER TABLE marine_output ADD COLUMN type_id integer DEFAULT NULL"; |
1817 | 1817 | try { |
1818 | 1818 | $sth = $Connection->db->prepare($query); |
1819 | 1819 | $sth->execute(); |
1820 | - } catch(PDOException $e) { |
|
1820 | + } catch (PDOException $e) { |
|
1821 | 1821 | return "error (add column type_id in marine_output) : ".$e->getMessage()."\n"; |
1822 | 1822 | } |
1823 | 1823 | } |
1824 | - if (!$Connection->checkColumnName('marine_live','type_id')) { |
|
1824 | + if (!$Connection->checkColumnName('marine_live', 'type_id')) { |
|
1825 | 1825 | $query = "ALTER TABLE marine_live ADD COLUMN type_id integer DEFAULT NULL"; |
1826 | 1826 | try { |
1827 | 1827 | $sth = $Connection->db->prepare($query); |
1828 | 1828 | $sth->execute(); |
1829 | - } catch(PDOException $e) { |
|
1829 | + } catch (PDOException $e) { |
|
1830 | 1830 | return "error (add column type_id in marine_live) : ".$e->getMessage()."\n"; |
1831 | 1831 | } |
1832 | 1832 | } |
1833 | - if (!$Connection->checkColumnName('marine_archive','type_id')) { |
|
1833 | + if (!$Connection->checkColumnName('marine_archive', 'type_id')) { |
|
1834 | 1834 | $query = "ALTER TABLE marine_archive ADD COLUMN type_id integer DEFAULT NULL"; |
1835 | 1835 | try { |
1836 | 1836 | $sth = $Connection->db->prepare($query); |
1837 | 1837 | $sth->execute(); |
1838 | - } catch(PDOException $e) { |
|
1838 | + } catch (PDOException $e) { |
|
1839 | 1839 | return "error (add column type_id in marine_archive) : ".$e->getMessage()."\n"; |
1840 | 1840 | } |
1841 | 1841 | } |
1842 | - if (!$Connection->checkColumnName('marine_archive_output','type_id')) { |
|
1842 | + if (!$Connection->checkColumnName('marine_archive_output', 'type_id')) { |
|
1843 | 1843 | $query = "ALTER TABLE marine_archive_output ADD COLUMN type_id integer DEFAULT NULL"; |
1844 | 1844 | try { |
1845 | 1845 | $sth = $Connection->db->prepare($query); |
1846 | 1846 | $sth->execute(); |
1847 | - } catch(PDOException $e) { |
|
1847 | + } catch (PDOException $e) { |
|
1848 | 1848 | return "error (add column type_id in marine_archive_output) : ".$e->getMessage()."\n"; |
1849 | 1849 | } |
1850 | 1850 | } |
1851 | - if (!$Connection->checkColumnName('marine_output','status_id')) { |
|
1851 | + if (!$Connection->checkColumnName('marine_output', 'status_id')) { |
|
1852 | 1852 | $query = "ALTER TABLE marine_output ADD COLUMN status_id integer DEFAULT NULL"; |
1853 | 1853 | try { |
1854 | 1854 | $sth = $Connection->db->prepare($query); |
1855 | 1855 | $sth->execute(); |
1856 | - } catch(PDOException $e) { |
|
1856 | + } catch (PDOException $e) { |
|
1857 | 1857 | return "error (add column status_id in marine_output) : ".$e->getMessage()."\n"; |
1858 | 1858 | } |
1859 | 1859 | } |
1860 | - if (!$Connection->checkColumnName('marine_live','status_id')) { |
|
1860 | + if (!$Connection->checkColumnName('marine_live', 'status_id')) { |
|
1861 | 1861 | $query = "ALTER TABLE marine_live ADD COLUMN status_id integer DEFAULT NULL"; |
1862 | 1862 | try { |
1863 | 1863 | $sth = $Connection->db->prepare($query); |
1864 | 1864 | $sth->execute(); |
1865 | - } catch(PDOException $e) { |
|
1865 | + } catch (PDOException $e) { |
|
1866 | 1866 | return "error (add column status_id in marine_live) : ".$e->getMessage()."\n"; |
1867 | 1867 | } |
1868 | 1868 | } |
1869 | - if (!$Connection->checkColumnName('marine_archive','status_id')) { |
|
1869 | + if (!$Connection->checkColumnName('marine_archive', 'status_id')) { |
|
1870 | 1870 | $query = "ALTER TABLE marine_archive ADD COLUMN status_id integer DEFAULT NULL"; |
1871 | 1871 | try { |
1872 | 1872 | $sth = $Connection->db->prepare($query); |
1873 | 1873 | $sth->execute(); |
1874 | - } catch(PDOException $e) { |
|
1874 | + } catch (PDOException $e) { |
|
1875 | 1875 | return "error (add column status_id in marine_archive) : ".$e->getMessage()."\n"; |
1876 | 1876 | } |
1877 | 1877 | } |
1878 | - if (!$Connection->checkColumnName('marine_archive_output','status_id')) { |
|
1878 | + if (!$Connection->checkColumnName('marine_archive_output', 'status_id')) { |
|
1879 | 1879 | $query = "ALTER TABLE marine_archive_output ADD COLUMN status_id integer DEFAULT NULL"; |
1880 | 1880 | try { |
1881 | 1881 | $sth = $Connection->db->prepare($query); |
1882 | 1882 | $sth->execute(); |
1883 | - } catch(PDOException $e) { |
|
1883 | + } catch (PDOException $e) { |
|
1884 | 1884 | return "error (add column status_id in marine_archive_output) : ".$e->getMessage()."\n"; |
1885 | 1885 | } |
1886 | 1886 | } |
@@ -1889,7 +1889,7 @@ discard block |
||
1889 | 1889 | try { |
1890 | 1890 | $sth = $Connection->db->prepare($query); |
1891 | 1891 | $sth->execute(); |
1892 | - } catch(PDOException $e) { |
|
1892 | + } catch (PDOException $e) { |
|
1893 | 1893 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1894 | 1894 | } |
1895 | 1895 | return $error; |
@@ -1904,14 +1904,14 @@ discard block |
||
1904 | 1904 | try { |
1905 | 1905 | $sth = $Connection->db->prepare($query); |
1906 | 1906 | $sth->execute(); |
1907 | - } catch(PDOException $e) { |
|
1907 | + } catch (PDOException $e) { |
|
1908 | 1908 | return "error (change pilot_id type to varchar in stats_pilot) : ".$e->getMessage()."\n"; |
1909 | 1909 | } |
1910 | 1910 | $query = "ALTER TABLE marine_identity MODIFY COLUMN mmsi varchar(255) DEFAULT NULL"; |
1911 | 1911 | try { |
1912 | 1912 | $sth = $Connection->db->prepare($query); |
1913 | 1913 | $sth->execute(); |
1914 | - } catch(PDOException $e) { |
|
1914 | + } catch (PDOException $e) { |
|
1915 | 1915 | return "error (change mmsi type to varchar in marine_identity) : ".$e->getMessage()."\n"; |
1916 | 1916 | } |
1917 | 1917 | } else { |
@@ -1919,14 +1919,14 @@ discard block |
||
1919 | 1919 | try { |
1920 | 1920 | $sth = $Connection->db->prepare($query); |
1921 | 1921 | $sth->execute(); |
1922 | - } catch(PDOException $e) { |
|
1922 | + } catch (PDOException $e) { |
|
1923 | 1923 | return "error (change pilot_id type to varchar in stats_pilot) : ".$e->getMessage()."\n"; |
1924 | 1924 | } |
1925 | 1925 | $query = "alter table marine_identity alter column mmsi type varchar(255)"; |
1926 | 1926 | try { |
1927 | 1927 | $sth = $Connection->db->prepare($query); |
1928 | 1928 | $sth->execute(); |
1929 | - } catch(PDOException $e) { |
|
1929 | + } catch (PDOException $e) { |
|
1930 | 1930 | return "error (change mmsi type to varchar in marine_identity) : ".$e->getMessage()."\n"; |
1931 | 1931 | } |
1932 | 1932 | } |
@@ -1934,7 +1934,7 @@ discard block |
||
1934 | 1934 | try { |
1935 | 1935 | $sth = $Connection->db->prepare($query); |
1936 | 1936 | $sth->execute(); |
1937 | - } catch(PDOException $e) { |
|
1937 | + } catch (PDOException $e) { |
|
1938 | 1938 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1939 | 1939 | } |
1940 | 1940 | return $error; |
@@ -1944,32 +1944,32 @@ discard block |
||
1944 | 1944 | global $globalDBdriver; |
1945 | 1945 | $Connection = new Connection(); |
1946 | 1946 | $error = ''; |
1947 | - if (!$Connection->checkColumnName('source_location','last_seen')) { |
|
1947 | + if (!$Connection->checkColumnName('source_location', 'last_seen')) { |
|
1948 | 1948 | $query = "ALTER TABLE source_location ADD COLUMN last_seen timestamp NULL DEFAULT NULL"; |
1949 | 1949 | try { |
1950 | 1950 | $sth = $Connection->db->prepare($query); |
1951 | 1951 | $sth->execute(); |
1952 | - } catch(PDOException $e) { |
|
1952 | + } catch (PDOException $e) { |
|
1953 | 1953 | return "error (add column last_seen in source_location) : ".$e->getMessage()."\n"; |
1954 | 1954 | } |
1955 | 1955 | } |
1956 | 1956 | if ($globalDBdriver == 'mysql') { |
1957 | - if (!$Connection->checkColumnName('source_location','location_id')) { |
|
1957 | + if (!$Connection->checkColumnName('source_location', 'location_id')) { |
|
1958 | 1958 | $query = "ALTER TABLE source_location ADD COLUMN location_id int(11) DEFAULT NULL"; |
1959 | 1959 | try { |
1960 | 1960 | $sth = $Connection->db->prepare($query); |
1961 | 1961 | $sth->execute(); |
1962 | - } catch(PDOException $e) { |
|
1962 | + } catch (PDOException $e) { |
|
1963 | 1963 | return "error (add column location_id in source_location) : ".$e->getMessage()."\n"; |
1964 | 1964 | } |
1965 | 1965 | } |
1966 | 1966 | } else { |
1967 | - if (!$Connection->checkColumnName('source_location','location_id')) { |
|
1967 | + if (!$Connection->checkColumnName('source_location', 'location_id')) { |
|
1968 | 1968 | $query = "ALTER TABLE source_location ADD COLUMN location_id integer DEFAULT NULL"; |
1969 | 1969 | try { |
1970 | 1970 | $sth = $Connection->db->prepare($query); |
1971 | 1971 | $sth->execute(); |
1972 | - } catch(PDOException $e) { |
|
1972 | + } catch (PDOException $e) { |
|
1973 | 1973 | return "error (add column location_id in source_location) : ".$e->getMessage()."\n"; |
1974 | 1974 | } |
1975 | 1975 | } |
@@ -1978,7 +1978,7 @@ discard block |
||
1978 | 1978 | try { |
1979 | 1979 | $sth = $Connection->db->prepare($query); |
1980 | 1980 | $sth->execute(); |
1981 | - } catch(PDOException $e) { |
|
1981 | + } catch (PDOException $e) { |
|
1982 | 1982 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1983 | 1983 | } |
1984 | 1984 | return $error; |
@@ -1988,12 +1988,12 @@ discard block |
||
1988 | 1988 | global $globalDBdriver; |
1989 | 1989 | $Connection = new Connection(); |
1990 | 1990 | $error = ''; |
1991 | - if (!$Connection->checkColumnName('source_location','description')) { |
|
1991 | + if (!$Connection->checkColumnName('source_location', 'description')) { |
|
1992 | 1992 | $query = "ALTER TABLE source_location ADD COLUMN description text DEFAULT NULL"; |
1993 | 1993 | try { |
1994 | 1994 | $sth = $Connection->db->prepare($query); |
1995 | 1995 | $sth->execute(); |
1996 | - } catch(PDOException $e) { |
|
1996 | + } catch (PDOException $e) { |
|
1997 | 1997 | return "error (add column description in source_location) : ".$e->getMessage()."\n"; |
1998 | 1998 | } |
1999 | 1999 | } |
@@ -2001,7 +2001,7 @@ discard block |
||
2001 | 2001 | try { |
2002 | 2002 | $sth = $Connection->db->prepare($query); |
2003 | 2003 | $sth->execute(); |
2004 | - } catch(PDOException $e) { |
|
2004 | + } catch (PDOException $e) { |
|
2005 | 2005 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2006 | 2006 | } |
2007 | 2007 | return $error; |
@@ -2011,39 +2011,39 @@ discard block |
||
2011 | 2011 | global $globalDBdriver; |
2012 | 2012 | $Connection = new Connection(); |
2013 | 2013 | $error = ''; |
2014 | - if (!$Connection->checkColumnName('spotter_live','real_altitude')) { |
|
2014 | + if (!$Connection->checkColumnName('spotter_live', 'real_altitude')) { |
|
2015 | 2015 | $query = "ALTER TABLE spotter_live ADD COLUMN real_altitude float DEFAULT NULL"; |
2016 | 2016 | try { |
2017 | 2017 | $sth = $Connection->db->prepare($query); |
2018 | 2018 | $sth->execute(); |
2019 | - } catch(PDOException $e) { |
|
2019 | + } catch (PDOException $e) { |
|
2020 | 2020 | return "error (add column real_altitude in spotter_live) : ".$e->getMessage()."\n"; |
2021 | 2021 | } |
2022 | 2022 | } |
2023 | - if (!$Connection->checkColumnName('spotter_output','real_altitude')) { |
|
2023 | + if (!$Connection->checkColumnName('spotter_output', 'real_altitude')) { |
|
2024 | 2024 | $query = "ALTER TABLE spotter_output ADD COLUMN real_altitude float DEFAULT NULL"; |
2025 | 2025 | try { |
2026 | 2026 | $sth = $Connection->db->prepare($query); |
2027 | 2027 | $sth->execute(); |
2028 | - } catch(PDOException $e) { |
|
2028 | + } catch (PDOException $e) { |
|
2029 | 2029 | return "error (add column real_altitude in spotter_output) : ".$e->getMessage()."\n"; |
2030 | 2030 | } |
2031 | 2031 | } |
2032 | - if (!$Connection->checkColumnName('spotter_archive_output','real_altitude')) { |
|
2032 | + if (!$Connection->checkColumnName('spotter_archive_output', 'real_altitude')) { |
|
2033 | 2033 | $query = "ALTER TABLE spotter_archive_output ADD COLUMN real_altitude float DEFAULT NULL"; |
2034 | 2034 | try { |
2035 | 2035 | $sth = $Connection->db->prepare($query); |
2036 | 2036 | $sth->execute(); |
2037 | - } catch(PDOException $e) { |
|
2037 | + } catch (PDOException $e) { |
|
2038 | 2038 | return "error (add column real_altitude in spotter_archive_output) : ".$e->getMessage()."\n"; |
2039 | 2039 | } |
2040 | 2040 | } |
2041 | - if (!$Connection->checkColumnName('spotter_archive','real_altitude')) { |
|
2041 | + if (!$Connection->checkColumnName('spotter_archive', 'real_altitude')) { |
|
2042 | 2042 | $query = "ALTER TABLE spotter_archive ADD COLUMN real_altitude float DEFAULT NULL"; |
2043 | 2043 | try { |
2044 | 2044 | $sth = $Connection->db->prepare($query); |
2045 | 2045 | $sth->execute(); |
2046 | - } catch(PDOException $e) { |
|
2046 | + } catch (PDOException $e) { |
|
2047 | 2047 | return "error (add column real_altitude in spotter_archive) : ".$e->getMessage()."\n"; |
2048 | 2048 | } |
2049 | 2049 | } |
@@ -2051,7 +2051,7 @@ discard block |
||
2051 | 2051 | try { |
2052 | 2052 | $sth = $Connection->db->prepare($query); |
2053 | 2053 | $sth->execute(); |
2054 | - } catch(PDOException $e) { |
|
2054 | + } catch (PDOException $e) { |
|
2055 | 2055 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2056 | 2056 | } |
2057 | 2057 | return $error; |
@@ -2073,14 +2073,14 @@ discard block |
||
2073 | 2073 | try { |
2074 | 2074 | $sth = $Connection->db->prepare($query); |
2075 | 2075 | $sth->execute(); |
2076 | - } catch(PDOException $e) { |
|
2076 | + } catch (PDOException $e) { |
|
2077 | 2077 | return "error (modify column altitude in tracker_*) : ".$e->getMessage()."\n"; |
2078 | 2078 | } |
2079 | 2079 | $query = "UPDATE config SET value = '44' WHERE name = 'schema_version'"; |
2080 | 2080 | try { |
2081 | 2081 | $sth = $Connection->db->prepare($query); |
2082 | 2082 | $sth->execute(); |
2083 | - } catch(PDOException $e) { |
|
2083 | + } catch (PDOException $e) { |
|
2084 | 2084 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2085 | 2085 | } |
2086 | 2086 | return $error; |
@@ -2103,7 +2103,7 @@ discard block |
||
2103 | 2103 | try { |
2104 | 2104 | $sth = $Connection->db->prepare($query); |
2105 | 2105 | $sth->execute(); |
2106 | - } catch(PDOException $e) { |
|
2106 | + } catch (PDOException $e) { |
|
2107 | 2107 | return "error : ".$e->getMessage()."\n"; |
2108 | 2108 | } |
2109 | 2109 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require_once(dirname(__FILE__).'/settings.php'); |
3 | 3 | |
4 | -class Connection{ |
|
4 | +class Connection { |
|
5 | 5 | public $db = null; |
6 | 6 | public $dbs = array(); |
7 | 7 | public $latest_schema = 44; |
8 | 8 | |
9 | - public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
|
9 | + public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) { |
|
10 | 10 | global $globalDBdriver, $globalNoDB; |
11 | 11 | if (isset($globalNoDB) && $globalNoDB === TRUE) { |
12 | 12 | $this->db = null; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | if ($user === null && $pass === null) { |
17 | 17 | $this->createDBConnection(); |
18 | 18 | } else { |
19 | - $this->createDBConnection(null,$user,$pass); |
|
19 | + $this->createDBConnection(null, $user, $pass); |
|
20 | 20 | } |
21 | 21 | } else { |
22 | 22 | $this->createDBConnection($dbname); |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | while (true) { |
101 | 101 | try { |
102 | 102 | if ($globalDBSdriver == 'mysql') { |
103 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
103 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
104 | 104 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
105 | 105 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
106 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
107 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
108 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
109 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
110 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
106 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
107 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500); |
|
108 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
109 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
110 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
111 | 111 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
112 | 112 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
113 | 113 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -117,19 +117,19 @@ discard block |
||
117 | 117 | $this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"'); |
118 | 118 | //$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"'); |
119 | 119 | } else { |
120 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
120 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
121 | 121 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
122 | 122 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
123 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
124 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
125 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
126 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
127 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
123 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
124 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200); |
|
125 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
126 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
127 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
128 | 128 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
129 | 129 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
130 | 130 | } |
131 | 131 | break; |
132 | - } catch(PDOException $e) { |
|
132 | + } catch (PDOException $e) { |
|
133 | 133 | $i++; |
134 | 134 | if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
135 | 135 | //exit; |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | try { |
154 | 154 | //$Connection = new Connection(); |
155 | 155 | $results = $this->db->query($query); |
156 | - } catch(PDOException $e) { |
|
156 | + } catch (PDOException $e) { |
|
157 | 157 | return false; |
158 | 158 | } |
159 | - if($results->rowCount()>0) { |
|
159 | + if ($results->rowCount() > 0) { |
|
160 | 160 | return true; |
161 | 161 | } |
162 | 162 | else return false; |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | return false; |
178 | 178 | } |
179 | 179 | |
180 | - } catch(PDOException $e) { |
|
181 | - if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
180 | + } catch (PDOException $e) { |
|
181 | + if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
182 | 182 | throw $e; |
183 | 183 | } |
184 | 184 | //echo 'error ! '.$e->getMessage(); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | /* |
191 | 191 | * Check if index exist |
192 | 192 | */ |
193 | - public function indexExists($table,$index) |
|
193 | + public function indexExists($table, $index) |
|
194 | 194 | { |
195 | 195 | global $globalDBdriver, $globalDBname; |
196 | 196 | if ($globalDBdriver == 'mysql') { |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | try { |
202 | 202 | //$Connection = new Connection(); |
203 | 203 | $results = $this->db->query($query); |
204 | - } catch(PDOException $e) { |
|
204 | + } catch (PDOException $e) { |
|
205 | 205 | return false; |
206 | 206 | } |
207 | 207 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
208 | - if($nb[0]['nb'] > 0) { |
|
208 | + if ($nb[0]['nb'] > 0) { |
|
209 | 209 | return true; |
210 | 210 | } |
211 | 211 | else return false; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
221 | 221 | try { |
222 | 222 | $results = $this->db->query($query); |
223 | - } catch(PDOException $e) { |
|
223 | + } catch (PDOException $e) { |
|
224 | 224 | return "error : ".$e->getMessage()."\n"; |
225 | 225 | } |
226 | 226 | $columns = array(); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | return $columns; |
233 | 233 | } |
234 | 234 | |
235 | - public function getColumnType($table,$column) { |
|
235 | + public function getColumnType($table, $column) { |
|
236 | 236 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
237 | 237 | $tomet = $select->getColumnMeta(0); |
238 | 238 | return $tomet['native_type']; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * Check if a column name exist in a table |
243 | 243 | * @return Boolean column exist or not |
244 | 244 | */ |
245 | - public function checkColumnName($table,$name) |
|
245 | + public function checkColumnName($table, $name) |
|
246 | 246 | { |
247 | 247 | global $globalDBdriver, $globalDBname; |
248 | 248 | if ($globalDBdriver == 'mysql') { |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | } |
253 | 253 | try { |
254 | 254 | $sth = $this->db()->prepare($query); |
255 | - $sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name)); |
|
256 | - } catch(PDOException $e) { |
|
255 | + $sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name)); |
|
256 | + } catch (PDOException $e) { |
|
257 | 257 | echo "error : ".$e->getMessage()."\n"; |
258 | 258 | } |
259 | 259 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | try { |
293 | 293 | $sth = $this->db->prepare($query); |
294 | 294 | $sth->execute(); |
295 | - } catch(PDOException $e) { |
|
295 | + } catch (PDOException $e) { |
|
296 | 296 | return "error : ".$e->getMessage()."\n"; |
297 | 297 | } |
298 | 298 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if (isset($this->all_tracked[$key]['id'])) { |
48 | 48 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
49 | 49 | $Tracker = new Tracker($this->db); |
50 | - $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
50 | + $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
59 | 59 | foreach ($this->all_tracked as $key => $flight) { |
60 | 60 | if (isset($flight['lastupdate'])) { |
61 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
61 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
62 | 62 | if (isset($this->all_tracked[$key]['id'])) { |
63 | 63 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
64 | 64 | /* |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | //$real_arrival = $this->arrival($key); |
70 | 70 | $Tracker = new Tracker($this->db); |
71 | 71 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
72 | - $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
|
72 | + $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed']); |
|
73 | 73 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
74 | 74 | } |
75 | 75 | // Put in archive |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $send = false; |
90 | 90 | |
91 | 91 | // SBS format is CSV format |
92 | - if(is_array($line) && isset($line['ident'])) { |
|
92 | + if (is_array($line) && isset($line['ident'])) { |
|
93 | 93 | //print_r($line); |
94 | 94 | if (isset($line['ident'])) { |
95 | 95 | |
@@ -113,33 +113,33 @@ discard block |
||
113 | 113 | |
114 | 114 | if (!isset($this->all_tracked[$id])) { |
115 | 115 | $this->all_tracked[$id] = array(); |
116 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
117 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
118 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
116 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedTracker' => 0)); |
|
117 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '')); |
|
118 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
119 | 119 | if (!isset($line['id'])) { |
120 | 120 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
121 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
122 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
121 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
122 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); |
|
123 | 123 | if ($globalAllTracked !== FALSE) $dataFound = true; |
124 | 124 | } |
125 | 125 | |
126 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
126 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
127 | 127 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
128 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
128 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
129 | 129 | } else { |
130 | 130 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
131 | 131 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
132 | 132 | return ''; |
133 | 133 | } |
134 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
134 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
135 | 135 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!"; |
136 | 136 | return ''; |
137 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
137 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
138 | 138 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!"; |
139 | 139 | return ''; |
140 | 140 | } elseif (!isset($line['datetime'])) { |
141 | 141 | date_default_timezone_set('UTC'); |
142 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
142 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
143 | 143 | } else { |
144 | 144 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!"; |
145 | 145 | return ''; |
@@ -147,38 +147,38 @@ discard block |
||
147 | 147 | |
148 | 148 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
149 | 149 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
150 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
150 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
151 | 151 | if ($this->all_tracked[$id]['addedTracker'] == 1) { |
152 | 152 | $timeelapsed = microtime(true); |
153 | 153 | $Tracker = new Tracker($this->db); |
154 | 154 | $fromsource = NULL; |
155 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
155 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
156 | 156 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
157 | 157 | $Tracker->db = null; |
158 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
158 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
159 | 159 | } |
160 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
160 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | if (isset($line['speed']) && $line['speed'] != '') { |
164 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
164 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed']))); |
|
165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
166 | 166 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
167 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
167 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
168 | 168 | if ($distance > 100 && $distance < 10000) { |
169 | 169 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
170 | 170 | $speed = $speed*3.6; |
171 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
171 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed))); |
|
172 | 172 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | 176 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
177 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
178 | 178 | else unset($timediff); |
179 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
179 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) { |
|
180 | 180 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
181 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
181 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
182 | 182 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
183 | 183 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
184 | 184 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
187 | 187 | $timeelapsed = microtime(true); |
188 | 188 | $Tracker = new Tracker($this->db); |
189 | - $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
189 | + $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
190 | 190 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
191 | 191 | $Tracker->db = null; |
192 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
192 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
193 | 193 | $this->tmd = 0; |
194 | 194 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
195 | 195 | } |
@@ -197,73 +197,73 @@ discard block |
||
197 | 197 | |
198 | 198 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
199 | 199 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
200 | - if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
200 | + if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
201 | 201 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
202 | 202 | $dataFound = true; |
203 | 203 | $this->all_tracked[$id]['time_last_coord'] = time(); |
204 | 204 | } |
205 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
205 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
206 | 206 | } |
207 | 207 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
208 | 208 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
209 | 209 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
210 | - if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
210 | + if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
211 | 211 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
212 | 212 | $dataFound = true; |
213 | 213 | $this->all_tracked[$id]['time_last_coord'] = time(); |
214 | 214 | } |
215 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
215 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | } else if ($globalDebug && $timediff > 20) { |
219 | 219 | $this->tmd = $this->tmd + 1; |
220 | 220 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
221 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
222 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
221 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
222 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
223 | 223 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
224 | 224 | } |
225 | 225 | } |
226 | 226 | if (isset($line['last_update']) && $line['last_update'] != '') { |
227 | 227 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
228 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
228 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
229 | 229 | } |
230 | 230 | if (isset($line['format_source']) && $line['format_source'] != '') { |
231 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
231 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
232 | 232 | } |
233 | 233 | if (isset($line['source_name']) && $line['source_name'] != '') { |
234 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
234 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
235 | 235 | } |
236 | 236 | if (isset($line['comment']) && $line['comment'] != '') { |
237 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
237 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('comment' => $line['comment'])); |
|
238 | 238 | //$dataFound = true; |
239 | 239 | } |
240 | 240 | if (isset($line['type']) && $line['type'] != '') { |
241 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
241 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
242 | 242 | //$dataFound = true; |
243 | 243 | } |
244 | 244 | |
245 | 245 | if (isset($line['altitude']) && $line['altitude'] != '') { |
246 | 246 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
247 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
248 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
|
249 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
|
247 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
248 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude' => $line['altitude'])); |
|
249 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude_real' => $line['altitude'])); |
|
250 | 250 | //$dataFound = true; |
251 | 251 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
252 | 252 | } |
253 | 253 | |
254 | 254 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
255 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
255 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | if (isset($line['heading']) && $line['heading'] != '') { |
259 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
260 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
261 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
259 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
260 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
261 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
262 | 262 | //$dataFound = true; |
263 | 263 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
264 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
265 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
266 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
264 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
265 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); |
|
266 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
267 | 267 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
268 | 268 | } |
269 | 269 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -271,54 +271,54 @@ discard block |
||
271 | 271 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
272 | 272 | $this->all_tracked[$id]['lastupdate'] = time(); |
273 | 273 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
274 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
274 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
275 | 275 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
276 | 276 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
277 | 277 | $timeelapsed = microtime(true); |
278 | 278 | $TrackerLive = new TrackerLive($this->db); |
279 | 279 | if (isset($line['id'])) { |
280 | 280 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
281 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
281 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
282 | 282 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
283 | 283 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
284 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
284 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
285 | 285 | } else $recent_ident = ''; |
286 | - $TrackerLive->db=null; |
|
286 | + $TrackerLive->db = null; |
|
287 | 287 | |
288 | 288 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
289 | 289 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
290 | 290 | } else { |
291 | 291 | $recent_ident = ''; |
292 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
292 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
293 | 293 | } |
294 | 294 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
295 | - if($recent_ident == "") |
|
295 | + if ($recent_ident == "") |
|
296 | 296 | { |
297 | 297 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
298 | 298 | //adds the spotter data for the archive |
299 | 299 | $highlight = ''; |
300 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
300 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
301 | 301 | $timeelapsed = microtime(true); |
302 | 302 | $Tracker = new Tracker($this->db); |
303 | - $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
303 | + $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']); |
|
304 | 304 | $Tracker->db = null; |
305 | 305 | if ($globalDebug && isset($result)) echo $result."\n"; |
306 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
306 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
307 | 307 | |
308 | 308 | |
309 | 309 | // Add source stat in DB |
310 | 310 | $Stats = new Stats($this->db); |
311 | 311 | if (!empty($this->stats)) { |
312 | 312 | if ($globalDebug) echo 'Add source stats : '; |
313 | - foreach($this->stats as $date => $data) { |
|
314 | - foreach($data as $source => $sourced) { |
|
313 | + foreach ($this->stats as $date => $data) { |
|
314 | + foreach ($data as $source => $sourced) { |
|
315 | 315 | //print_r($sourced); |
316 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
317 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
316 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_tracker', $date); |
|
317 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_tracker', $date); |
|
318 | 318 | if (isset($sourced['msg'])) { |
319 | 319 | if (time() - $sourced['msg']['date'] > 10) { |
320 | 320 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
321 | - echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
321 | + echo $Stats->addStatSource($nbmsg, $source, 'msg_tracker', $date); |
|
322 | 322 | unset($this->stats[$date][$source]['msg']); |
323 | 323 | } |
324 | 324 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
342 | 342 | $TrackerLive = new TrackerLive($this->db); |
343 | 343 | $TrackerLive->deleteLiveTrackerData(); |
344 | - $TrackerLive->db=null; |
|
344 | + $TrackerLive->db = null; |
|
345 | 345 | if ($globalDebug) echo " Done\n"; |
346 | 346 | $this->last_delete = time(); |
347 | 347 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $this->all_tracked[$id]['addedTracker'] = 1; |
351 | 351 | if (isset($globalDaemon) && !$globalDaemon) { |
352 | 352 | $Tracker = new Tracker($this->db); |
353 | - $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['altitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
|
353 | + $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']); |
|
354 | 354 | $Tracker->db = null; |
355 | 355 | } |
356 | 356 | |
@@ -364,14 +364,14 @@ discard block |
||
364 | 364 | $ignoreImport = false; |
365 | 365 | |
366 | 366 | if (!$ignoreImport) { |
367 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
367 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
368 | 368 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
369 | 369 | $timeelapsed = microtime(true); |
370 | 370 | $TrackerLive = new TrackerLive($this->db); |
371 | - $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
371 | + $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
372 | 372 | $TrackerLive->db = null; |
373 | 373 | $this->all_tracked[$id]['putinarchive'] = false; |
374 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
374 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
375 | 375 | |
376 | 376 | // Put statistics in $this->stats variable |
377 | 377 | |
@@ -388,19 +388,19 @@ discard block |
||
388 | 388 | $latitude = $globalCenterLatitude; |
389 | 389 | $longitude = $globalCenterLongitude; |
390 | 390 | } |
391 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
391 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
392 | 392 | } else { |
393 | 393 | $latitude = $this->source_location[$source]['latitude']; |
394 | 394 | $longitude = $this->source_location[$source]['longitude']; |
395 | 395 | } |
396 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
396 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
397 | 397 | //$stats_heading = $stats_heading%22.5; |
398 | 398 | $stats_heading = round($stats_heading/22.5); |
399 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
399 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
400 | 400 | $current_date = date('Y-m-d'); |
401 | 401 | if ($stats_heading == 16) $stats_heading = 0; |
402 | 402 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
403 | - for ($i=0;$i<=15;$i++) { |
|
403 | + for ($i = 0; $i <= 15; $i++) { |
|
404 | 404 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
405 | 405 | } |
406 | 406 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -415,9 +415,9 @@ discard block |
||
415 | 415 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
416 | 416 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
417 | 417 | end($this->stats[$current_date][$source]['hist']); |
418 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
418 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
419 | 419 | } else $mini = 0; |
420 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
420 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
421 | 421 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
422 | 422 | } |
423 | 423 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | $this->all_tracked[$id]['lastupdate'] = time(); |
430 | 430 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
431 | 431 | if ($globalDebug) echo $result."\n"; |
432 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
432 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
433 | 433 | //$this->del(); |
434 | 434 | |
435 | 435 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | $orderby = $Spotter->getOrderBy(); |
7 | 7 | |
8 | -$ask = filter_input(INPUT_GET,'ask',FILTER_SANITIZE_STRING); |
|
8 | +$ask = filter_input(INPUT_GET, 'ask', FILTER_SANITIZE_STRING); |
|
9 | 9 | if ($ask == 'aircraftsdetected') { |
10 | 10 | require_once('require/class.SpotterLive.php'); |
11 | 11 | $SpotterLive = new SpotterLive(); |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | } elseif ($ask == 'manufacturer') { |
25 | 25 | $manufacturers = $Spotter->getAllManufacturers(); |
26 | 26 | $all_manufacturers = array(); |
27 | - foreach($manufacturers as $manufacturer) |
|
27 | + foreach ($manufacturers as $manufacturer) |
|
28 | 28 | { |
29 | - $all_manufacturers[] = array('value' => $manufacturer['aircraft_manufacturer'], 'id' => strtolower(str_replace(' ','-',$manufacturer['aircraft_manufacturer']))); |
|
29 | + $all_manufacturers[] = array('value' => $manufacturer['aircraft_manufacturer'], 'id' => strtolower(str_replace(' ', '-', $manufacturer['aircraft_manufacturer']))); |
|
30 | 30 | } |
31 | 31 | echo json_encode($all_manufacturers); |
32 | 32 | } elseif ($ask == 'aircrafttypes') { |
33 | 33 | $aircraft_types = $Spotter->getAllAircraftTypes(); |
34 | 34 | $all_aircraft_types = array(); |
35 | - foreach($aircraft_types as $aircraft_type) |
|
35 | + foreach ($aircraft_types as $aircraft_type) |
|
36 | 36 | { |
37 | 37 | $all_aircraft_types[] = array('id' => $aircraft_type['aircraft_icao'], 'value' => $aircraft_type['aircraft_name'].' ('.$aircraft_type['aircraft_icao'].')'); |
38 | 38 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } elseif ($ask == 'airlinenames') { |
41 | 41 | $airline_names = $Spotter->getAllAirlineNames(); |
42 | 42 | $all_airline_names = array(); |
43 | - foreach($airline_names as $airline_name) |
|
43 | + foreach ($airline_names as $airline_name) |
|
44 | 44 | { |
45 | 45 | $all_airline_names[] = array('id' => $airline_name['airline_icao'], 'value' => $airline_name['airline_name'].' ('.$airline_name['airline_icao'].')'); |
46 | 46 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } elseif ($ask == 'airlinecountries') { |
49 | 49 | $airline_countries = $Spotter->getAllAirlineCountries(); |
50 | 50 | $all_airline_countries = array(); |
51 | - foreach($airline_countries as $airline_country) |
|
51 | + foreach ($airline_countries as $airline_country) |
|
52 | 52 | { |
53 | 53 | $all_airline_countries[] = array('id' => $airline_country['airline_country'], 'value' => $airline_country['airline_country']); |
54 | 54 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $airport_names = $Spotter->getAllAirportNames(); |
58 | 58 | ksort($airport_names); |
59 | 59 | $all_airport_names = array(); |
60 | - foreach($airport_names as $airport_name) |
|
60 | + foreach ($airport_names as $airport_name) |
|
61 | 61 | { |
62 | 62 | $all_airport_names[] = array('id' => $airport_name['airport_icao'], 'value' => $airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')'); |
63 | 63 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } elseif ($ask == 'airportcountries') { |
66 | 66 | $airport_countries = $Spotter->getAllAirportCountries(); |
67 | 67 | $all_airport_countries = array(); |
68 | - foreach($airport_countries as $airport_country) |
|
68 | + foreach ($airport_countries as $airport_country) |
|
69 | 69 | { |
70 | 70 | $all_airport_countries[] = array('id' => $airport_country['airport_country'], 'value' => $airport_country['airport_country']); |
71 | 71 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | default: |
42 | 42 | throw new \Exception("bad resolution can be only one of 1,3"); |
43 | 43 | } |
44 | - register_shutdown_function(function () { |
|
44 | + register_shutdown_function(function() { |
|
45 | 45 | $this->closeAllFiles(); |
46 | 46 | }); |
47 | 47 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | |
56 | 56 | private function getElevationAtPosition($fileName, $row, $column) { |
57 | 57 | if (!array_key_exists($fileName, $this->openedFiles)) { |
58 | - if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) { |
|
58 | + if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) { |
|
59 | 59 | throw new \Exception("File '{$fileName}' not exists."); |
60 | 60 | } |
61 | - $file = fopen($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName, "r"); |
|
61 | + $file = fopen($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName, "r"); |
|
62 | 62 | if ($file === false) { |
63 | 63 | throw new \Exception("Cant open file '{$fileName}' for reading."); |
64 | 64 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | throw new \Exception("Not implemented yet"); |
73 | 73 | } |
74 | 74 | $aRow = $this->measPerDeg - $row; |
75 | - $position = ($this->measPerDeg * ($aRow - 1)) + $column; |
|
75 | + $position = ($this->measPerDeg*($aRow - 1)) + $column; |
|
76 | 76 | $position *= 2; |
77 | 77 | fseek($file, $position); |
78 | 78 | $short = fread($file, 2); |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | $latSec = $this->getSec($lat); |
101 | 101 | $lonSec = $this->getSec($lon); |
102 | 102 | |
103 | - $Xn = round($latSec / $this->resolution, 3); |
|
104 | - $Yn = round($lonSec / $this->resolution, 3); |
|
103 | + $Xn = round($latSec/$this->resolution, 3); |
|
104 | + $Yn = round($lonSec/$this->resolution, 3); |
|
105 | 105 | |
106 | 106 | $a1 = round($Xn); |
107 | 107 | $a2 = round($Yn); |
@@ -133,55 +133,55 @@ discard block |
||
133 | 133 | $b3 = $this->getElevationAtPosition($fName, $b1, $b2); |
134 | 134 | $c3 = $this->getElevationAtPosition($fName, $c1, $c2); |
135 | 135 | |
136 | - $n1 = ($c2 - $a2) * ($b3 - $a3) - ($c3 - $a3) * ($b2 - $a2); |
|
137 | - $n2 = ($c3 - $a3) * ($b1 - $a1) - ($c1 - $a1) * ($b3 - $a3); |
|
138 | - $n3 = ($c1 - $a1) * ($b2 - $a2) - ($c2 - $a2) * ($b1 - $a1); |
|
136 | + $n1 = ($c2 - $a2)*($b3 - $a3) - ($c3 - $a3)*($b2 - $a2); |
|
137 | + $n2 = ($c3 - $a3)*($b1 - $a1) - ($c1 - $a1)*($b3 - $a3); |
|
138 | + $n3 = ($c1 - $a1)*($b2 - $a2) - ($c2 - $a2)*($b1 - $a1); |
|
139 | 139 | |
140 | - $d = -$n1 * $a1 - $n2 * $a2 - $n3 * $a3; |
|
141 | - $zN = (-$n1 * $Xn - $n2 * $Yn - $d) / $n3; |
|
140 | + $d = -$n1*$a1 - $n2*$a2 - $n3*$a3; |
|
141 | + $zN = (-$n1*$Xn - $n2*$Yn - $d)/$n3; |
|
142 | 142 | |
143 | 143 | return $zN; |
144 | 144 | } |
145 | 145 | |
146 | 146 | private function getDeg($deg, $numPrefix) { |
147 | 147 | $deg = abs($deg); |
148 | - $d = floor($deg); // round degrees |
|
148 | + $d = floor($deg); // round degrees |
|
149 | 149 | if ($numPrefix >= 3) { |
150 | 150 | if ($d < 100) { |
151 | - $d = '0' . $d; |
|
151 | + $d = '0'.$d; |
|
152 | 152 | } |
153 | 153 | } // pad with leading zeros |
154 | 154 | if ($d < 10) { |
155 | - $d = '0' . $d; |
|
155 | + $d = '0'.$d; |
|
156 | 156 | } |
157 | 157 | return $d; |
158 | 158 | } |
159 | 159 | |
160 | 160 | private function getSec($deg) { |
161 | 161 | $deg = abs($deg); |
162 | - $sec = round($deg * 3600, 4); |
|
163 | - $m = fmod(floor($sec / 60), 60); |
|
162 | + $sec = round($deg*3600, 4); |
|
163 | + $m = fmod(floor($sec/60), 60); |
|
164 | 164 | $s = round(fmod($sec, 60), 4); |
165 | - return ($m * 60) + $s; |
|
165 | + return ($m*60) + $s; |
|
166 | 166 | } |
167 | 167 | |
168 | - public function download($lat,$lon, $debug = false) { |
|
168 | + public function download($lat, $lon, $debug = false) { |
|
169 | 169 | $N = $this->getDeg($lat, 2); |
170 | 170 | $E = $this->getDeg($lon, 3); |
171 | - $fileName = "N{$N}E{$E}.hgt"; |
|
172 | - if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) { |
|
171 | + $fileName = "N{$N}E{$E}.hgt"; |
|
172 | + if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) { |
|
173 | 173 | $Common = new Common(); |
174 | 174 | if ($debug) echo 'Downloading '.$fileName.'.gz ...'; |
175 | - $Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
|
176 | - if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) { |
|
175 | + $Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz'); |
|
176 | + if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz')) { |
|
177 | 177 | if ($debug) echo "File '{$fileName}.gz' not exists."; |
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | if ($debug) echo 'Done'."\n"; |
181 | 181 | if ($debug) echo 'Decompress '.$fileName.' ....'; |
182 | - $Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName); |
|
182 | + $Common->gunzip($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName); |
|
183 | 183 | if ($debug) echo 'Done'."\n"; |
184 | - unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
|
184 | + unlink($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz'); |
|
185 | 185 | } |
186 | 186 | return true; |
187 | 187 | } |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | try { |
195 | 195 | $sth = $db->prepare($query); |
196 | 196 | $sth->execute($query_values); |
197 | - } catch(PDOException $e) { |
|
197 | + } catch (PDOException $e) { |
|
198 | 198 | return "error : ".$e->getMessage(); |
199 | 199 | } |
200 | 200 | while ($data = $sth->fetch(PDO::FETCH_ASSOC)) { |
201 | - $this->download($data['latitude'],$data['longitude'],true); |
|
201 | + $this->download($data['latitude'], $data['longitude'], true); |
|
202 | 202 | } |
203 | 203 | $db = $Connection->db; |
204 | 204 | $query = 'SELECT latitude, longitude FROM tracker_output WHERE latitude <> 0 AND longitude <> 0 ORDER BY date DESC LIMIT 100'; |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | try { |
207 | 207 | $sth = $db->prepare($query); |
208 | 208 | $sth->execute($query_values); |
209 | - } catch(PDOException $e) { |
|
209 | + } catch (PDOException $e) { |
|
210 | 210 | return "error : ".$e->getMessage(); |
211 | 211 | } |
212 | 212 | while ($data = $sth->fetch(PDO::FETCH_ASSOC)) { |
213 | - $this->download($data['latitude'],$data['longitude'],true); |
|
213 | + $this->download($data['latitude'], $data['longitude'], true); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | } |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | * @param Array $headers header to submit with the form |
15 | 15 | * @return String the result |
16 | 16 | */ |
17 | - public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') { |
|
17 | + public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '') { |
|
18 | 18 | global $globalProxy, $globalForceIPv4; |
19 | 19 | $ch = curl_init(); |
20 | 20 | curl_setopt($ch, CURLOPT_URL, $url); |
21 | 21 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
22 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
22 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
23 | 23 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
24 | 24 | } |
25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
30 | 30 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
31 | 31 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
32 | - curl_setopt($ch,CURLOPT_ENCODING , "gzip"); |
|
32 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
33 | 33 | //curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
34 | 34 | // curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0'); |
35 | 35 | if ($useragent == '') { |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | } |
40 | 40 | if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
41 | 41 | else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
42 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
|
42 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback")); |
|
43 | 43 | if ($type == 'post') { |
44 | 44 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
45 | 45 | if (is_array($data)) { |
46 | 46 | curl_setopt($ch, CURLOPT_POST, count($data)); |
47 | 47 | $data_string = ''; |
48 | - foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
48 | + foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
49 | 49 | rtrim($data_string, '&'); |
50 | 50 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); |
51 | 51 | } else { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | if ($cookie != '') { |
59 | 59 | if (is_array($cookie)) { |
60 | - curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';')); |
|
60 | + curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';')); |
|
61 | 61 | } else { |
62 | 62 | curl_setopt($ch, CURLOPT_COOKIE, $cookie); |
63 | 63 | } |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | $info = curl_getinfo($ch); |
70 | 70 | //var_dump($info); |
71 | 71 | curl_close($ch); |
72 | - if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) { |
|
72 | + if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) { |
|
73 | 73 | echo "Cloudflare Detected\n"; |
74 | 74 | require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php'); |
75 | 75 | $useragent = UAgent::random(); |
76 | 76 | cloudflare::useUserAgent($useragent); |
77 | 77 | if ($clearanceCookie = cloudflare::bypass($url)) { |
78 | - return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
|
78 | + return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent); |
|
79 | 79 | } |
80 | 80 | } else { |
81 | 81 | return $result; |
@@ -106,20 +106,20 @@ discard block |
||
106 | 106 | fclose($fp); |
107 | 107 | } |
108 | 108 | |
109 | - public static function gunzip($in_file,$out_file_name = '') { |
|
109 | + public static function gunzip($in_file, $out_file_name = '') { |
|
110 | 110 | //echo $in_file.' -> '.$out_file_name."\n"; |
111 | 111 | $buffer_size = 4096; // read 4kb at a time |
112 | 112 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
113 | 113 | if ($in_file != '' && file_exists($in_file)) { |
114 | 114 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
115 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
116 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
115 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
116 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
117 | 117 | else { |
118 | 118 | echo 'gzopen not available'; |
119 | 119 | die; |
120 | 120 | } |
121 | 121 | $out_file = fopen($out_file_name, 'wb'); |
122 | - while(!gzeof($file)) { |
|
122 | + while (!gzeof($file)) { |
|
123 | 123 | fwrite($out_file, gzread($file, $buffer_size)); |
124 | 124 | } |
125 | 125 | fclose($out_file); |
@@ -127,19 +127,19 @@ discard block |
||
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | - public static function bunzip2($in_file,$out_file_name = '') { |
|
130 | + public static function bunzip2($in_file, $out_file_name = '') { |
|
131 | 131 | //echo $in_file.' -> '.$out_file_name."\n"; |
132 | 132 | $buffer_size = 4096; // read 4kb at a time |
133 | 133 | if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
134 | 134 | if ($in_file != '' && file_exists($in_file)) { |
135 | 135 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
136 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
136 | + if (function_exists('bzopen')) $file = bzopen($in_file, 'rb'); |
|
137 | 137 | else { |
138 | 138 | echo 'bzopen not available'; |
139 | 139 | die; |
140 | 140 | } |
141 | 141 | $out_file = fopen($out_file_name, 'wb'); |
142 | - while(!feof($file)) { |
|
142 | + while (!feof($file)) { |
|
143 | 143 | fwrite($out_file, bzread($file, $buffer_size)); |
144 | 144 | } |
145 | 145 | fclose($out_file); |
@@ -157,27 +157,27 @@ discard block |
||
157 | 157 | if ($data == '') return array(); |
158 | 158 | $html = str_get_html($data); |
159 | 159 | if ($html === false) return array(); |
160 | - $tabledata=array(); |
|
161 | - foreach($html->find('tr') as $element) |
|
160 | + $tabledata = array(); |
|
161 | + foreach ($html->find('tr') as $element) |
|
162 | 162 | { |
163 | 163 | $td = array(); |
164 | - foreach( $element->find('th') as $row) |
|
164 | + foreach ($element->find('th') as $row) |
|
165 | 165 | { |
166 | 166 | $td [] = trim($row->plaintext); |
167 | 167 | } |
168 | - $td=array_filter($td); |
|
168 | + $td = array_filter($td); |
|
169 | 169 | $tabledata[] = $td; |
170 | 170 | |
171 | 171 | $td = array(); |
172 | 172 | $tdi = array(); |
173 | - foreach( $element->find('td') as $row) |
|
173 | + foreach ($element->find('td') as $row) |
|
174 | 174 | { |
175 | 175 | $td [] = trim($row->plaintext); |
176 | 176 | $tdi [] = trim($row->innertext); |
177 | 177 | } |
178 | - $td=array_filter($td); |
|
179 | - $tdi=array_filter($tdi); |
|
180 | - $tabledata[]=array_merge($td,$tdi); |
|
178 | + $td = array_filter($td); |
|
179 | + $tdi = array_filter($tdi); |
|
180 | + $tabledata[] = array_merge($td, $tdi); |
|
181 | 181 | } |
182 | 182 | $html->clear(); |
183 | 183 | unset($html); |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | public function text2array($data) { |
193 | 193 | $html = str_get_html($data); |
194 | 194 | if ($html === false) return array(); |
195 | - $tabledata=array(); |
|
196 | - foreach($html->find('p') as $element) |
|
195 | + $tabledata = array(); |
|
196 | + foreach ($html->find('p') as $element) |
|
197 | 197 | { |
198 | 198 | $tabledata [] = trim($element->plaintext); |
199 | 199 | } |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
215 | 215 | if ($lat == $latc && $lon == $lonc) return 0; |
216 | - $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
|
216 | + $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc))) + cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon) - floatval($lonc)))))*60*1.1515; |
|
217 | 217 | if ($unit == "km") { |
218 | - return round($dist * 1.609344); |
|
218 | + return round($dist*1.609344); |
|
219 | 219 | } elseif ($unit == "m") { |
220 | - return round($dist * 1.609344 * 1000); |
|
220 | + return round($dist*1.609344*1000); |
|
221 | 221 | } elseif ($unit == "mile" || $unit == "mi") { |
222 | 222 | return round($dist); |
223 | 223 | } elseif ($unit == "nm") { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @param float $distance distance covered |
234 | 234 | * @return whether distance is realistic |
235 | 235 | */ |
236 | - public function withinThreshold ($timeDifference, $distance) { |
|
236 | + public function withinThreshold($timeDifference, $distance) { |
|
237 | 237 | $x = abs($timeDifference); |
238 | 238 | $d = abs($distance); |
239 | 239 | if ($x == 0 || $d == 0) return true; |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | return ($array !== array_values($array)); |
250 | 250 | } |
251 | 251 | |
252 | - public function isInteger($input){ |
|
252 | + public function isInteger($input) { |
|
253 | 253 | return(ctype_digit(strval($input))); |
254 | 254 | } |
255 | 255 | |
256 | 256 | |
257 | - public function convertDec($dms,$latlong) { |
|
257 | + public function convertDec($dms, $latlong) { |
|
258 | 258 | if ($latlong == 'latitude') { |
259 | 259 | $deg = substr($dms, 0, 2); |
260 | 260 | $min = substr($dms, 2, 4); |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | $deg = substr($dms, 0, 3); |
263 | 263 | $min = substr($dms, 3, 5); |
264 | 264 | } |
265 | - return $deg+(($min*60)/3600); |
|
265 | + return $deg + (($min*60)/3600); |
|
266 | 266 | } |
267 | 267 | |
268 | - public function convertDM($coord,$latlong) { |
|
268 | + public function convertDM($coord, $latlong) { |
|
269 | 269 | if ($latlong == 'latitude') { |
270 | 270 | if ($coord < 0) $NSEW = 'S'; |
271 | 271 | else $NSEW = 'N'; |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | } |
276 | 276 | $coord = abs($coord); |
277 | 277 | $deg = floor($coord); |
278 | - $coord = ($coord-$deg)*60; |
|
278 | + $coord = ($coord - $deg)*60; |
|
279 | 279 | $min = $coord; |
280 | - return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW); |
|
280 | + return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -289,8 +289,8 @@ discard block |
||
289 | 289 | public function xcopy($source, $dest) |
290 | 290 | { |
291 | 291 | $files = glob($source.'*.*'); |
292 | - foreach($files as $file){ |
|
293 | - $file_to_go = str_replace($source,$dest,$file); |
|
292 | + foreach ($files as $file) { |
|
293 | + $file_to_go = str_replace($source, $dest, $file); |
|
294 | 294 | copy($file, $file_to_go); |
295 | 295 | } |
296 | 296 | return true; |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | * @param String $url url to check |
302 | 302 | * @return bool Return true on succes false on failure |
303 | 303 | */ |
304 | - public function urlexist($url){ |
|
305 | - $headers=get_headers($url); |
|
306 | - return stripos($headers[0],"200 OK")?true:false; |
|
304 | + public function urlexist($url) { |
|
305 | + $headers = get_headers($url); |
|
306 | + return stripos($headers[0], "200 OK") ? true : false; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | public function hex2str($hex) { |
315 | 315 | $str = ''; |
316 | 316 | $hexln = strlen($hex); |
317 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
317 | + for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2))); |
|
318 | 318 | return $str; |
319 | 319 | } |
320 | 320 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @return String Return result |
325 | 325 | */ |
326 | 326 | public function hex2rgb($hex) { |
327 | - $hex = str_replace('#','',$hex); |
|
327 | + $hex = str_replace('#', '', $hex); |
|
328 | 328 | return sscanf($hex, "%02x%02x%02x"); |
329 | 329 | } |
330 | 330 | |
@@ -332,33 +332,33 @@ discard block |
||
332 | 332 | //difference in longitudinal coordinates |
333 | 333 | $dLon = deg2rad($lon2) - deg2rad($lon1); |
334 | 334 | //difference in the phi of latitudinal coordinates |
335 | - $dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4)); |
|
335 | + $dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4)); |
|
336 | 336 | //we need to recalculate $dLon if it is greater than pi |
337 | - if(abs($dLon) > pi()) { |
|
338 | - if($dLon > 0) { |
|
339 | - $dLon = (2 * pi() - $dLon) * -1; |
|
337 | + if (abs($dLon) > pi()) { |
|
338 | + if ($dLon > 0) { |
|
339 | + $dLon = (2*pi() - $dLon)*-1; |
|
340 | 340 | } else { |
341 | - $dLon = 2 * pi() + $dLon; |
|
341 | + $dLon = 2*pi() + $dLon; |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | //return the angle, normalized |
345 | - return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360; |
|
345 | + return (rad2deg(atan2($dLon, $dPhi)) + 360)%360; |
|
346 | 346 | } |
347 | 347 | |
348 | - public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.2) { |
|
348 | + public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.2) { |
|
349 | 349 | //$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1); |
350 | - $a = -($lon2-$lon1); |
|
350 | + $a = -($lon2 - $lon1); |
|
351 | 351 | $b = $lat2 - $lat1; |
352 | - $c = -($a*$lat1+$b*$lon1); |
|
353 | - $d = $a*$lat3+$b*$lon3+$c; |
|
352 | + $c = -($a*$lat1 + $b*$lon1); |
|
353 | + $d = $a*$lat3 + $b*$lon3 + $c; |
|
354 | 354 | if ($d > -$approx && $d < $approx) return true; |
355 | 355 | else return false; |
356 | 356 | } |
357 | 357 | |
358 | 358 | public function array_merge_noappend() { |
359 | 359 | $output = array(); |
360 | - foreach(func_get_args() as $array) { |
|
361 | - foreach($array as $key => $value) { |
|
360 | + foreach (func_get_args() as $array) { |
|
361 | + foreach ($array as $key => $value) { |
|
362 | 362 | $output[$key] = isset($output[$key]) ? |
363 | 363 | array_merge($output[$key], $value) : $value; |
364 | 364 | } |
@@ -422,34 +422,34 @@ discard block |
||
422 | 422 | return $result; |
423 | 423 | } |
424 | 424 | |
425 | - public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1){ |
|
425 | + public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1) { |
|
426 | 426 | global $globalMapRefresh; |
427 | 427 | $distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000; |
428 | 428 | $r = 6378; |
429 | 429 | $latitude = deg2rad($latitude); |
430 | 430 | $longitude = deg2rad($longitude); |
431 | 431 | $bearing = deg2rad($heading); |
432 | - $latitude2 = asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) ); |
|
433 | - $longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) ); |
|
434 | - return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.','')); |
|
432 | + $latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing))); |
|
433 | + $longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2))); |
|
434 | + return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', '')); |
|
435 | 435 | } |
436 | 436 | |
437 | - public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) { |
|
437 | + public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) { |
|
438 | 438 | // distance in meter |
439 | 439 | $R = 6378.14; |
440 | - $latitude1 = $latitude * (M_PI/180); |
|
441 | - $longitude1 = $longitude * (M_PI/180); |
|
442 | - $brng = $bearing * (M_PI/180); |
|
440 | + $latitude1 = $latitude*(M_PI/180); |
|
441 | + $longitude1 = $longitude*(M_PI/180); |
|
442 | + $brng = $bearing*(M_PI/180); |
|
443 | 443 | $d = $distance; |
444 | 444 | |
445 | 445 | $latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng)); |
446 | - $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2)); |
|
446 | + $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2)); |
|
447 | 447 | |
448 | - $latitude2 = $latitude2 * (180/M_PI); |
|
449 | - $longitude2 = $longitude2 * (180/M_PI); |
|
448 | + $latitude2 = $latitude2*(180/M_PI); |
|
449 | + $longitude2 = $longitude2*(180/M_PI); |
|
450 | 450 | |
451 | - $flat = round ($latitude2,6); |
|
452 | - $flong = round ($longitude2,6); |
|
451 | + $flat = round($latitude2, 6); |
|
452 | + $flong = round($longitude2, 6); |
|
453 | 453 | /* |
454 | 454 | $dx = $distance*cos($bearing); |
455 | 455 | $dy = $distance*sin($bearing); |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $flong = $longitude + $dlong; |
459 | 459 | $flat = $latitude + $dlat; |
460 | 460 | */ |
461 | - return array('latitude' => $flat,'longitude' => $flong); |
|
461 | + return array('latitude' => $flat, 'longitude' => $flong); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
@@ -472,14 +472,14 @@ discard block |
||
472 | 472 | * @param integer $level GZIP compression level (default: 9) |
473 | 473 | * @return string New filename (with .gz appended) if success, or false if operation fails |
474 | 474 | */ |
475 | - public function gzCompressFile($source, $level = 9){ |
|
476 | - $dest = $source . '.gz'; |
|
477 | - $mode = 'wb' . $level; |
|
475 | + public function gzCompressFile($source, $level = 9) { |
|
476 | + $dest = $source.'.gz'; |
|
477 | + $mode = 'wb'.$level; |
|
478 | 478 | $error = false; |
479 | 479 | if ($fp_out = gzopen($dest, $mode)) { |
480 | - if ($fp_in = fopen($source,'rb')) { |
|
480 | + if ($fp_in = fopen($source, 'rb')) { |
|
481 | 481 | while (!feof($fp_in)) |
482 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
482 | + gzwrite($fp_out, fread($fp_in, 1024*512)); |
|
483 | 483 | fclose($fp_in); |
484 | 484 | } else { |
485 | 485 | $error = true; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | } |
496 | 496 | |
497 | 497 | public function remove_accents($string) { |
498 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
498 | + if (!preg_match('/[\x80-\xff]/', $string)) return $string; |
|
499 | 499 | $chars = array( |
500 | 500 | // Decompositions for Latin-1 Supplement |
501 | 501 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
553 | 553 | chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
554 | 554 | chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
555 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
555 | + chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij', |
|
556 | 556 | chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
557 | 557 | chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
558 | 558 | chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
@@ -568,13 +568,13 @@ discard block |
||
568 | 568 | chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
569 | 569 | chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
570 | 570 | chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
571 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
572 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
573 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
574 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
575 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
576 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
577 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
571 | + chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', |
|
572 | + chr(197).chr(148) => 'R', chr(197).chr(149) => 'r', |
|
573 | + chr(197).chr(150) => 'R', chr(197).chr(151) => 'r', |
|
574 | + chr(197).chr(152) => 'R', chr(197).chr(153) => 'r', |
|
575 | + chr(197).chr(154) => 'S', chr(197).chr(155) => 's', |
|
576 | + chr(197).chr(156) => 'S', chr(197).chr(157) => 's', |
|
577 | + chr(197).chr(158) => 'S', chr(197).chr(159) => 's', |
|
578 | 578 | chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
579 | 579 | chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
580 | 580 | chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) { |
609 | 609 | if (is_numeric($string[$i]) && $concat_flag) { |
610 | 610 | $int .= $string[$i]; |
611 | - } elseif(!$concat && $concat_flag && strlen($int) > 0) { |
|
611 | + } elseif (!$concat && $concat_flag && strlen($int) > 0) { |
|
612 | 612 | $concat_flag = false; |
613 | 613 | } |
614 | 614 | } |
@@ -46,20 +46,20 @@ discard block |
||
46 | 46 | die; |
47 | 47 | } |
48 | 48 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
49 | - $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
|
49 | + $globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | -$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver')); |
|
53 | +$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::', 'aprsserverhost::', 'aprsserverport::', 'format::', 'noaprsserver')); |
|
54 | 54 | //if (isset($options['s'])) $hosts = array($options['s']); |
55 | 55 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
56 | 56 | if (isset($options['s'])) { |
57 | 57 | $globalSources = array(); |
58 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
58 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['s'], 'format' => $options['format']); |
|
59 | 59 | else $globalSources[] = array('host' => $options['s']); |
60 | 60 | } elseif (isset($options['source'])) { |
61 | 61 | $globalSources = array(); |
62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
62 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['source'], 'format' => $options['format']); |
|
63 | 63 | else $globalSources[] = array('host' => $options['source']); |
64 | 64 | } |
65 | 65 | if (isset($options['aprsserverhost'])) { |
@@ -76,28 +76,28 @@ discard block |
||
76 | 76 | else $id_source = 1; |
77 | 77 | if (isset($globalServer) && $globalServer) { |
78 | 78 | if ($globalDebug) echo "Using Server Mode\n"; |
79 | - $SI=new SpotterServer(); |
|
79 | + $SI = new SpotterServer(); |
|
80 | 80 | /* |
81 | 81 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
82 | 82 | $SI = new adsb2aprs(); |
83 | 83 | $SI->connect(); |
84 | 84 | */ |
85 | -} else $SI=new SpotterImport($Connection->db); |
|
85 | +} else $SI = new SpotterImport($Connection->db); |
|
86 | 86 | if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
87 | 87 | if (isset($globalMarine) && $globalMarine) { |
88 | 88 | $AIS = new AIS(); |
89 | 89 | $MI = new MarineImport($Connection->db); |
90 | 90 | } |
91 | 91 | //$APRS=new APRS($Connection->db); |
92 | -$SBS=new SBS(); |
|
93 | -$ACARS=new ACARS($Connection->db); |
|
94 | -$Source=new Source($Connection->db); |
|
95 | -$Common=new Common(); |
|
92 | +$SBS = new SBS(); |
|
93 | +$ACARS = new ACARS($Connection->db); |
|
94 | +$Source = new Source($Connection->db); |
|
95 | +$Common = new Common(); |
|
96 | 96 | date_default_timezone_set('UTC'); |
97 | 97 | //$servertz = system('date +%Z'); |
98 | 98 | // signal handler - playing nice with sockets and dump1090 |
99 | 99 | if (function_exists('pcntl_fork')) { |
100 | - pcntl_signal(SIGINT, function() { |
|
100 | + pcntl_signal(SIGINT, function() { |
|
101 | 101 | global $sockets; |
102 | 102 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
103 | 103 | die("Bye!\n"); |
@@ -113,30 +113,30 @@ discard block |
||
113 | 113 | |
114 | 114 | function connect_all($hosts) { |
115 | 115 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
116 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
116 | + global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context; |
|
117 | 117 | $reset++; |
118 | 118 | if ($globalDebug) echo 'Connect to all...'."\n"; |
119 | 119 | foreach ($hosts as $id => $value) { |
120 | 120 | $host = $value['host']; |
121 | 121 | $globalSources[$id]['last_exec'] = 0; |
122 | 122 | // Here we check type of source(s) |
123 | - if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
124 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
123 | + if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
124 | + if (preg_match('/deltadb.txt$/i', $host)) { |
|
125 | 125 | //$formats[$id] = 'deltadbtxt'; |
126 | 126 | $globalSources[$id]['format'] = 'deltadbtxt'; |
127 | 127 | //$last_exec['deltadbtxt'] = 0; |
128 | 128 | if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
129 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
129 | + } else if (preg_match('/vatsim-data.txt$/i', $host)) { |
|
130 | 130 | //$formats[$id] = 'vatsimtxt'; |
131 | 131 | $globalSources[$id]['format'] = 'vatsimtxt'; |
132 | 132 | //$last_exec['vatsimtxt'] = 0; |
133 | 133 | if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
134 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
134 | + } else if (preg_match('/aircraftlist.json$/i', $host)) { |
|
135 | 135 | //$formats[$id] = 'aircraftlistjson'; |
136 | 136 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
137 | 137 | //$last_exec['aircraftlistjson'] = 0; |
138 | 138 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
139 | - } else if (preg_match('/opensky/i',$host)) { |
|
139 | + } else if (preg_match('/opensky/i', $host)) { |
|
140 | 140 | //$formats[$id] = 'aircraftlistjson'; |
141 | 141 | $globalSources[$id]['format'] = 'opensky'; |
142 | 142 | //$last_exec['aircraftlistjson'] = 0; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | exit(0); |
154 | 154 | } |
155 | 155 | */ |
156 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
156 | + } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { |
|
157 | 157 | //$formats[$id] = 'planeupdatefaa'; |
158 | 158 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
159 | 159 | //$last_exec['planeupdatefaa'] = 0; |
@@ -162,29 +162,29 @@ discard block |
||
162 | 162 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
163 | 163 | exit(0); |
164 | 164 | } |
165 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
165 | + } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { |
|
166 | 166 | //$formats[$id] = 'phpvmacars'; |
167 | 167 | $globalSources[$id]['format'] = 'phpvmacars'; |
168 | 168 | //$last_exec['phpvmacars'] = 0; |
169 | 169 | if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
170 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
170 | + } else if (preg_match('/VAM-json.php$/i', $host)) { |
|
171 | 171 | //$formats[$id] = 'phpvmacars'; |
172 | 172 | $globalSources[$id]['format'] = 'vam'; |
173 | 173 | if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
174 | - } else if (preg_match('/whazzup/i',$host)) { |
|
174 | + } else if (preg_match('/whazzup/i', $host)) { |
|
175 | 175 | //$formats[$id] = 'whazzup'; |
176 | 176 | $globalSources[$id]['format'] = 'whazzup'; |
177 | 177 | //$last_exec['whazzup'] = 0; |
178 | 178 | if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
179 | - } else if (preg_match('/airwhere/i',$host)) { |
|
179 | + } else if (preg_match('/airwhere/i', $host)) { |
|
180 | 180 | $globalSources[$id]['format'] = 'airwhere'; |
181 | 181 | if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
182 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
182 | + } else if (preg_match('/recentpireps/i', $host)) { |
|
183 | 183 | //$formats[$id] = 'pirepsjson'; |
184 | 184 | $globalSources[$id]['format'] = 'pirepsjson'; |
185 | 185 | //$last_exec['pirepsjson'] = 0; |
186 | 186 | if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
187 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
187 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { |
|
188 | 188 | //$formats[$id] = 'fr24json'; |
189 | 189 | $globalSources[$id]['format'] = 'fr24json'; |
190 | 190 | //$last_exec['fr24json'] = 0; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
194 | 194 | exit(0); |
195 | 195 | } |
196 | - } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
196 | + } else if (preg_match(':myshiptracking.com/:i', $host)) { |
|
197 | 197 | //$formats[$id] = 'fr24json'; |
198 | 198 | $globalSources[$id]['format'] = 'myshiptracking'; |
199 | 199 | //$last_exec['fr24json'] = 0; |
@@ -203,22 +203,22 @@ discard block |
||
203 | 203 | exit(0); |
204 | 204 | } |
205 | 205 | //} else if (preg_match('/10001/',$host)) { |
206 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
206 | + } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
207 | 207 | //$formats[$id] = 'tsv'; |
208 | 208 | $globalSources[$id]['format'] = 'tsv'; |
209 | 209 | if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
210 | 210 | } |
211 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
211 | + } elseif (filter_var($host, FILTER_VALIDATE_URL)) { |
|
212 | 212 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
213 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
213 | + $idf = fopen($globalSources[$id]['host'], 'r', false, $context); |
|
214 | 214 | if ($idf !== false) { |
215 | 215 | $httpfeeds[$id] = $idf; |
216 | 216 | if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
217 | 217 | } |
218 | 218 | elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
219 | 219 | } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
220 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
221 | - $hostport = explode(':',$host); |
|
220 | + } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { |
|
221 | + $hostport = explode(':', $host); |
|
222 | 222 | if (isset($hostport[1])) { |
223 | 223 | $port = $hostport[1]; |
224 | 224 | $hostn = $hostport[0]; |
@@ -228,19 +228,19 @@ discard block |
||
228 | 228 | } |
229 | 229 | $Common = new Common(); |
230 | 230 | if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
231 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
231 | + $s = $Common->create_socket($hostn, $port, $errno, $errstr); |
|
232 | 232 | } else { |
233 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
233 | + $s = $Common->create_socket_udp($hostn, $port, $errno, $errstr); |
|
234 | 234 | } |
235 | 235 | if ($s) { |
236 | 236 | $sockets[$id] = $s; |
237 | 237 | if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
238 | - if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
238 | + if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') { |
|
239 | 239 | //$formats[$id] = 'aprs'; |
240 | 240 | $globalSources[$id]['format'] = 'aprs'; |
241 | 241 | //$aprs_connect = 0; |
242 | 242 | //$use_aprs = true; |
243 | - } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
243 | + } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
244 | 244 | $globalSources[$id]['format'] = 'vrstcp'; |
245 | 245 | } elseif ($port == '10001') { |
246 | 246 | //$formats[$id] = 'tsv'; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
280 | 280 | else $timeout = 20; |
281 | 281 | $errno = ''; |
282 | -$errstr=''; |
|
282 | +$errstr = ''; |
|
283 | 283 | |
284 | 284 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
285 | 285 | /* Initiate connections to all the hosts simultaneously */ |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | //connect_all($globalSources); |
288 | 288 | |
289 | 289 | if (isset($globalProxy) && $globalProxy) { |
290 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
290 | + $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true))); |
|
291 | 291 | } else { |
292 | 292 | $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
293 | 293 | } |
@@ -314,16 +314,16 @@ discard block |
||
314 | 314 | |
315 | 315 | if ($use_aprs) { |
316 | 316 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
317 | - $APRS=new APRS(); |
|
317 | + $APRS = new APRS(); |
|
318 | 318 | $aprs_connect = 0; |
319 | 319 | $aprs_keep = 120; |
320 | 320 | $aprs_last_tx = time(); |
321 | 321 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
322 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
322 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
323 | 323 | if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
324 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
324 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
325 | 325 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
326 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
326 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
327 | 327 | if ($aprs_full) $aprs_filter = ''; |
328 | 328 | if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
329 | 329 | else $aprs_pass = '-1'; |
@@ -337,12 +337,12 @@ discard block |
||
337 | 337 | sleep(1); |
338 | 338 | if ($globalDebug) echo "SCAN MODE \n\n"; |
339 | 339 | if (!isset($globalCronEnd)) $globalCronEnd = 60; |
340 | -$endtime = time()+$globalCronEnd; |
|
340 | +$endtime = time() + $globalCronEnd; |
|
341 | 341 | $i = 1; |
342 | 342 | $tt = array(); |
343 | 343 | // Delete all ATC |
344 | 344 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
345 | - $ATC=new ATC($Connection->db); |
|
345 | + $ATC = new ATC($Connection->db); |
|
346 | 346 | } |
347 | 347 | if (!$globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
348 | 348 | $ATC->deleteAll(); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
352 | 352 | while ($i > 0) { |
353 | - if (!$globalDaemon) $i = $endtime-time(); |
|
353 | + if (!$globalDaemon) $i = $endtime - time(); |
|
354 | 354 | // Delete old ATC |
355 | 355 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
356 | 356 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | } |
365 | 365 | if ($max != $globalMinFetch) { |
366 | 366 | if ($globalDebug) echo 'Sleeping...'."\n"; |
367 | - sleep($globalMinFetch-$max+2); |
|
367 | + sleep($globalMinFetch - $max + 2); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | //$buffer = $Common->getData($hosts[$id]); |
378 | 378 | $buffer = $Common->getData($value['host']); |
379 | 379 | if ($buffer != '') $reset = 0; |
380 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
381 | - $buffer = explode('\n',$buffer); |
|
380 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
381 | + $buffer = explode('\n', $buffer); |
|
382 | 382 | foreach ($buffer as $line) { |
383 | 383 | if ($line != '' && count($line) > 7) { |
384 | 384 | $line = explode(',', $line); |
@@ -406,11 +406,11 @@ discard block |
||
406 | 406 | $last_exec[$id]['last'] = time(); |
407 | 407 | } elseif ($value['format'] == 'aisnmeatxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
408 | 408 | date_default_timezone_set('CET'); |
409 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
409 | + $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host'])); |
|
410 | 410 | date_default_timezone_set('UTC'); |
411 | 411 | if ($buffer != '') $reset = 0; |
412 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
413 | - $buffer = explode('\n',$buffer); |
|
412 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
413 | + $buffer = explode('\n', $buffer); |
|
414 | 414 | foreach ($buffer as $line) { |
415 | 415 | if ($line != '') { |
416 | 416 | //echo "'".$line."'\n"; |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
429 | 429 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
430 | 430 | if (isset($ais_data['timestamp'])) { |
431 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
431 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
432 | 432 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
433 | 433 | $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
434 | 434 | $add = true; |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | $w = $e = null; |
452 | 452 | |
453 | 453 | if (isset($arr[$id])) { |
454 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
454 | + $nn = stream_select($arr, $w, $e, $timeout); |
|
455 | 455 | if ($nn > 0) { |
456 | 456 | foreach ($httpfeeds as $feed) { |
457 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
458 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
459 | - $buffer = explode('\n',$buffer); |
|
457 | + $buffer = stream_get_line($feed, 2000, "\n"); |
|
458 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
459 | + $buffer = explode('\n', $buffer); |
|
460 | 460 | foreach ($buffer as $line) { |
461 | 461 | if ($line != '') { |
462 | 462 | $ais_data = $AIS->parse_line(trim($line)); |
@@ -474,9 +474,9 @@ discard block |
||
474 | 474 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
475 | 475 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
476 | 476 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
477 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
477 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
478 | 478 | if (isset($ais_data['timestamp'])) { |
479 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
479 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
480 | 480 | } else { |
481 | 481 | $data['datetime'] = date('Y-m-d H:i:s'); |
482 | 482 | } |
@@ -502,10 +502,10 @@ discard block |
||
502 | 502 | } |
503 | 503 | } |
504 | 504 | } elseif ($value['format'] == 'myshiptracking' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
505 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
505 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
506 | 506 | if ($buffer != '') { |
507 | 507 | //echo $buffer; |
508 | - $all_data = json_decode($buffer,true); |
|
508 | + $all_data = json_decode($buffer, true); |
|
509 | 509 | //print_r($all_data); |
510 | 510 | if (isset($all_data[0]['DATA'])) { |
511 | 511 | foreach ($all_data[0]['DATA'] as $line) { |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
521 | 521 | $data['imo'] = $line['IMO']; |
522 | 522 | //$data['arrival_code'] = $ais_data['destination']; |
523 | - $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
523 | + $data['datetime'] = date('Y-m-d H:i:s', $line['T']); |
|
524 | 524 | $data['format_source'] = 'myshiptracking'; |
525 | 525 | $data['id_source'] = $id_source; |
526 | 526 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -532,9 +532,9 @@ discard block |
||
532 | 532 | } |
533 | 533 | $last_exec[$id]['last'] = time(); |
534 | 534 | } elseif ($value['format'] == 'boatbeaconapp' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
535 | - $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
535 | + $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host'])); |
|
536 | 536 | if ($buffer != '') { |
537 | - $all_data = json_decode($buffer,true); |
|
537 | + $all_data = json_decode($buffer, true); |
|
538 | 538 | if (isset($all_data[0]['mmsi'])) { |
539 | 539 | foreach ($all_data as $line) { |
540 | 540 | if ($line != '') { |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | } elseif ($value['format'] == 'boatnerd' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
564 | 564 | $buffer = $Common->getData($value['host']); |
565 | 565 | if ($buffer != '') { |
566 | - $all_data = json_decode($buffer,true); |
|
566 | + $all_data = json_decode($buffer, true); |
|
567 | 567 | if (isset($all_data['features'][0]['id'])) { |
568 | 568 | foreach ($all_data['features'] as $line) { |
569 | 569 | $data = array(); |
@@ -591,27 +591,27 @@ discard block |
||
591 | 591 | $last_exec[$id]['last'] = time(); |
592 | 592 | } elseif ($value['format'] == 'shipplotter' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
593 | 593 | echo 'download...'; |
594 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
594 | + $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter'); |
|
595 | 595 | echo 'done !'."\n"; |
596 | 596 | if ($buffer != '') $reset = 0; |
597 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
598 | - $buffer = explode('\n',$buffer); |
|
597 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
598 | + $buffer = explode('\n', $buffer); |
|
599 | 599 | foreach ($buffer as $line) { |
600 | 600 | if ($line != '') { |
601 | 601 | $data = array(); |
602 | - $data['mmsi'] = (int)substr($line,0,9); |
|
603 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
602 | + $data['mmsi'] = (int) substr($line, 0, 9); |
|
603 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10)); |
|
604 | 604 | //$data['status'] = substr($line,21,2); |
605 | 605 | //$data['type'] = substr($line,24,3); |
606 | - $data['latitude'] = substr($line,29,9); |
|
607 | - $data['longitude'] = substr($line,41,9); |
|
608 | - $data['speed'] = round(substr($line,51,5)); |
|
606 | + $data['latitude'] = substr($line, 29, 9); |
|
607 | + $data['longitude'] = substr($line, 41, 9); |
|
608 | + $data['speed'] = round(substr($line, 51, 5)); |
|
609 | 609 | //$data['course'] = substr($line,57,5); |
610 | - $data['heading'] = round(substr($line,63,3)); |
|
610 | + $data['heading'] = round(substr($line, 63, 3)); |
|
611 | 611 | //$data['draft'] = substr($line,67,4); |
612 | 612 | //$data['length'] = substr($line,72,3); |
613 | 613 | //$data['beam'] = substr($line,76,2); |
614 | - $data['ident'] = trim(utf8_encode(substr($line,79,20))); |
|
614 | + $data['ident'] = trim(utf8_encode(substr($line, 79, 20))); |
|
615 | 615 | //$data['callsign'] = trim(substr($line,100,7); |
616 | 616 | //$data['dest'] = substr($line,108,20); |
617 | 617 | //$data['etaDate'] = substr($line,129,5); |
@@ -630,8 +630,8 @@ discard block |
||
630 | 630 | } elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch))) { |
631 | 631 | //$buffer = $Common->getData($hosts[$id]); |
632 | 632 | $buffer = $Common->getData($value['host']); |
633 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
634 | - $buffer = explode('\n',$buffer); |
|
633 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
634 | + $buffer = explode('\n', $buffer); |
|
635 | 635 | $reset = 0; |
636 | 636 | foreach ($buffer as $line) { |
637 | 637 | if ($line != '') { |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
643 | 643 | $data['pilot_id'] = $line[1]; |
644 | 644 | $data['pilot_name'] = $line[2]; |
645 | - $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
|
645 | + $data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT); |
|
646 | 646 | $data['ident'] = $line[0]; // ident |
647 | 647 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
648 | 648 | $data['speed'] = $line[8]; // speed |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
659 | 659 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
660 | 660 | $data['departure_airport_icao'] = $line[11]; |
661 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
661 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); |
|
662 | 662 | $data['arrival_airport_icao'] = $line[13]; |
663 | 663 | $data['frequency'] = $line[4]; |
664 | 664 | $data['type'] = $line[18]; |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | $data['id_source'] = $id_source; |
668 | 668 | //$data['arrival_airport_time'] = ; |
669 | 669 | if ($line[9] != '') { |
670 | - $aircraft_data = explode('/',$line[9]); |
|
670 | + $aircraft_data = explode('/', $line[9]); |
|
671 | 671 | if (isset($aircraft_data[1])) { |
672 | 672 | $data['aircraft_icao'] = $aircraft_data[1]; |
673 | 673 | } |
@@ -682,9 +682,9 @@ discard block |
||
682 | 682 | if ($line[3] == 'PILOT') $SI->add($data); |
683 | 683 | elseif ($line[3] == 'ATC') { |
684 | 684 | //print_r($data); |
685 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
686 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
687 | - $typec = substr($data['ident'],-3); |
|
685 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
686 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
687 | + $typec = substr($data['ident'], -3); |
|
688 | 688 | if ($typec == 'APP') $data['type'] = 'Approach'; |
689 | 689 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
690 | 690 | elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
@@ -696,8 +696,8 @@ discard block |
||
696 | 696 | elseif ($data['type'] == '') $data['type'] = 'Observer'; |
697 | 697 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
698 | 698 | if (isset($ATC)) { |
699 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
700 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
699 | + if (count($ATC->getByIdent($data['ident'], $data['format_source'])) > 0) echo $ATC->update($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
700 | + else echo $ATC->add($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
701 | 701 | } |
702 | 702 | } |
703 | 703 | unset($data); |
@@ -708,24 +708,24 @@ discard block |
||
708 | 708 | //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
709 | 709 | $last_exec[$id]['last'] = time(); |
710 | 710 | } elseif ($value['format'] == 'airwhere' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
711 | - $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
711 | + $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php', 'get', '', '', '', '', '20'); |
|
712 | 712 | if ($buffer != '') { |
713 | 713 | $all_data = simplexml_load_string($buffer); |
714 | - foreach($all_data->children() as $childdata) { |
|
714 | + foreach ($all_data->children() as $childdata) { |
|
715 | 715 | $data = array(); |
716 | 716 | $line = $childdata; |
717 | 717 | //$data['hex'] = str_pad(dechex((int)$line['pktPilotID']),6,'000000',STR_PAD_LEFT); |
718 | - $data['id'] = date('Ymd').(int)$line['pktPilotID']; |
|
719 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
|
720 | - $data['latitude'] = (float)$line['pktLatitude']; |
|
721 | - $data['longitude'] = (float)$line['pktLongitude']; |
|
722 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
723 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
724 | - $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
|
718 | + $data['id'] = date('Ymd').(int) $line['pktPilotID']; |
|
719 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['entryTime'].' BST')); |
|
720 | + $data['latitude'] = (float) $line['pktLatitude']; |
|
721 | + $data['longitude'] = (float) $line['pktLongitude']; |
|
722 | + if ((float) $line['pktTrack'] != 0) $data['heading'] = (float) $line['pktTrack']; |
|
723 | + if ((int) $line['pktSpeed'] != 0) $data['speed'] = (int) $line['pktSpeed']; |
|
724 | + $data['altitude'] = round((int) $line['pktAltitude']*3.28084); |
|
725 | 725 | $data['altitude_relative'] = 'AMSL'; |
726 | - $data['pilot_id'] = (int)$line['pktPilotID']; |
|
726 | + $data['pilot_id'] = (int) $line['pktPilotID']; |
|
727 | 727 | $data['aircraft_icao'] = 'PARAGLIDER'; |
728 | - $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
728 | + $pilot_data = explode(',', $Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
729 | 729 | if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
730 | 730 | $data['format_source'] = $value['format']; |
731 | 731 | $SI->add($data); |
@@ -733,31 +733,31 @@ discard block |
||
733 | 733 | } |
734 | 734 | } |
735 | 735 | $Source->deleteOldLocationByType('gs'); |
736 | - $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
736 | + $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php', 'get', '', '', '', '', '20'); |
|
737 | 737 | if ($buffer != '') { |
738 | 738 | $all_data = simplexml_load_string($buffer); |
739 | - foreach($all_data->children() as $childdata) { |
|
739 | + foreach ($all_data->children() as $childdata) { |
|
740 | 740 | $data = array(); |
741 | 741 | $line = $childdata; |
742 | - $data['id'] = (int)$line['gsID']; |
|
743 | - $data['latitude'] = (float)$line['gsLatitude']; |
|
744 | - $data['longitude'] = (float)$line['gsLongitude']; |
|
745 | - $data['altitude'] = round((int)$line['gsHeight']*3.28084); |
|
742 | + $data['id'] = (int) $line['gsID']; |
|
743 | + $data['latitude'] = (float) $line['gsLatitude']; |
|
744 | + $data['longitude'] = (float) $line['gsLongitude']; |
|
745 | + $data['altitude'] = round((int) $line['gsHeight']*3.28084); |
|
746 | 746 | $data['altitude_relative'] = 'AMSL'; |
747 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['gsLastUpdate'].' BST')); |
|
747 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['gsLastUpdate'].' BST')); |
|
748 | 748 | if (count($Source->getLocationInfoByLocationID($data['id'])) > 0) { |
749 | - $Source->updateLocationByLocationID('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
749 | + $Source->updateLocationByLocationID('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
750 | 750 | } else { |
751 | - $Source->addLocation('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
751 | + $Source->addLocation('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
752 | 752 | } |
753 | 753 | unset($data); |
754 | 754 | } |
755 | 755 | } |
756 | 756 | $last_exec[$id]['last'] = time(); |
757 | 757 | } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
758 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
758 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
759 | 759 | if ($buffer != '') { |
760 | - $all_data = json_decode($buffer,true); |
|
760 | + $all_data = json_decode($buffer, true); |
|
761 | 761 | if (isset($all_data['acList'])) { |
762 | 762 | $reset = 0; |
763 | 763 | foreach ($all_data['acList'] as $line) { |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | $data['emergency'] = ''; // emergency |
775 | 775 | if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
776 | 776 | |
777 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
777 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
778 | 778 | else $data['datetime'] = date('Y-m-d H:i:s'); |
779 | 779 | |
780 | 780 | //$data['datetime'] = date('Y-m-d H:i:s'); |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | $data['verticalrate'] = $line['vrt']; // verticale rate |
801 | 801 | $data['squawk'] = $line['squawk']; // squawk |
802 | 802 | $data['emergency'] = ''; // emergency |
803 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
803 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
804 | 804 | else $data['datetime'] = date('Y-m-d H:i:s'); |
805 | 805 | $data['format_source'] = 'aircraftlistjson'; |
806 | 806 | $data['id_source'] = $id_source; |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
817 | 817 | } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
818 | 818 | $buffer = $Common->getData($value['host']); |
819 | - $all_data = json_decode($buffer,true); |
|
819 | + $all_data = json_decode($buffer, true); |
|
820 | 820 | if (isset($all_data['planes'])) { |
821 | 821 | $reset = 0; |
822 | 822 | foreach ($all_data['planes'] as $key => $line) { |
@@ -833,12 +833,12 @@ discard block |
||
833 | 833 | $data['emergency'] = ''; // emergency |
834 | 834 | $data['registration'] = $line[2]; |
835 | 835 | $data['aircraft_icao'] = $line[0]; |
836 | - $deparr = explode('-',$line[1]); |
|
836 | + $deparr = explode('-', $line[1]); |
|
837 | 837 | if (count($deparr) == 2) { |
838 | 838 | $data['departure_airport_icao'] = $deparr[0]; |
839 | 839 | $data['arrival_airport_icao'] = $deparr[1]; |
840 | 840 | } |
841 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
841 | + $data['datetime'] = date('Y-m-d H:i:s', $line[9]); |
|
842 | 842 | $data['format_source'] = 'planeupdatefaa'; |
843 | 843 | $data['id_source'] = $id_source; |
844 | 844 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | $last_exec[$id]['last'] = time(); |
852 | 852 | } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
853 | 853 | $buffer = $Common->getData($value['host']); |
854 | - $all_data = json_decode($buffer,true); |
|
854 | + $all_data = json_decode($buffer, true); |
|
855 | 855 | if (isset($all_data['states'])) { |
856 | 856 | $reset = 0; |
857 | 857 | foreach ($all_data['states'] as $key => $line) { |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | //$data['emergency'] = ''; // emergency |
869 | 869 | //$data['registration'] = $line[2]; |
870 | 870 | //$data['aircraft_icao'] = $line[0]; |
871 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
871 | + $data['datetime'] = date('Y-m-d H:i:s', $line[3]); |
|
872 | 872 | $data['format_source'] = 'opensky'; |
873 | 873 | $data['id_source'] = $id_source; |
874 | 874 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
883 | 883 | //$buffer = $Common->getData($hosts[$id]); |
884 | 884 | $buffer = $Common->getData($value['host']); |
885 | - $all_data = json_decode($buffer,true); |
|
885 | + $all_data = json_decode($buffer, true); |
|
886 | 886 | if (!empty($all_data)) $reset = 0; |
887 | 887 | foreach ($all_data as $key => $line) { |
888 | 888 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
@@ -915,11 +915,11 @@ discard block |
||
915 | 915 | //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
916 | 916 | } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
917 | 917 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
918 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
918 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); |
|
919 | 919 | //echo $buffer; |
920 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
921 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
922 | - $all_data = json_decode($buffer,true); |
|
920 | + $buffer = str_replace(array("\n", "\r"), "", $buffer); |
|
921 | + $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); |
|
922 | + $all_data = json_decode($buffer, true); |
|
923 | 923 | if (json_last_error() != JSON_ERROR_NONE) { |
924 | 924 | die(json_last_error_msg()); |
925 | 925 | } |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | //$data['departure_airport_iata'] = $line[11]; |
943 | 943 | //$data['arrival_airport_iata'] = $line[12]; |
944 | 944 | //$data['emergency'] = ''; // emergency |
945 | - $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
|
945 | + $data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] |
|
946 | 946 | $data['format_source'] = 'radarvirtueljson'; |
947 | 947 | $data['id_source'] = $id_source; |
948 | 948 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -958,14 +958,14 @@ discard block |
||
958 | 958 | } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
959 | 959 | //$buffer = $Common->getData($hosts[$id]); |
960 | 960 | $buffer = $Common->getData($value['host'].'?'.time()); |
961 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
961 | + $all_data = json_decode(utf8_encode($buffer), true); |
|
962 | 962 | |
963 | 963 | if (isset($all_data['pireps'])) { |
964 | 964 | $reset = 0; |
965 | 965 | foreach ($all_data['pireps'] as $line) { |
966 | 966 | $data = array(); |
967 | 967 | $data['id'] = $line['id']; |
968 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
968 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
969 | 969 | $data['ident'] = $line['callsign']; // ident |
970 | 970 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
971 | 971 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
@@ -995,9 +995,9 @@ discard block |
||
995 | 995 | $SI->add($data); |
996 | 996 | // print_r($data); |
997 | 997 | } elseif ($line['icon'] == 'ct') { |
998 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
999 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
1000 | - $typec = substr($data['ident'],-3); |
|
998 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
999 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
1000 | + $typec = substr($data['ident'], -3); |
|
1001 | 1001 | $data['type'] = ''; |
1002 | 1002 | if ($typec == 'APP') $data['type'] = 'Approach'; |
1003 | 1003 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
1009 | 1009 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
1010 | 1010 | else $data['type'] = 'Observer'; |
1011 | - 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']); |
|
1011 | + 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']); |
|
1012 | 1012 | } |
1013 | 1013 | unset($data); |
1014 | 1014 | } |
@@ -1020,14 +1020,14 @@ discard block |
||
1020 | 1020 | //$buffer = $Common->getData($hosts[$id]); |
1021 | 1021 | if ($globalDebug) echo 'Get Data...'."\n"; |
1022 | 1022 | $buffer = $Common->getData($value['host']); |
1023 | - $all_data = json_decode($buffer,true); |
|
1023 | + $all_data = json_decode($buffer, true); |
|
1024 | 1024 | if ($buffer != '' && is_array($all_data)) { |
1025 | 1025 | $reset = 0; |
1026 | 1026 | foreach ($all_data as $line) { |
1027 | 1027 | $data = array(); |
1028 | 1028 | //$data['id'] = $line['id']; // id not usable |
1029 | 1029 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
1030 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1030 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1031 | 1031 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
1032 | 1032 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
1033 | 1033 | $data['ident'] = $line['flightnum']; // ident |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | //$data['datetime'] = $line['lastupdate']; |
1043 | 1043 | //$data['last_update'] = $line['lastupdate']; |
1044 | 1044 | if (isset($value['timezone'])) { |
1045 | - $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
1045 | + $datetime = new DateTime($line['lastupdate'], new DateTimeZone($value['timezone'])); |
|
1046 | 1046 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
1047 | 1047 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1048 | 1048 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1055,14 +1055,14 @@ discard block |
||
1055 | 1055 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
1056 | 1056 | if (isset($line['aircraftname'])) { |
1057 | 1057 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
1058 | - $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
|
1059 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
1058 | + $line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); |
|
1059 | + $aircraft_data = explode('-', $line['aircraftname']); |
|
1060 | 1060 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
1061 | 1061 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
1062 | 1062 | else { |
1063 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
1064 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1065 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1063 | + $aircraft_data = explode(' ', $line['aircraftname']); |
|
1064 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]); |
|
1065 | + else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']); |
|
1066 | 1066 | } |
1067 | 1067 | } |
1068 | 1068 | if (isset($line['route'])) $data['waypoints'] = $line['route']; |
@@ -1082,14 +1082,14 @@ discard block |
||
1082 | 1082 | //$buffer = $Common->getData($hosts[$id]); |
1083 | 1083 | if ($globalDebug) echo 'Get Data...'."\n"; |
1084 | 1084 | $buffer = $Common->getData($value['host']); |
1085 | - $all_data = json_decode($buffer,true); |
|
1085 | + $all_data = json_decode($buffer, true); |
|
1086 | 1086 | if ($buffer != '' && is_array($all_data)) { |
1087 | 1087 | $reset = 0; |
1088 | 1088 | foreach ($all_data as $line) { |
1089 | 1089 | $data = array(); |
1090 | 1090 | //$data['id'] = $line['id']; // id not usable |
1091 | 1091 | $data['id'] = trim($line['flight_id']); |
1092 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1092 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1093 | 1093 | $data['pilot_name'] = $line['pilot_name']; |
1094 | 1094 | $data['pilot_id'] = $line['pilot_id']; |
1095 | 1095 | $data['ident'] = trim($line['callsign']); // ident |
@@ -1141,11 +1141,11 @@ discard block |
||
1141 | 1141 | //$value = $formats[$nb]; |
1142 | 1142 | $format = $globalSources[$nb]['format']; |
1143 | 1143 | if ($format == 'sbs' || $format == 'aprs' || $format == 'famaprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
1144 | - $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); |
|
1144 | + $buffer = @socket_read($r, 6000, PHP_NORMAL_READ); |
|
1145 | 1145 | } elseif ($format == 'vrstcp') { |
1146 | 1146 | $buffer = @socket_read($r, 6000); |
1147 | 1147 | } else { |
1148 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
1148 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); |
|
1149 | 1149 | } |
1150 | 1150 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
1151 | 1151 | //echo $buffer."\n"; |
@@ -1154,8 +1154,8 @@ discard block |
||
1154 | 1154 | $error = false; |
1155 | 1155 | //$SI::del(); |
1156 | 1156 | if ($format == 'vrstcp') { |
1157 | - $buffer = explode('},{',$buffer); |
|
1158 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1157 | + $buffer = explode('},{', $buffer); |
|
1158 | + } else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); |
|
1159 | 1159 | // SBS format is CSV format |
1160 | 1160 | if ($buffer !== FALSE && $buffer != '') { |
1161 | 1161 | $tt[$format] = 0; |
@@ -1189,13 +1189,13 @@ discard block |
||
1189 | 1189 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
1190 | 1190 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
1191 | 1191 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
1192 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1192 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
1193 | 1193 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1194 | 1194 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
1195 | 1195 | if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
1196 | 1196 | |
1197 | 1197 | if (isset($ais_data['timestamp'])) { |
1198 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
1198 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
1199 | 1199 | } else { |
1200 | 1200 | $data['datetime'] = date('Y-m-d H:i:s'); |
1201 | 1201 | } |
@@ -1206,10 +1206,10 @@ discard block |
||
1206 | 1206 | } elseif ($format == 'flightgearsp') { |
1207 | 1207 | //echo $buffer."\n"; |
1208 | 1208 | if (strlen($buffer) > 5) { |
1209 | - $line = explode(',',$buffer); |
|
1209 | + $line = explode(',', $buffer); |
|
1210 | 1210 | $data = array(); |
1211 | 1211 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
1212 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); |
|
1212 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1213 | 1213 | $data['ident'] = $line[6]; |
1214 | 1214 | $data['aircraft_name'] = $line[7]; |
1215 | 1215 | $data['longitude'] = $line[1]; |
@@ -1226,16 +1226,16 @@ discard block |
||
1226 | 1226 | } elseif ($format == 'acars') { |
1227 | 1227 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
1228 | 1228 | $ACARS->add(trim($buffer)); |
1229 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
1229 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
1230 | 1230 | $ACARS->deleteLiveAcarsData(); |
1231 | 1231 | } elseif ($format == 'flightgearmp') { |
1232 | - if (substr($buffer,0,1) != '#') { |
|
1232 | + if (substr($buffer, 0, 1) != '#') { |
|
1233 | 1233 | $data = array(); |
1234 | 1234 | //echo $buffer."\n"; |
1235 | - $line = explode(' ',$buffer); |
|
1235 | + $line = explode(' ', $buffer); |
|
1236 | 1236 | if (count($line) == 11) { |
1237 | - $userserver = explode('@',$line[0]); |
|
1238 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
1237 | + $userserver = explode('@', $line[0]); |
|
1238 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex |
|
1239 | 1239 | $data['ident'] = $userserver[0]; |
1240 | 1240 | $data['registration'] = $userserver[0]; |
1241 | 1241 | $data['latitude'] = $line[4]; |
@@ -1243,8 +1243,8 @@ discard block |
||
1243 | 1243 | $data['altitude'] = $line[6]; |
1244 | 1244 | $data['datetime'] = date('Y-m-d H:i:s'); |
1245 | 1245 | $aircraft_type = $line[10]; |
1246 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
1247 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
1246 | + $aircraft_type = preg_split(':/:', $aircraft_type); |
|
1247 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); |
|
1248 | 1248 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1249 | 1249 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
1250 | 1250 | } |
@@ -1253,8 +1253,8 @@ discard block |
||
1253 | 1253 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
1254 | 1254 | die; |
1255 | 1255 | } elseif ($format == 'vrstcp') { |
1256 | - foreach($buffer as $all_data) { |
|
1257 | - $line = json_decode('{'.$all_data.'}',true); |
|
1256 | + foreach ($buffer as $all_data) { |
|
1257 | + $line = json_decode('{'.$all_data.'}', true); |
|
1258 | 1258 | $data = array(); |
1259 | 1259 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
1260 | 1260 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
@@ -1280,16 +1280,16 @@ discard block |
||
1280 | 1280 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
1281 | 1281 | unset($data); |
1282 | 1282 | } |
1283 | - } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
|
1283 | + } elseif ($format == 'tsv' || substr($buffer, 0, 4) == 'clock') { |
|
1284 | 1284 | $line = explode("\t", $buffer); |
1285 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
1285 | + for ($k = 0; $k < count($line); $k = $k + 2) { |
|
1286 | 1286 | $key = $line[$k]; |
1287 | - $lined[$key] = $line[$k+1]; |
|
1287 | + $lined[$key] = $line[$k + 1]; |
|
1288 | 1288 | } |
1289 | 1289 | if (count($lined) > 3) { |
1290 | 1290 | $data['hex'] = $lined['hexid']; |
1291 | 1291 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
1292 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
1292 | + $data['datetime'] = date('Y-m-d H:i:s'); ; |
|
1293 | 1293 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
1294 | 1294 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
1295 | 1295 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
@@ -1308,22 +1308,22 @@ discard block |
||
1308 | 1308 | } else $error = true; |
1309 | 1309 | } elseif ($format == 'aprs' && $use_aprs) { |
1310 | 1310 | if ($aprs_connect == 0) { |
1311 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
|
1311 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); |
|
1312 | 1312 | $aprs_connect = 1; |
1313 | 1313 | } |
1314 | 1314 | |
1315 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
1315 | + if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { |
|
1316 | 1316 | $aprs_last_tx = time(); |
1317 | 1317 | $data_aprs = "# Keep alive"; |
1318 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
1318 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
1319 | 1319 | } |
1320 | 1320 | |
1321 | 1321 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
1322 | 1322 | //echo 'APRS data : '.$buffer."\n"; |
1323 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
1324 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
1323 | + $buffer = str_replace('APRS <- ', '', $buffer); |
|
1324 | + $buffer = str_replace('APRS -> ', '', $buffer); |
|
1325 | 1325 | //echo $buffer."\n"; |
1326 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
1326 | + if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { |
|
1327 | 1327 | $line = $APRS->parse($buffer); |
1328 | 1328 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
1329 | 1329 | if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) { |
@@ -1338,7 +1338,7 @@ discard block |
||
1338 | 1338 | if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date']; |
1339 | 1339 | if (isset($line['type_id'])) $data['type_id'] = $line['typeid']; |
1340 | 1340 | if (isset($line['status_id'])) $data['status_id'] = $line['statusid']; |
1341 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1341 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); |
|
1342 | 1342 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1343 | 1343 | //$data['datetime'] = date('Y-m-d H:i:s'); |
1344 | 1344 | if (isset($line['ident'])) $data['ident'] = $line['ident']; |
@@ -1385,9 +1385,9 @@ discard block |
||
1385 | 1385 | if (!isset($data['altitude'])) $data['altitude'] = 0; |
1386 | 1386 | $Source->deleteOldLocationByType('gs'); |
1387 | 1387 | if (count($Source->getLocationInfoByName($data['ident'])) > 0) { |
1388 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
1388 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
1389 | 1389 | } else { |
1390 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
1390 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
1391 | 1391 | } |
1392 | 1392 | } else { |
1393 | 1393 | echo '/!\ Not added'."\n"; |
@@ -1400,7 +1400,7 @@ discard block |
||
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
1403 | - $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
|
1403 | + $Source->updateLocationDescByName($line['ident'], $line['source'], $id, $line['comment']); |
|
1404 | 1404 | } |
1405 | 1405 | /* |
1406 | 1406 | elseif (is_array($line) && $globalDebug && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] == 'Car' || $line['symbol'] == 'Ambulance' || $line['symbol'] == 'Van' || $line['symbol'] == 'Truck' || $line['symbol'] == 'Truck (18 Wheeler)' || $line['symbol'] == 'Motorcycle')) { |
@@ -1487,7 +1487,7 @@ discard block |
||
1487 | 1487 | connect_all($sourceee); |
1488 | 1488 | $sourceee = array(); |
1489 | 1489 | //connect_all($globalSources); |
1490 | - $tt[$format]=0; |
|
1490 | + $tt[$format] = 0; |
|
1491 | 1491 | break; |
1492 | 1492 | } |
1493 | 1493 | } |
@@ -1496,14 +1496,14 @@ discard block |
||
1496 | 1496 | } else { |
1497 | 1497 | $error = socket_strerror(socket_last_error()); |
1498 | 1498 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
1499 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
1499 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; |
|
1500 | 1500 | if (isset($globalDebug)) echo "Restarting...\n"; |
1501 | 1501 | // Restart the script if possible |
1502 | 1502 | if (is_array($sockets)) { |
1503 | 1503 | if ($globalDebug) echo "Shutdown all sockets..."; |
1504 | 1504 | |
1505 | 1505 | foreach ($sockets as $sock) { |
1506 | - @socket_shutdown($sock,2); |
|
1506 | + @socket_shutdown($sock, 2); |
|
1507 | 1507 | @socket_close($sock); |
1508 | 1508 | } |
1509 | 1509 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | require_once(dirname(__FILE__).'/class.create_db.php'); |
11 | 11 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
12 | 12 | require_once(dirname(__FILE__).'/class.settings.php'); |
13 | -$title="Install"; |
|
13 | +$title = "Install"; |
|
14 | 14 | require(dirname(__FILE__).'/../require/settings.php'); |
15 | 15 | require(dirname(__FILE__).'/header.php'); |
16 | 16 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | if (!extension_loaded('curl')) { |
70 | 70 | $error[] = "Curl is not loaded."; |
71 | 71 | } |
72 | -if(function_exists('apache_get_modules') ){ |
|
73 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
72 | +if (function_exists('apache_get_modules')) { |
|
73 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
74 | 74 | $error[] = "mod_rewrite is not available."; |
75 | 75 | } |
76 | 76 | /* |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>'; |
87 | 87 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
88 | 88 | if (function_exists('get_headers')) { |
89 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
90 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
89 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
90 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
91 | 91 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
92 | 92 | } |
93 | 93 | } |
@@ -452,13 +452,13 @@ discard block |
||
452 | 452 | ?> |
453 | 453 | <tr> |
454 | 454 | <?php |
455 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
455 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
456 | 456 | ?> |
457 | 457 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
458 | 458 | <td><input type="number" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
459 | 459 | <?php |
460 | 460 | } else { |
461 | - $hostport = explode(':',$source['host']); |
|
461 | + $hostport = explode(':', $source['host']); |
|
462 | 462 | if (isset($hostport[1])) { |
463 | 463 | $host = $hostport[0]; |
464 | 464 | $port = $hostport[1]; |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | <select name="timezone[]" id="timezone"> |
504 | 504 | <?php |
505 | 505 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
506 | - foreach($timezonelist as $timezone){ |
|
506 | + foreach ($timezonelist as $timezone) { |
|
507 | 507 | if (isset($source['timezone']) && $source['timezone'] == $timezone) { |
508 | 508 | print '<option selected>'.$timezone.'</option>'; |
509 | 509 | } elseif (!isset($source['timezone']) && $timezone == 'UTC') { |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | <select name="timezone[]" id="timezone"> |
554 | 554 | <?php |
555 | 555 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
556 | - foreach($timezonelist as $timezone){ |
|
556 | + foreach ($timezonelist as $timezone) { |
|
557 | 557 | if ($timezone == 'UTC') { |
558 | 558 | print '<option selected>'.$timezone.'</option>'; |
559 | 559 | } else print '<option>'.$timezone.'</option>'; |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | <br /> |
866 | 866 | <p> |
867 | 867 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
868 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
868 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
869 | 869 | </p> |
870 | 870 | <br /> |
871 | 871 | <p> |
@@ -921,14 +921,14 @@ discard block |
||
921 | 921 | $error = ''; |
922 | 922 | |
923 | 923 | if (isset($_POST['dbtype'])) { |
924 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
925 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
926 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
927 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
928 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
929 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
930 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
931 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
924 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
925 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
926 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
927 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
928 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
929 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
930 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
931 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
932 | 932 | |
933 | 933 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
934 | 934 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -948,49 +948,49 @@ discard block |
||
948 | 948 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
949 | 949 | */ |
950 | 950 | |
951 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
951 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
952 | 952 | |
953 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
954 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
955 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
956 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
957 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
953 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
954 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
955 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
956 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
957 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
958 | 958 | |
959 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
960 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
961 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
962 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
963 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
964 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
965 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
966 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
967 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
968 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
959 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
960 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
961 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
962 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
963 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
964 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
965 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
966 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
967 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
968 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
969 | 969 | |
970 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
971 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
972 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
973 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
974 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
975 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
970 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
971 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
972 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
973 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
974 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
975 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
976 | 976 | |
977 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
978 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
977 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
978 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
979 | 979 | |
980 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
981 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
982 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
980 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
981 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
982 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
983 | 983 | |
984 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
984 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
985 | 985 | if ($acars == 'acars') { |
986 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
986 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
987 | 987 | } else { |
988 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
988 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
989 | 989 | } |
990 | 990 | |
991 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
992 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
993 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
991 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
992 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
993 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
994 | 994 | |
995 | 995 | $source_name = $_POST['source_name']; |
996 | 996 | $source_latitude = $_POST['source_latitude']; |
@@ -1004,8 +1004,8 @@ discard block |
||
1004 | 1004 | |
1005 | 1005 | $sources = array(); |
1006 | 1006 | foreach ($source_name as $keys => $name) { |
1007 | - 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]); |
|
1008 | - 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]); |
|
1007 | + 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]); |
|
1008 | + 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]); |
|
1009 | 1009 | } |
1010 | 1010 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1011 | 1011 | |
@@ -1018,24 +1018,24 @@ discard block |
||
1018 | 1018 | $sbsurl = $_POST['sbsurl']; |
1019 | 1019 | */ |
1020 | 1020 | |
1021 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1022 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1023 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1024 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1025 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1026 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1027 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1028 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1021 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1022 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1023 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1024 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1025 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1026 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1027 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1028 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1029 | 1029 | |
1030 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1031 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1032 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1033 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1034 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1035 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1036 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1037 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1038 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1030 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1031 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1032 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1033 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1034 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1035 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1036 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1037 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1038 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1039 | 1039 | |
1040 | 1040 | /* |
1041 | 1041 | $globalSBS1Hosts = array(); |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | } |
1052 | 1052 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1053 | 1053 | */ |
1054 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1054 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1055 | 1055 | $host = $_POST['host']; |
1056 | 1056 | $port = $_POST['port']; |
1057 | 1057 | $name = $_POST['name']; |
@@ -1068,100 +1068,100 @@ discard block |
||
1068 | 1068 | else $cov = 'FALSE'; |
1069 | 1069 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1070 | 1070 | else $arch = 'FALSE'; |
1071 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezone[$key]); |
|
1071 | + if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezone[$key]); |
|
1072 | 1072 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1073 | 1073 | } |
1074 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1074 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1075 | 1075 | |
1076 | 1076 | /* |
1077 | 1077 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1078 | 1078 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1079 | 1079 | */ |
1080 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1081 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1082 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1080 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1081 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1082 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1083 | 1083 | |
1084 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1085 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1084 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1085 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1086 | 1086 | |
1087 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1088 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1087 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1088 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1089 | 1089 | |
1090 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1091 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1092 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1093 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1090 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1091 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1092 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1093 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1094 | 1094 | |
1095 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1096 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1097 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1095 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1096 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1097 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1098 | 1098 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1099 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1100 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1099 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1100 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1101 | 1101 | |
1102 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1103 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1104 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1105 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1106 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1107 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1108 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1109 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1102 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1103 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1104 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1105 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1106 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1107 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1108 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1109 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1110 | 1110 | |
1111 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1112 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1111 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1112 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1113 | 1113 | |
1114 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1115 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1114 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1115 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1116 | 1116 | |
1117 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1117 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1118 | 1118 | if ($archiveyear == "archiveyear") { |
1119 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1119 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1120 | 1120 | } else { |
1121 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1121 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1122 | 1122 | } |
1123 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1124 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1125 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1126 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1123 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1124 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1125 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1126 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1127 | 1127 | |
1128 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1129 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1130 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1131 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1128 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1129 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1130 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1131 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1132 | 1132 | |
1133 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1134 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1135 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1133 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1134 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1135 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1136 | 1136 | |
1137 | 1137 | // Create in settings.php keys not yet configurable if not already here |
1138 | 1138 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1139 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1139 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1140 | 1140 | |
1141 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1141 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1142 | 1142 | if ($resetyearstats == 'resetyearstats') { |
1143 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1143 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1144 | 1144 | } else { |
1145 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1145 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1148 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1149 | 1149 | if ($archive == 'archive') { |
1150 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1150 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1151 | 1151 | } else { |
1152 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1152 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1153 | 1153 | } |
1154 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1154 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1155 | 1155 | if ($daemon == 'daemon') { |
1156 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1156 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1157 | 1157 | } else { |
1158 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1158 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1159 | 1159 | } |
1160 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1160 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1161 | 1161 | if ($schedules == 'schedules') { |
1162 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1162 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1163 | 1163 | } else { |
1164 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1164 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | /* |
@@ -1172,227 +1172,227 @@ discard block |
||
1172 | 1172 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1173 | 1173 | } |
1174 | 1174 | */ |
1175 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1176 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1177 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1178 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1179 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1175 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1176 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1177 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1178 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1179 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1180 | 1180 | $va = false; |
1181 | 1181 | if ($globalivao == 'ivao') { |
1182 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1182 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1183 | 1183 | $va = true; |
1184 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1184 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1185 | 1185 | if ($globalvatsim == 'vatsim') { |
1186 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1186 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1187 | 1187 | $va = true; |
1188 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1188 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1189 | 1189 | if ($globalphpvms == 'phpvms') { |
1190 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1190 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1191 | 1191 | $va = true; |
1192 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1192 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1193 | 1193 | if ($globalvam == 'vam') { |
1194 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1194 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1195 | 1195 | $va = true; |
1196 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1196 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1197 | 1197 | if ($va) { |
1198 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1199 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1198 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1199 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1200 | 1200 | if ($globalva == 'va' || $va) { |
1201 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1202 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1201 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1202 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1203 | 1203 | } else { |
1204 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1205 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1206 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1204 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1205 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1206 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | |
1210 | 1210 | |
1211 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1211 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1212 | 1212 | if ($notam == 'notam') { |
1213 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1213 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1214 | 1214 | } else { |
1215 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1215 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1216 | 1216 | } |
1217 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1217 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1218 | 1218 | if ($owner == 'owner') { |
1219 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1219 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1220 | 1220 | } else { |
1221 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1221 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1222 | 1222 | } |
1223 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1223 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1224 | 1224 | if ($map3d == 'map3d') { |
1225 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1225 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1226 | 1226 | } else { |
1227 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1227 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1228 | 1228 | } |
1229 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1229 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1230 | 1230 | if ($crash == 'crash') { |
1231 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1231 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1232 | 1232 | } else { |
1233 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1233 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1234 | 1234 | } |
1235 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1235 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1236 | 1236 | if ($mapsatellites == 'mapsatellites') { |
1237 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1237 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1238 | 1238 | } else { |
1239 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1239 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1240 | 1240 | } |
1241 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1241 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1242 | 1242 | if ($map3ddefault == 'map3ddefault') { |
1243 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1243 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1244 | 1244 | } else { |
1245 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1245 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1246 | 1246 | } |
1247 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1247 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1248 | 1248 | if ($translate == 'translate') { |
1249 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1249 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1250 | 1250 | } else { |
1251 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1251 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1252 | 1252 | } |
1253 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1253 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1254 | 1254 | if ($realairlines == 'realairlines') { |
1255 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1255 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1256 | 1256 | } else { |
1257 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1257 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1258 | 1258 | } |
1259 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1259 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1260 | 1260 | if ($estimation == 'estimation') { |
1261 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1261 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1262 | 1262 | } else { |
1263 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1263 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1264 | 1264 | } |
1265 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1265 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1266 | 1266 | if ($metar == 'metar') { |
1267 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1267 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1268 | 1268 | } else { |
1269 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1269 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1270 | 1270 | } |
1271 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1271 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1272 | 1272 | if ($metarcycle == 'metarcycle') { |
1273 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1273 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1274 | 1274 | } else { |
1275 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1275 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1276 | 1276 | } |
1277 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1277 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1278 | 1278 | if ($fork == 'fork') { |
1279 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1279 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1280 | 1280 | } else { |
1281 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1281 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1282 | 1282 | } |
1283 | 1283 | |
1284 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1284 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1285 | 1285 | if ($colormap == 'colormap') { |
1286 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1286 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1287 | 1287 | } else { |
1288 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1288 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1289 | 1289 | } |
1290 | 1290 | |
1291 | 1291 | if (isset($_POST['aircrafticoncolor'])) { |
1292 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1293 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1292 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1293 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1294 | 1294 | } |
1295 | 1295 | |
1296 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1297 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1296 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1297 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1298 | 1298 | |
1299 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1300 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1301 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1302 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1303 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1304 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1299 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1300 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1301 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1302 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1303 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1304 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1305 | 1305 | |
1306 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1306 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1307 | 1307 | if ($mappopup == 'mappopup') { |
1308 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1308 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1309 | 1309 | } else { |
1310 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1310 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1311 | 1311 | } |
1312 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1312 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1313 | 1313 | if ($airportpopup == 'airportpopup') { |
1314 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1314 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1315 | 1315 | } else { |
1316 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1316 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1317 | 1317 | } |
1318 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1318 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1319 | 1319 | if ($maphistory == 'maphistory') { |
1320 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1320 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1321 | 1321 | } else { |
1322 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1322 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1323 | 1323 | } |
1324 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1324 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1325 | 1325 | if ($maptooltip == 'maptooltip') { |
1326 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1326 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1327 | 1327 | } else { |
1328 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1328 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1329 | 1329 | } |
1330 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1330 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1331 | 1331 | if ($flightroute == 'flightroute') { |
1332 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1332 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1333 | 1333 | } else { |
1334 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1334 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1335 | 1335 | } |
1336 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1336 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1337 | 1337 | if ($flightremainingroute == 'flightremainingroute') { |
1338 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1338 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1339 | 1339 | } else { |
1340 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1340 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1341 | 1341 | } |
1342 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1342 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1343 | 1343 | if ($allflights == 'allflights') { |
1344 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1344 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1345 | 1345 | } else { |
1346 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1346 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1347 | 1347 | } |
1348 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1348 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1349 | 1349 | if ($bbox == 'bbox') { |
1350 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1350 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1351 | 1351 | } else { |
1352 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1352 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1353 | 1353 | } |
1354 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1354 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1355 | 1355 | if ($groundaltitude == 'groundaltitude') { |
1356 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1356 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1357 | 1357 | } else { |
1358 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1358 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1359 | 1359 | } |
1360 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1360 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1361 | 1361 | if ($waypoints == 'waypoints') { |
1362 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1362 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1363 | 1363 | } else { |
1364 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1364 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1365 | 1365 | } |
1366 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1366 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1367 | 1367 | if ($geoid == 'geoid') { |
1368 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1368 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1369 | 1369 | } else { |
1370 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1370 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1371 | 1371 | } |
1372 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1373 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1372 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1373 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1374 | 1374 | |
1375 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1375 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1376 | 1376 | if ($noairlines == 'noairlines') { |
1377 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1377 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1378 | 1378 | } else { |
1379 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1379 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1380 | 1380 | } |
1381 | 1381 | |
1382 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1382 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1383 | 1383 | |
1384 | 1384 | // Set some defaults values... |
1385 | 1385 | if (!isset($globalAircraftImageSources)) { |
1386 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1387 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1386 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1387 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | if (!isset($globalSchedulesSources)) { |
1391 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1392 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1391 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1392 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1393 | 1393 | } |
1394 | 1394 | |
1395 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1395 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1396 | 1396 | |
1397 | 1397 | if ($error == '') settings::modify_settings($settings); |
1398 | 1398 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -25,20 +25,20 @@ discard block |
||
25 | 25 | fclose($fp); |
26 | 26 | } |
27 | 27 | |
28 | - public static function gunzip($in_file,$out_file_name = '') { |
|
28 | + public static function gunzip($in_file, $out_file_name = '') { |
|
29 | 29 | //echo $in_file.' -> '.$out_file_name."\n"; |
30 | 30 | $buffer_size = 4096; // read 4kb at a time |
31 | 31 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
32 | 32 | if ($in_file != '' && file_exists($in_file)) { |
33 | 33 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
34 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
35 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
34 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
35 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
36 | 36 | else { |
37 | 37 | echo 'gzopen not available'; |
38 | 38 | die; |
39 | 39 | } |
40 | 40 | $out_file = fopen($out_file_name, 'wb'); |
41 | - while(!gzeof($file)) { |
|
41 | + while (!gzeof($file)) { |
|
42 | 42 | fwrite($out_file, gzread($file, $buffer_size)); |
43 | 43 | } |
44 | 44 | fclose($out_file); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | try { |
63 | 63 | self::$db_sqlite = new PDO('sqlite:'.$database); |
64 | 64 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
65 | - } catch(PDOException $e) { |
|
65 | + } catch (PDOException $e) { |
|
66 | 66 | return "error : ".$e->getMessage(); |
67 | 67 | } |
68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | //$Connection = new Connection(); |
78 | 78 | $sth = $Connection->db->prepare($query); |
79 | 79 | $sth->execute(array(':source' => $database_file)); |
80 | - } catch(PDOException $e) { |
|
80 | + } catch (PDOException $e) { |
|
81 | 81 | return "error : ".$e->getMessage(); |
82 | 82 | } |
83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | try { |
89 | 89 | $sth = update_db::$db_sqlite->prepare($query); |
90 | 90 | $sth->execute(); |
91 | - } catch(PDOException $e) { |
|
91 | + } catch (PDOException $e) { |
|
92 | 92 | return "error : ".$e->getMessage(); |
93 | 93 | } |
94 | 94 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | if ($globalTransaction) $Connection->db->beginTransaction(); |
100 | 100 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
101 | 101 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
102 | - $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
102 | + $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
103 | 103 | $sth_dest->execute($query_dest_values); |
104 | 104 | } |
105 | 105 | if ($globalTransaction) $Connection->db->commit(); |
106 | - } catch(PDOException $e) { |
|
106 | + } catch (PDOException $e) { |
|
107 | 107 | if ($globalTransaction) $Connection->db->rollBack(); |
108 | 108 | return "error : ".$e->getMessage(); |
109 | 109 | } |
@@ -119,26 +119,26 @@ discard block |
||
119 | 119 | //$Connection = new Connection(); |
120 | 120 | $sth = $Connection->db->prepare($query); |
121 | 121 | $sth->execute(array(':source' => 'oneworld')); |
122 | - } catch(PDOException $e) { |
|
122 | + } catch (PDOException $e) { |
|
123 | 123 | return "error : ".$e->getMessage(); |
124 | 124 | } |
125 | 125 | |
126 | 126 | if ($globalDebug) echo " - Add routes to DB -"; |
127 | 127 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
128 | 128 | $Spotter = new Spotter(); |
129 | - if ($fh = fopen($database_file,"r")) { |
|
129 | + if ($fh = fopen($database_file, "r")) { |
|
130 | 130 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
131 | 131 | $Connection = new Connection(); |
132 | 132 | $sth_dest = $Connection->db->prepare($query_dest); |
133 | 133 | if ($globalTransaction) $Connection->db->beginTransaction(); |
134 | 134 | while (!feof($fh)) { |
135 | - $line = fgetcsv($fh,9999,','); |
|
135 | + $line = fgetcsv($fh, 9999, ','); |
|
136 | 136 | if ($line[0] != '') { |
137 | 137 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
138 | 138 | try { |
139 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
|
139 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
140 | 140 | $sth_dest->execute($query_dest_values); |
141 | - } catch(PDOException $e) { |
|
141 | + } catch (PDOException $e) { |
|
142 | 142 | if ($globalTransaction) $Connection->db->rollBack(); |
143 | 143 | return "error : ".$e->getMessage(); |
144 | 144 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | //$Connection = new Connection(); |
161 | 161 | $sth = $Connection->db->prepare($query); |
162 | 162 | $sth->execute(array(':source' => 'skyteam')); |
163 | - } catch(PDOException $e) { |
|
163 | + } catch (PDOException $e) { |
|
164 | 164 | return "error : ".$e->getMessage(); |
165 | 165 | } |
166 | 166 | |
@@ -168,24 +168,24 @@ discard block |
||
168 | 168 | |
169 | 169 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
170 | 170 | $Spotter = new Spotter(); |
171 | - if ($fh = fopen($database_file,"r")) { |
|
171 | + if ($fh = fopen($database_file, "r")) { |
|
172 | 172 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
173 | 173 | $Connection = new Connection(); |
174 | 174 | $sth_dest = $Connection->db->prepare($query_dest); |
175 | 175 | try { |
176 | 176 | if ($globalTransaction) $Connection->db->beginTransaction(); |
177 | 177 | while (!feof($fh)) { |
178 | - $line = fgetcsv($fh,9999,','); |
|
178 | + $line = fgetcsv($fh, 9999, ','); |
|
179 | 179 | if ($line[0] != '') { |
180 | - $datebe = explode(' - ',$line[2]); |
|
180 | + $datebe = explode(' - ', $line[2]); |
|
181 | 181 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
182 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
182 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
183 | 183 | $sth_dest->execute($query_dest_values); |
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
187 | 187 | if ($globalTransaction) $Connection->db->commit(); |
188 | - } catch(PDOException $e) { |
|
188 | + } catch (PDOException $e) { |
|
189 | 189 | if ($globalTransaction) $Connection->db->rollBack(); |
190 | 190 | return "error : ".$e->getMessage(); |
191 | 191 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $Connection = new Connection(); |
201 | 201 | $sth = $Connection->db->prepare($query); |
202 | 202 | $sth->execute(array(':source' => $database_file)); |
203 | - } catch(PDOException $e) { |
|
203 | + } catch (PDOException $e) { |
|
204 | 204 | return "error : ".$e->getMessage(); |
205 | 205 | } |
206 | 206 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $Connection = new Connection(); |
209 | 209 | $sth = $Connection->db->prepare($query); |
210 | 210 | $sth->execute(array(':source' => $database_file)); |
211 | - } catch(PDOException $e) { |
|
211 | + } catch (PDOException $e) { |
|
212 | 212 | return "error : ".$e->getMessage(); |
213 | 213 | } |
214 | 214 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | try { |
218 | 218 | $sth = update_db::$db_sqlite->prepare($query); |
219 | 219 | $sth->execute(); |
220 | - } catch(PDOException $e) { |
|
220 | + } catch (PDOException $e) { |
|
221 | 221 | return "error : ".$e->getMessage(); |
222 | 222 | } |
223 | 223 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -234,15 +234,15 @@ discard block |
||
234 | 234 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
235 | 235 | if ($values['UserString4'] == 'M') $type = 'military'; |
236 | 236 | else $type = null; |
237 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
237 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
238 | 238 | $sth_dest->execute($query_dest_values); |
239 | 239 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
240 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
240 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
241 | 241 | $sth_dest_owner->execute($query_dest_owner_values); |
242 | 242 | } |
243 | 243 | } |
244 | 244 | if ($globalTransaction) $Connection->db->commit(); |
245 | - } catch(PDOException $e) { |
|
245 | + } catch (PDOException $e) { |
|
246 | 246 | return "error : ".$e->getMessage(); |
247 | 247 | } |
248 | 248 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $Connection = new Connection(); |
253 | 253 | $sth = $Connection->db->prepare($query); |
254 | 254 | $sth->execute(array(':source' => $database_file)); |
255 | - } catch(PDOException $e) { |
|
255 | + } catch (PDOException $e) { |
|
256 | 256 | return "error : ".$e->getMessage(); |
257 | 257 | } |
258 | 258 | return ''; |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | $Connection = new Connection(); |
268 | 268 | $sth = $Connection->db->prepare($query); |
269 | 269 | $sth->execute(array(':source' => $database_file)); |
270 | - } catch(PDOException $e) { |
|
270 | + } catch (PDOException $e) { |
|
271 | 271 | return "error : ".$e->getMessage(); |
272 | 272 | } |
273 | 273 | |
274 | - if ($fh = fopen($database_file,"r")) { |
|
274 | + if ($fh = fopen($database_file, "r")) { |
|
275 | 275 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
276 | 276 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
277 | 277 | |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | if ($globalTransaction) $Connection->db->beginTransaction(); |
282 | 282 | while (!feof($fh)) { |
283 | 283 | $values = array(); |
284 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
284 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
285 | 285 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
286 | - $values['ModeS'] = substr($line,0,6); |
|
287 | - $values['Registration'] = trim(substr($line,69,6)); |
|
288 | - $aircraft_name = trim(substr($line,48,6)); |
|
286 | + $values['ModeS'] = substr($line, 0, 6); |
|
287 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
288 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
289 | 289 | // Check if we can find ICAO, else set it to GLID |
290 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
290 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
291 | 291 | $search_more = ''; |
292 | 292 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
293 | 293 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -299,20 +299,20 @@ discard block |
||
299 | 299 | if (isset($result['icao']) && $result['icao'] != '') { |
300 | 300 | $values['ICAOTypeCode'] = $result['icao']; |
301 | 301 | } |
302 | - } catch(PDOException $e) { |
|
302 | + } catch (PDOException $e) { |
|
303 | 303 | return "error : ".$e->getMessage(); |
304 | 304 | } |
305 | 305 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
306 | 306 | // Add data to db |
307 | 307 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
308 | 308 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
309 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
309 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
310 | 310 | //print_r($query_dest_values); |
311 | 311 | $sth_dest->execute($query_dest_values); |
312 | 312 | } |
313 | 313 | } |
314 | 314 | if ($globalTransaction) $Connection->db->commit(); |
315 | - } catch(PDOException $e) { |
|
315 | + } catch (PDOException $e) { |
|
316 | 316 | return "error : ".$e->getMessage(); |
317 | 317 | } |
318 | 318 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $Connection = new Connection(); |
323 | 323 | $sth = $Connection->db->prepare($query); |
324 | 324 | $sth->execute(array(':source' => $database_file)); |
325 | - } catch(PDOException $e) { |
|
325 | + } catch (PDOException $e) { |
|
326 | 326 | return "error : ".$e->getMessage(); |
327 | 327 | } |
328 | 328 | return ''; |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | $Connection = new Connection(); |
337 | 337 | $sth = $Connection->db->prepare($query); |
338 | 338 | $sth->execute(array(':source' => $database_file)); |
339 | - } catch(PDOException $e) { |
|
339 | + } catch (PDOException $e) { |
|
340 | 340 | return "error : ".$e->getMessage(); |
341 | 341 | } |
342 | 342 | |
343 | - if ($fh = fopen($database_file,"r")) { |
|
343 | + if ($fh = fopen($database_file, "r")) { |
|
344 | 344 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
345 | 345 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
346 | 346 | |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | $sth_dest = $Connection->db->prepare($query_dest); |
349 | 349 | try { |
350 | 350 | if ($globalTransaction) $Connection->db->beginTransaction(); |
351 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
351 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
352 | 352 | while (!feof($fh)) { |
353 | - $line = fgetcsv($fh,9999,',',"'"); |
|
353 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
354 | 354 | |
355 | 355 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
356 | 356 | //print_r($line); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $values['ICAOTypeCode'] = ''; |
360 | 360 | $aircraft_name = $line[2]; |
361 | 361 | // Check if we can find ICAO, else set it to GLID |
362 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
362 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
363 | 363 | $search_more = ''; |
364 | 364 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
365 | 365 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -368,20 +368,20 @@ discard block |
||
368 | 368 | $sth_search->execute(); |
369 | 369 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
370 | 370 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
371 | - } catch(PDOException $e) { |
|
371 | + } catch (PDOException $e) { |
|
372 | 372 | return "error : ".$e->getMessage(); |
373 | 373 | } |
374 | 374 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
375 | 375 | // Add data to db |
376 | 376 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
377 | 377 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
378 | - $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
378 | + $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
379 | 379 | //print_r($query_dest_values); |
380 | 380 | $sth_dest->execute($query_dest_values); |
381 | 381 | } |
382 | 382 | } |
383 | 383 | if ($globalTransaction) $Connection->db->commit(); |
384 | - } catch(PDOException $e) { |
|
384 | + } catch (PDOException $e) { |
|
385 | 385 | return "error : ".$e->getMessage(); |
386 | 386 | } |
387 | 387 | } |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | $Connection = new Connection(); |
392 | 392 | $sth = $Connection->db->prepare($query); |
393 | 393 | $sth->execute(array(':source' => $database_file)); |
394 | - } catch(PDOException $e) { |
|
394 | + } catch (PDOException $e) { |
|
395 | 395 | return "error : ".$e->getMessage(); |
396 | 396 | } |
397 | 397 | return ''; |
398 | 398 | } |
399 | 399 | |
400 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
400 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
401 | 401 | global $globalTransaction, $globalMasterSource; |
402 | 402 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
403 | 403 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -405,12 +405,12 @@ discard block |
||
405 | 405 | $Connection = new Connection(); |
406 | 406 | $sth = $Connection->db->prepare($query); |
407 | 407 | $sth->execute(array(':source' => $database_file)); |
408 | - } catch(PDOException $e) { |
|
408 | + } catch (PDOException $e) { |
|
409 | 409 | return "error : ".$e->getMessage(); |
410 | 410 | } |
411 | 411 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
412 | 412 | $Spotter = new Spotter(); |
413 | - if ($fh = fopen($database_file,"r")) { |
|
413 | + if ($fh = fopen($database_file, "r")) { |
|
414 | 414 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
415 | 415 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
416 | 416 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -420,9 +420,9 @@ discard block |
||
420 | 420 | $sth_modes = $Connection->db->prepare($query_modes); |
421 | 421 | try { |
422 | 422 | if ($globalTransaction) $Connection->db->beginTransaction(); |
423 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
423 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
424 | 424 | while (!feof($fh)) { |
425 | - $line = fgetcsv($fh,9999,',','"'); |
|
425 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
426 | 426 | $values = array(); |
427 | 427 | //print_r($line); |
428 | 428 | if ($country == 'F') { |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $values['base'] = $line[4]; |
431 | 431 | $values['owner'] = $line[5]; |
432 | 432 | if ($line[6] == '') $values['date_first_reg'] = null; |
433 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
433 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
434 | 434 | $values['cancel'] = $line[7]; |
435 | 435 | } elseif ($country == 'EI') { |
436 | 436 | // TODO : add modeS & reg to aircraft_modes |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $values['base'] = $line[3]; |
439 | 439 | $values['owner'] = $line[2]; |
440 | 440 | if ($line[1] == '') $values['date_first_reg'] = null; |
441 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
441 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
442 | 442 | $values['cancel'] = ''; |
443 | 443 | $values['modes'] = $line[7]; |
444 | 444 | $values['icao'] = $line[8]; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $values['base'] = null; |
459 | 459 | $values['owner'] = $line[5]; |
460 | 460 | if ($line[18] == '') $values['date_first_reg'] = null; |
461 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
461 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
462 | 462 | $values['cancel'] = ''; |
463 | 463 | } elseif ($country == 'VH') { |
464 | 464 | // TODO : add modeS & reg to aircraft_modes |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $values['base'] = null; |
467 | 467 | $values['owner'] = $line[12]; |
468 | 468 | if ($line[28] == '') $values['date_first_reg'] = null; |
469 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
469 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
470 | 470 | |
471 | 471 | $values['cancel'] = $line[39]; |
472 | 472 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -486,28 +486,28 @@ discard block |
||
486 | 486 | $values['base'] = null; |
487 | 487 | $values['owner'] = $line[8]; |
488 | 488 | if ($line[7] == '') $values['date_first_reg'] = null; |
489 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
489 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
490 | 490 | $values['cancel'] = ''; |
491 | 491 | } elseif ($country == 'PP') { |
492 | 492 | $values['registration'] = $line[0]; |
493 | 493 | $values['base'] = null; |
494 | 494 | $values['owner'] = $line[4]; |
495 | 495 | if ($line[6] == '') $values['date_first_reg'] = null; |
496 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
496 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
497 | 497 | $values['cancel'] = $line[7]; |
498 | 498 | } elseif ($country == 'E7') { |
499 | 499 | $values['registration'] = $line[0]; |
500 | 500 | $values['base'] = null; |
501 | 501 | $values['owner'] = $line[4]; |
502 | 502 | if ($line[5] == '') $values['date_first_reg'] = null; |
503 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
503 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
504 | 504 | $values['cancel'] = ''; |
505 | 505 | } elseif ($country == '8Q') { |
506 | 506 | $values['registration'] = $line[0]; |
507 | 507 | $values['base'] = null; |
508 | 508 | $values['owner'] = $line[3]; |
509 | 509 | if ($line[7] == '') $values['date_first_reg'] = null; |
510 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
510 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
511 | 511 | $values['cancel'] = ''; |
512 | 512 | } elseif ($country == 'ZK') { |
513 | 513 | $values['registration'] = $line[0]; |
@@ -521,18 +521,18 @@ discard block |
||
521 | 521 | $values['registration'] = $line[0]; |
522 | 522 | $values['base'] = null; |
523 | 523 | $values['owner'] = $line[6]; |
524 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
525 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
524 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
525 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
526 | 526 | $values['modes'] = $line[4]; |
527 | 527 | $values['icao'] = $line[10]; |
528 | 528 | } elseif ($country == 'OY') { |
529 | 529 | $values['registration'] = $line[0]; |
530 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
530 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
531 | 531 | $values['modes'] = $line[5]; |
532 | 532 | $values['icao'] = $line[6]; |
533 | 533 | } elseif ($country == 'PH') { |
534 | 534 | $values['registration'] = $line[0]; |
535 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
535 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
536 | 536 | $values['modes'] = $line[4]; |
537 | 537 | $values['icao'] = $line[5]; |
538 | 538 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -543,17 +543,17 @@ discard block |
||
543 | 543 | $values['cancel'] = ''; |
544 | 544 | } |
545 | 545 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
546 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
546 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
547 | 547 | $sth_dest->execute($query_dest_values); |
548 | 548 | } |
549 | 549 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
550 | 550 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
551 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
551 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
552 | 552 | $sth_modes->execute($query_modes_values); |
553 | 553 | } |
554 | 554 | } |
555 | 555 | if ($globalTransaction) $Connection->db->commit(); |
556 | - } catch(PDOException $e) { |
|
556 | + } catch (PDOException $e) { |
|
557 | 557 | return "error : ".$e->getMessage(); |
558 | 558 | } |
559 | 559 | } |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | $Connection = new Connection(); |
669 | 669 | $sth = $Connection->db->prepare($query); |
670 | 670 | $sth->execute(); |
671 | - } catch(PDOException $e) { |
|
671 | + } catch (PDOException $e) { |
|
672 | 672 | return "error : ".$e->getMessage(); |
673 | 673 | } |
674 | 674 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | $Connection = new Connection(); |
679 | 679 | $sth = $Connection->db->prepare($query); |
680 | 680 | $sth->execute(); |
681 | - } catch(PDOException $e) { |
|
681 | + } catch (PDOException $e) { |
|
682 | 682 | return "error : ".$e->getMessage(); |
683 | 683 | } |
684 | 684 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | if ($globalTransaction) $Connection->db->beginTransaction(); |
690 | 690 | |
691 | 691 | $i = 0; |
692 | - while($row = sparql_fetch_array($result)) |
|
692 | + while ($row = sparql_fetch_array($result)) |
|
693 | 693 | { |
694 | 694 | if ($i >= 1) { |
695 | 695 | //print_r($row); |
@@ -709,31 +709,31 @@ discard block |
||
709 | 709 | $row['image'] = ''; |
710 | 710 | $row['image_thumb'] = ''; |
711 | 711 | } else { |
712 | - $image = str_replace(' ','_',$row['image']); |
|
712 | + $image = str_replace(' ', '_', $row['image']); |
|
713 | 713 | $digest = md5($image); |
714 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
715 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
716 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
717 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
714 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
715 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
716 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
717 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
718 | 718 | } |
719 | 719 | |
720 | - $country = explode('-',$row['country']); |
|
720 | + $country = explode('-', $row['country']); |
|
721 | 721 | $row['country'] = $country[0]; |
722 | 722 | |
723 | 723 | $row['type'] = trim($row['type']); |
724 | - if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
724 | + if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
725 | 725 | $row['type'] = 'Military'; |
726 | 726 | } elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
727 | 727 | $row['type'] = 'small_airport'; |
728 | 728 | } |
729 | 729 | |
730 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
731 | - $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => $row['altitude'],':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
730 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
731 | + $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => $row['altitude'], ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
732 | 732 | //print_r($query_dest_values); |
733 | 733 | |
734 | 734 | try { |
735 | 735 | $sth_dest->execute($query_dest_values); |
736 | - } catch(PDOException $e) { |
|
736 | + } catch (PDOException $e) { |
|
737 | 737 | return "error : ".$e->getMessage(); |
738 | 738 | } |
739 | 739 | } |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | $Connection = new Connection(); |
748 | 748 | $sth = $Connection->db->prepare($query); |
749 | 749 | $sth->execute(); |
750 | - } catch(PDOException $e) { |
|
750 | + } catch (PDOException $e) { |
|
751 | 751 | return "error : ".$e->getMessage(); |
752 | 752 | } |
753 | 753 | |
@@ -755,12 +755,12 @@ discard block |
||
755 | 755 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
756 | 756 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
757 | 757 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
758 | - $query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => ''); |
|
758 | + $query_values = array(':airport_id' => $i, ':name' => 'Not available', ':iata' => 'NA', ':icao' => 'NA', ':latitude' => '0', ':longitude' => '0', ':altitude' => '0', ':type' => 'NA', ':city' => 'N/A', ':country' => 'N/A', ':home_link' => '', ':wikipedia_link' => '', ':image' => '', ':image_thumb' => ''); |
|
759 | 759 | try { |
760 | 760 | $Connection = new Connection(); |
761 | 761 | $sth = $Connection->db->prepare($query); |
762 | 762 | $sth->execute($query_values); |
763 | - } catch(PDOException $e) { |
|
763 | + } catch (PDOException $e) { |
|
764 | 764 | return "error : ".$e->getMessage(); |
765 | 765 | } |
766 | 766 | $i++; |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | echo "Download data from ourairports.com...\n"; |
779 | 779 | $delimiter = ','; |
780 | 780 | $out_file = $tmp_dir.'airports.csv'; |
781 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
781 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
782 | 782 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
783 | 783 | echo "Add data from ourairports.com...\n"; |
784 | 784 | |
@@ -789,32 +789,32 @@ discard block |
||
789 | 789 | //$Connection->db->beginTransaction(); |
790 | 790 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
791 | 791 | { |
792 | - if(!$header) $header = $row; |
|
792 | + if (!$header) $header = $row; |
|
793 | 793 | else { |
794 | 794 | $data = array(); |
795 | 795 | $data = array_combine($header, $row); |
796 | 796 | try { |
797 | 797 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao'); |
798 | 798 | $sth->execute(array(':icao' => $data['gps_code'])); |
799 | - } catch(PDOException $e) { |
|
799 | + } catch (PDOException $e) { |
|
800 | 800 | return "error : ".$e->getMessage(); |
801 | 801 | } |
802 | 802 | if ($sth->fetchColumn() > 0) { |
803 | 803 | $query = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
804 | 804 | try { |
805 | 805 | $sth = $Connection->db->prepare($query); |
806 | - $sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type'])); |
|
807 | - } catch(PDOException $e) { |
|
806 | + $sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type'])); |
|
807 | + } catch (PDOException $e) { |
|
808 | 808 | return "error : ".$e->getMessage(); |
809 | 809 | } |
810 | 810 | } else { |
811 | 811 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`) |
812 | 812 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
813 | - $query_values = array(':airport_id' => $i, ':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => $data['elevation_ft'],':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
813 | + $query_values = array(':airport_id' => $i, ':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => $data['elevation_ft'], ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
814 | 814 | try { |
815 | 815 | $sth = $Connection->db->prepare($query); |
816 | 816 | $sth->execute($query_values); |
817 | - } catch(PDOException $e) { |
|
817 | + } catch (PDOException $e) { |
|
818 | 818 | return "error : ".$e->getMessage(); |
819 | 819 | } |
820 | 820 | $i++; |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | |
828 | 828 | echo "Download data from another free database...\n"; |
829 | 829 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
830 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
830 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
831 | 831 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
832 | 832 | update_db::unzip($out_file); |
833 | 833 | $header = NULL; |
@@ -839,15 +839,15 @@ discard block |
||
839 | 839 | //$Connection->db->beginTransaction(); |
840 | 840 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
841 | 841 | { |
842 | - if(!$header) $header = $row; |
|
842 | + if (!$header) $header = $row; |
|
843 | 843 | else { |
844 | 844 | $data = $row; |
845 | 845 | |
846 | 846 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
847 | 847 | try { |
848 | 848 | $sth = $Connection->db->prepare($query); |
849 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
850 | - } catch(PDOException $e) { |
|
849 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
850 | + } catch (PDOException $e) { |
|
851 | 851 | return "error : ".$e->getMessage(); |
852 | 852 | } |
853 | 853 | } |
@@ -861,15 +861,15 @@ discard block |
||
861 | 861 | try { |
862 | 862 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'"); |
863 | 863 | $sth->execute(); |
864 | - } catch(PDOException $e) { |
|
864 | + } catch (PDOException $e) { |
|
865 | 865 | return "error : ".$e->getMessage(); |
866 | 866 | } |
867 | 867 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
868 | 868 | $query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
869 | 869 | try { |
870 | 870 | $sth2 = $Connection->db->prepare($query2); |
871 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
872 | - } catch(PDOException $e) { |
|
871 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
872 | + } catch (PDOException $e) { |
|
873 | 873 | return "error : ".$e->getMessage(); |
874 | 874 | } |
875 | 875 | } |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | $Connection = new Connection(); |
894 | 894 | $sth = $Connection->db->prepare($query); |
895 | 895 | $sth->execute(array(':source' => 'translation.csv')); |
896 | - } catch(PDOException $e) { |
|
896 | + } catch (PDOException $e) { |
|
897 | 897 | return "error : ".$e->getMessage(); |
898 | 898 | } |
899 | 899 | |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
911 | 911 | { |
912 | 912 | $i++; |
913 | - if($i > 12) { |
|
913 | + if ($i > 12) { |
|
914 | 914 | $data = $row; |
915 | 915 | $operator = $data[2]; |
916 | 916 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | //echo substr($operator, 0, 2)."\n";; |
919 | 919 | if (count($airline_array) > 0) { |
920 | 920 | //print_r($airline_array); |
921 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
921 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
922 | 922 | } |
923 | 923 | } |
924 | 924 | |
@@ -926,14 +926,14 @@ discard block |
||
926 | 926 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
927 | 927 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
928 | 928 | if (count($airline_array) > 0) { |
929 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
929 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
930 | 930 | } |
931 | 931 | } |
932 | 932 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
933 | 933 | try { |
934 | 934 | $sth = $Connection->db->prepare($query); |
935 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
936 | - } catch(PDOException $e) { |
|
935 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
936 | + } catch (PDOException $e) { |
|
937 | 937 | return "error : ".$e->getMessage(); |
938 | 938 | } |
939 | 939 | } |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | $Connection = new Connection(); |
954 | 954 | $sth = $Connection->db->prepare($query); |
955 | 955 | $sth->execute(array(':source' => 'website_fam')); |
956 | - } catch(PDOException $e) { |
|
956 | + } catch (PDOException $e) { |
|
957 | 957 | return "error : ".$e->getMessage(); |
958 | 958 | } |
959 | 959 | |
@@ -973,8 +973,8 @@ discard block |
||
973 | 973 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
974 | 974 | try { |
975 | 975 | $sth = $Connection->db->prepare($query); |
976 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
977 | - } catch(PDOException $e) { |
|
976 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
977 | + } catch (PDOException $e) { |
|
978 | 978 | return "error : ".$e->getMessage(); |
979 | 979 | } |
980 | 980 | } |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | $Connection = new Connection(); |
998 | 998 | $sth = $Connection->db->prepare($query); |
999 | 999 | $sth->execute(array(':source' => 'website_faa')); |
1000 | - } catch(PDOException $e) { |
|
1000 | + } catch (PDOException $e) { |
|
1001 | 1001 | return "error : ".$e->getMessage(); |
1002 | 1002 | } |
1003 | 1003 | |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | $Connection = new Connection(); |
1007 | 1007 | $sth = $Connection->db->prepare($query); |
1008 | 1008 | $sth->execute(array(':source' => 'website_faa')); |
1009 | - } catch(PDOException $e) { |
|
1009 | + } catch (PDOException $e) { |
|
1010 | 1010 | return "error : ".$e->getMessage(); |
1011 | 1011 | } |
1012 | 1012 | |
@@ -1023,8 +1023,8 @@ discard block |
||
1023 | 1023 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
1024 | 1024 | try { |
1025 | 1025 | $sths = $Connection->db->prepare($query_search); |
1026 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
1027 | - } catch(PDOException $e) { |
|
1026 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
1027 | + } catch (PDOException $e) { |
|
1028 | 1028 | return "error s : ".$e->getMessage(); |
1029 | 1029 | } |
1030 | 1030 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1037,8 +1037,8 @@ discard block |
||
1037 | 1037 | //} |
1038 | 1038 | try { |
1039 | 1039 | $sthi = $Connection->db->prepare($queryi); |
1040 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
1041 | - } catch(PDOException $e) { |
|
1040 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
1041 | + } catch (PDOException $e) { |
|
1042 | 1042 | return "error u : ".$e->getMessage(); |
1043 | 1043 | } |
1044 | 1044 | } else { |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | try { |
1047 | 1047 | $sthsm = $Connection->db->prepare($query_search_mfr); |
1048 | 1048 | $sthsm->execute(array(':mfr' => $data[2])); |
1049 | - } catch(PDOException $e) { |
|
1049 | + } catch (PDOException $e) { |
|
1050 | 1050 | return "error mfr : ".$e->getMessage(); |
1051 | 1051 | } |
1052 | 1052 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1056,8 +1056,8 @@ discard block |
||
1056 | 1056 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1057 | 1057 | try { |
1058 | 1058 | $sthf = $Connection->db->prepare($queryf); |
1059 | - $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
1060 | - } catch(PDOException $e) { |
|
1059 | + $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
1060 | + } catch (PDOException $e) { |
|
1061 | 1061 | return "error f : ".$e->getMessage(); |
1062 | 1062 | } |
1063 | 1063 | } |
@@ -1067,13 +1067,13 @@ discard block |
||
1067 | 1067 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1068 | 1068 | try { |
1069 | 1069 | $sth = $Connection->db->prepare($query); |
1070 | - $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
1071 | - } catch(PDOException $e) { |
|
1070 | + $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
1071 | + } catch (PDOException $e) { |
|
1072 | 1072 | return "error i : ".$e->getMessage(); |
1073 | 1073 | } |
1074 | 1074 | } |
1075 | 1075 | } |
1076 | - if ($i % 90 == 0) { |
|
1076 | + if ($i%90 == 0) { |
|
1077 | 1077 | if ($globalTransaction) $Connection->db->commit(); |
1078 | 1078 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1079 | 1079 | } |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | $Connection = new Connection(); |
1093 | 1093 | $sth = $Connection->db->prepare($query); |
1094 | 1094 | $sth->execute(array(':source' => 'website_fam')); |
1095 | - } catch(PDOException $e) { |
|
1095 | + } catch (PDOException $e) { |
|
1096 | 1096 | return "error : ".$e->getMessage(); |
1097 | 1097 | } |
1098 | 1098 | |
@@ -1113,8 +1113,8 @@ discard block |
||
1113 | 1113 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1114 | 1114 | try { |
1115 | 1115 | $sth = $Connection->db->prepare($query); |
1116 | - $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
1117 | - } catch(PDOException $e) { |
|
1116 | + $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
1117 | + } catch (PDOException $e) { |
|
1118 | 1118 | return "error : ".$e->getMessage(); |
1119 | 1119 | } |
1120 | 1120 | } |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | $Connection = new Connection(); |
1134 | 1134 | $sth = $Connection->db->prepare($query); |
1135 | 1135 | $sth->execute(array(':source' => 'website_fam')); |
1136 | - } catch(PDOException $e) { |
|
1136 | + } catch (PDOException $e) { |
|
1137 | 1137 | return "error : ".$e->getMessage(); |
1138 | 1138 | } |
1139 | 1139 | |
@@ -1149,8 +1149,8 @@ discard block |
||
1149 | 1149 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
1150 | 1150 | try { |
1151 | 1151 | $sth = $Connection->db->prepare($query); |
1152 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
1153 | - } catch(PDOException $e) { |
|
1152 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
1153 | + } catch (PDOException $e) { |
|
1154 | 1154 | print_r($data); |
1155 | 1155 | return "error : ".$e->getMessage(); |
1156 | 1156 | } |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | $Connection = new Connection(); |
1171 | 1171 | $sth = $Connection->db->prepare($query); |
1172 | 1172 | $sth->execute(array(':source' => 'website_fam')); |
1173 | - } catch(PDOException $e) { |
|
1173 | + } catch (PDOException $e) { |
|
1174 | 1174 | return "error : ".$e->getMessage(); |
1175 | 1175 | } |
1176 | 1176 | |
@@ -1190,8 +1190,8 @@ discard block |
||
1190 | 1190 | $query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)'; |
1191 | 1191 | try { |
1192 | 1192 | $sth = $Connection->db->prepare($query); |
1193 | - $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
|
1194 | - } catch(PDOException $e) { |
|
1193 | + $sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam')); |
|
1194 | + } catch (PDOException $e) { |
|
1195 | 1195 | return "error : ".$e->getMessage(); |
1196 | 1196 | } |
1197 | 1197 | } |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | $Connection = new Connection(); |
1211 | 1211 | $sth = $Connection->db->prepare($query); |
1212 | 1212 | $sth->execute(); |
1213 | - } catch(PDOException $e) { |
|
1213 | + } catch (PDOException $e) { |
|
1214 | 1214 | return "error : ".$e->getMessage(); |
1215 | 1215 | } |
1216 | 1216 | |
@@ -1231,8 +1231,8 @@ discard block |
||
1231 | 1231 | $query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)'; |
1232 | 1232 | try { |
1233 | 1233 | $sth = $Connection->db->prepare($query); |
1234 | - $sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10])); |
|
1235 | - } catch(PDOException $e) { |
|
1234 | + $sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10])); |
|
1235 | + } catch (PDOException $e) { |
|
1236 | 1236 | return "error : ".$e->getMessage(); |
1237 | 1237 | } |
1238 | 1238 | } |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | $Connection = new Connection(); |
1252 | 1252 | $sth = $Connection->db->prepare($query); |
1253 | 1253 | $sth->execute(); |
1254 | - } catch(PDOException $e) { |
|
1254 | + } catch (PDOException $e) { |
|
1255 | 1255 | return "error : ".$e->getMessage(); |
1256 | 1256 | } |
1257 | 1257 | |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | try { |
1268 | 1268 | $sth = $Connection->db->prepare($query); |
1269 | 1269 | $sth->execute(array(':icao' => $icao)); |
1270 | - } catch(PDOException $e) { |
|
1270 | + } catch (PDOException $e) { |
|
1271 | 1271 | return "error : ".$e->getMessage(); |
1272 | 1272 | } |
1273 | 1273 | } |
@@ -1278,7 +1278,7 @@ discard block |
||
1278 | 1278 | return ''; |
1279 | 1279 | } |
1280 | 1280 | |
1281 | - public static function tle($filename,$tletype) { |
|
1281 | + public static function tle($filename, $tletype) { |
|
1282 | 1282 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1283 | 1283 | global $tmp_dir, $globalTransaction; |
1284 | 1284 | //$Spotter = new Spotter(); |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | $Connection = new Connection(); |
1289 | 1289 | $sth = $Connection->db->prepare($query); |
1290 | 1290 | $sth->execute(array(':source' => $filename)); |
1291 | - } catch(PDOException $e) { |
|
1291 | + } catch (PDOException $e) { |
|
1292 | 1292 | return "error : ".$e->getMessage(); |
1293 | 1293 | } |
1294 | 1294 | |
@@ -1313,8 +1313,8 @@ discard block |
||
1313 | 1313 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
1314 | 1314 | try { |
1315 | 1315 | $sth = $Connection->db->prepare($query); |
1316 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
1317 | - } catch(PDOException $e) { |
|
1316 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
1317 | + } catch (PDOException $e) { |
|
1318 | 1318 | return "error : ".$e->getMessage(); |
1319 | 1319 | } |
1320 | 1320 | |
@@ -1334,28 +1334,28 @@ discard block |
||
1334 | 1334 | */ |
1335 | 1335 | private static function table2array($data) { |
1336 | 1336 | $html = str_get_html($data); |
1337 | - $tabledata=array(); |
|
1338 | - foreach($html->find('tr') as $element) |
|
1337 | + $tabledata = array(); |
|
1338 | + foreach ($html->find('tr') as $element) |
|
1339 | 1339 | { |
1340 | 1340 | $td = array(); |
1341 | - foreach( $element->find('th') as $row) |
|
1341 | + foreach ($element->find('th') as $row) |
|
1342 | 1342 | { |
1343 | 1343 | $td [] = trim($row->plaintext); |
1344 | 1344 | } |
1345 | - $td=array_filter($td); |
|
1345 | + $td = array_filter($td); |
|
1346 | 1346 | $tabledata[] = $td; |
1347 | 1347 | |
1348 | 1348 | $td = array(); |
1349 | 1349 | $tdi = array(); |
1350 | - foreach( $element->find('td') as $row) |
|
1350 | + foreach ($element->find('td') as $row) |
|
1351 | 1351 | { |
1352 | 1352 | $td [] = trim($row->plaintext); |
1353 | 1353 | $tdi [] = trim($row->innertext); |
1354 | 1354 | } |
1355 | - $td=array_filter($td); |
|
1356 | - $tdi=array_filter($tdi); |
|
1355 | + $td = array_filter($td); |
|
1356 | + $tdi = array_filter($tdi); |
|
1357 | 1357 | // $tabledata[]=array_merge($td,$tdi); |
1358 | - $tabledata[]=$td; |
|
1358 | + $tabledata[] = $td; |
|
1359 | 1359 | } |
1360 | 1360 | return(array_filter($tabledata)); |
1361 | 1361 | } |
@@ -1428,13 +1428,13 @@ discard block |
||
1428 | 1428 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1429 | 1429 | { |
1430 | 1430 | $i++; |
1431 | - if($i > 3 && count($row) > 2) { |
|
1431 | + if ($i > 3 && count($row) > 2) { |
|
1432 | 1432 | $data = array_values(array_filter($row)); |
1433 | 1433 | $cntdata = count($data); |
1434 | 1434 | if ($cntdata > 10) { |
1435 | 1435 | $value = $data[9]; |
1436 | 1436 | |
1437 | - for ($i =10;$i < $cntdata;$i++) { |
|
1437 | + for ($i = 10; $i < $cntdata; $i++) { |
|
1438 | 1438 | $value .= ' '.$data[$i]; |
1439 | 1439 | } |
1440 | 1440 | $data[9] = $value; |
@@ -1444,8 +1444,8 @@ discard block |
||
1444 | 1444 | $query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)'; |
1445 | 1445 | try { |
1446 | 1446 | $sth = $Connection->db->prepare($query); |
1447 | - $sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1448 | - } catch(PDOException $e) { |
|
1447 | + $sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1448 | + } catch (PDOException $e) { |
|
1449 | 1449 | return "error : ".$e->getMessage(); |
1450 | 1450 | } |
1451 | 1451 | } |
@@ -1466,7 +1466,7 @@ discard block |
||
1466 | 1466 | $Connection = new Connection(); |
1467 | 1467 | $sth = $Connection->db->prepare($query); |
1468 | 1468 | $sth->execute(); |
1469 | - } catch(PDOException $e) { |
|
1469 | + } catch (PDOException $e) { |
|
1470 | 1470 | return "error : ".$e->getMessage(); |
1471 | 1471 | } |
1472 | 1472 | |
@@ -1478,12 +1478,12 @@ discard block |
||
1478 | 1478 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1479 | 1479 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1480 | 1480 | { |
1481 | - if(count($row) > 1) { |
|
1481 | + if (count($row) > 1) { |
|
1482 | 1482 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1483 | 1483 | try { |
1484 | 1484 | $sth = $Connection->db->prepare($query); |
1485 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1486 | - } catch(PDOException $e) { |
|
1485 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
1486 | + } catch (PDOException $e) { |
|
1487 | 1487 | return "error : ".$e->getMessage(); |
1488 | 1488 | } |
1489 | 1489 | } |
@@ -1503,21 +1503,21 @@ discard block |
||
1503 | 1503 | try { |
1504 | 1504 | $sth = $Connection->db->prepare($query); |
1505 | 1505 | $sth->execute(); |
1506 | - } catch(PDOException $e) { |
|
1506 | + } catch (PDOException $e) { |
|
1507 | 1507 | return "error : ".$e->getMessage(); |
1508 | 1508 | } |
1509 | 1509 | } |
1510 | 1510 | |
1511 | 1511 | |
1512 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1512 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1513 | 1513 | else { |
1514 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1514 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1515 | 1515 | $query = "CREATE EXTENSION postgis"; |
1516 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
1516 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1517 | 1517 | try { |
1518 | 1518 | $sth = $Connection->db->prepare($query); |
1519 | 1519 | $sth->execute(); |
1520 | - } catch(PDOException $e) { |
|
1520 | + } catch (PDOException $e) { |
|
1521 | 1521 | return "error : ".$e->getMessage(); |
1522 | 1522 | } |
1523 | 1523 | } |
@@ -1530,7 +1530,7 @@ discard block |
||
1530 | 1530 | include_once('class.create_db.php'); |
1531 | 1531 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1532 | 1532 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
1533 | - update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
1533 | + update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
1534 | 1534 | $error = ''; |
1535 | 1535 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1536 | 1536 | if ($globalDebug) echo "Gunzip..."; |
@@ -1562,14 +1562,14 @@ discard block |
||
1562 | 1562 | try { |
1563 | 1563 | $sth = $Connection->db->prepare($query); |
1564 | 1564 | $sth->execute(); |
1565 | - } catch(PDOException $e) { |
|
1565 | + } catch (PDOException $e) { |
|
1566 | 1566 | echo "error : ".$e->getMessage(); |
1567 | 1567 | } |
1568 | 1568 | } |
1569 | 1569 | if ($globalDBdriver == 'mysql') { |
1570 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1570 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1571 | 1571 | } else { |
1572 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1572 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1573 | 1573 | } |
1574 | 1574 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
1575 | 1575 | return $error; |
@@ -1582,7 +1582,7 @@ discard block |
||
1582 | 1582 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
1583 | 1583 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
1584 | 1584 | // update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
1585 | - update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
|
1585 | + update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net'); |
|
1586 | 1586 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
1587 | 1587 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
1588 | 1588 | return $error; |
@@ -1602,7 +1602,7 @@ discard block |
||
1602 | 1602 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1603 | 1603 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
1604 | 1604 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1605 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1605 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1606 | 1606 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
1607 | 1607 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
1608 | 1608 | if ($error != '') { |
@@ -1615,7 +1615,7 @@ discard block |
||
1615 | 1615 | global $tmp_dir, $globalDebug; |
1616 | 1616 | $error = ''; |
1617 | 1617 | if ($globalDebug) echo "Routes : Download..."; |
1618 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
1618 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
1619 | 1619 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1620 | 1620 | if ($globalDebug) echo "Gunzip..."; |
1621 | 1621 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1631,7 +1631,7 @@ discard block |
||
1631 | 1631 | global $tmp_dir, $globalDebug; |
1632 | 1632 | $error = ''; |
1633 | 1633 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
1634 | - update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
1634 | + update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
1635 | 1635 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1636 | 1636 | if ($globalDebug) echo "Gunzip..."; |
1637 | 1637 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -1647,7 +1647,7 @@ discard block |
||
1647 | 1647 | global $tmp_dir, $globalDebug; |
1648 | 1648 | $error = ''; |
1649 | 1649 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
1650 | - update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
1650 | + update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
1651 | 1651 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1652 | 1652 | if ($globalDebug) echo "Gunzip..."; |
1653 | 1653 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -1675,7 +1675,7 @@ discard block |
||
1675 | 1675 | */ |
1676 | 1676 | if ($globalDebug) echo "Modes : Download..."; |
1677 | 1677 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
1678 | - update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
1678 | + update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
1679 | 1679 | |
1680 | 1680 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
1681 | 1681 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -1695,7 +1695,7 @@ discard block |
||
1695 | 1695 | public static function update_ModeS_faa() { |
1696 | 1696 | global $tmp_dir, $globalDebug; |
1697 | 1697 | if ($globalDebug) echo "Modes FAA: Download..."; |
1698 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
1698 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
1699 | 1699 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
1700 | 1700 | if ($globalDebug) echo "Unzip..."; |
1701 | 1701 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -1711,7 +1711,7 @@ discard block |
||
1711 | 1711 | public static function update_ModeS_flarm() { |
1712 | 1712 | global $tmp_dir, $globalDebug; |
1713 | 1713 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
1714 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
1714 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
1715 | 1715 | if (file_exists($tmp_dir.'data.fln')) { |
1716 | 1716 | if ($globalDebug) echo "Add to DB..."; |
1717 | 1717 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -1725,7 +1725,7 @@ discard block |
||
1725 | 1725 | public static function update_ModeS_ogn() { |
1726 | 1726 | global $tmp_dir, $globalDebug; |
1727 | 1727 | if ($globalDebug) echo "Modes OGN: Download..."; |
1728 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
1728 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
1729 | 1729 | if (file_exists($tmp_dir.'ogn.csv')) { |
1730 | 1730 | if ($globalDebug) echo "Add to DB..."; |
1731 | 1731 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -1740,201 +1740,201 @@ discard block |
||
1740 | 1740 | global $tmp_dir, $globalDebug, $globalMasterSource; |
1741 | 1741 | |
1742 | 1742 | if ($globalDebug) echo "Owner France: Download..."; |
1743 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
1743 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
1744 | 1744 | if (file_exists($tmp_dir.'owner_f.csv')) { |
1745 | 1745 | if ($globalDebug) echo "Add to DB..."; |
1746 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
1746 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
1747 | 1747 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
1748 | 1748 | if ($error != '') { |
1749 | 1749 | return $error; |
1750 | 1750 | } elseif ($globalDebug) echo "Done\n"; |
1751 | 1751 | |
1752 | 1752 | if ($globalDebug) echo "Owner Ireland: Download..."; |
1753 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
1753 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
1754 | 1754 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
1755 | 1755 | if ($globalDebug) echo "Add to DB..."; |
1756 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
1756 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
1757 | 1757 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
1758 | 1758 | if ($error != '') { |
1759 | 1759 | return $error; |
1760 | 1760 | } elseif ($globalDebug) echo "Done\n"; |
1761 | 1761 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
1762 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
1762 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
1763 | 1763 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
1764 | 1764 | if ($globalDebug) echo "Add to DB..."; |
1765 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
1765 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
1766 | 1766 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
1767 | 1767 | if ($error != '') { |
1768 | 1768 | return $error; |
1769 | 1769 | } elseif ($globalDebug) echo "Done\n"; |
1770 | 1770 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
1771 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
1771 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
1772 | 1772 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
1773 | 1773 | if ($globalDebug) echo "Add to DB..."; |
1774 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
1774 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
1775 | 1775 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
1776 | 1776 | if ($error != '') { |
1777 | 1777 | return $error; |
1778 | 1778 | } elseif ($globalDebug) echo "Done\n"; |
1779 | 1779 | if ($globalDebug) echo "Owner Australia: Download..."; |
1780 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
1780 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
1781 | 1781 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
1782 | 1782 | if ($globalDebug) echo "Add to DB..."; |
1783 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
1783 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
1784 | 1784 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
1785 | 1785 | if ($error != '') { |
1786 | 1786 | return $error; |
1787 | 1787 | } elseif ($globalDebug) echo "Done\n"; |
1788 | 1788 | if ($globalDebug) echo "Owner Austria: Download..."; |
1789 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
1789 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
1790 | 1790 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
1791 | 1791 | if ($globalDebug) echo "Add to DB..."; |
1792 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
1792 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
1793 | 1793 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
1794 | 1794 | if ($error != '') { |
1795 | 1795 | return $error; |
1796 | 1796 | } elseif ($globalDebug) echo "Done\n"; |
1797 | 1797 | if ($globalDebug) echo "Owner Chile: Download..."; |
1798 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
1798 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
1799 | 1799 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
1800 | 1800 | if ($globalDebug) echo "Add to DB..."; |
1801 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
1801 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
1802 | 1802 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
1803 | 1803 | if ($error != '') { |
1804 | 1804 | return $error; |
1805 | 1805 | } elseif ($globalDebug) echo "Done\n"; |
1806 | 1806 | if ($globalDebug) echo "Owner Colombia: Download..."; |
1807 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
1807 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
1808 | 1808 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
1809 | 1809 | if ($globalDebug) echo "Add to DB..."; |
1810 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
1810 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
1811 | 1811 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
1812 | 1812 | if ($error != '') { |
1813 | 1813 | return $error; |
1814 | 1814 | } elseif ($globalDebug) echo "Done\n"; |
1815 | 1815 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
1816 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
1816 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
1817 | 1817 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
1818 | 1818 | if ($globalDebug) echo "Add to DB..."; |
1819 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
1819 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
1820 | 1820 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
1821 | 1821 | if ($error != '') { |
1822 | 1822 | return $error; |
1823 | 1823 | } elseif ($globalDebug) echo "Done\n"; |
1824 | 1824 | if ($globalDebug) echo "Owner Brazil: Download..."; |
1825 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
1825 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
1826 | 1826 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
1827 | 1827 | if ($globalDebug) echo "Add to DB..."; |
1828 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
1828 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
1829 | 1829 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
1830 | 1830 | if ($error != '') { |
1831 | 1831 | return $error; |
1832 | 1832 | } elseif ($globalDebug) echo "Done\n"; |
1833 | 1833 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
1834 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
1834 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
1835 | 1835 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
1836 | 1836 | if ($globalDebug) echo "Add to DB..."; |
1837 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
1837 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
1838 | 1838 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
1839 | 1839 | if ($error != '') { |
1840 | 1840 | return $error; |
1841 | 1841 | } elseif ($globalDebug) echo "Done\n"; |
1842 | 1842 | if ($globalDebug) echo "Owner Croatia: Download..."; |
1843 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
1843 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
1844 | 1844 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
1845 | 1845 | if ($globalDebug) echo "Add to DB..."; |
1846 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
1846 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
1847 | 1847 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
1848 | 1848 | if ($error != '') { |
1849 | 1849 | return $error; |
1850 | 1850 | } elseif ($globalDebug) echo "Done\n"; |
1851 | 1851 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
1852 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
1852 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
1853 | 1853 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
1854 | 1854 | if ($globalDebug) echo "Add to DB..."; |
1855 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
1855 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
1856 | 1856 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
1857 | 1857 | if ($error != '') { |
1858 | 1858 | return $error; |
1859 | 1859 | } elseif ($globalDebug) echo "Done\n"; |
1860 | 1860 | if ($globalDebug) echo "Owner Maldives: Download..."; |
1861 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
1861 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
1862 | 1862 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
1863 | 1863 | if ($globalDebug) echo "Add to DB..."; |
1864 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
1864 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
1865 | 1865 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
1866 | 1866 | if ($error != '') { |
1867 | 1867 | return $error; |
1868 | 1868 | } elseif ($globalDebug) echo "Done\n"; |
1869 | 1869 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
1870 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
1870 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
1871 | 1871 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
1872 | 1872 | if ($globalDebug) echo "Add to DB..."; |
1873 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
1873 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
1874 | 1874 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
1875 | 1875 | if ($error != '') { |
1876 | 1876 | return $error; |
1877 | 1877 | } elseif ($globalDebug) echo "Done\n"; |
1878 | 1878 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
1879 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
1879 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
1880 | 1880 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
1881 | 1881 | if ($globalDebug) echo "Add to DB..."; |
1882 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
1882 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
1883 | 1883 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
1884 | 1884 | if ($error != '') { |
1885 | 1885 | return $error; |
1886 | 1886 | } elseif ($globalDebug) echo "Done\n"; |
1887 | 1887 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
1888 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
1888 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
1889 | 1889 | if (file_exists($tmp_dir.'owner_om.csv')) { |
1890 | 1890 | if ($globalDebug) echo "Add to DB..."; |
1891 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
1891 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
1892 | 1892 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
1893 | 1893 | if ($error != '') { |
1894 | 1894 | return $error; |
1895 | 1895 | } elseif ($globalDebug) echo "Done\n"; |
1896 | 1896 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
1897 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
1897 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
1898 | 1898 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
1899 | 1899 | if ($globalDebug) echo "Add to DB..."; |
1900 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
1900 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
1901 | 1901 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
1902 | 1902 | if ($error != '') { |
1903 | 1903 | return $error; |
1904 | 1904 | } elseif ($globalDebug) echo "Done\n"; |
1905 | 1905 | if ($globalDebug) echo "Owner Iceland: Download..."; |
1906 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
1906 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
1907 | 1907 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
1908 | 1908 | if ($globalDebug) echo "Add to DB..."; |
1909 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
1909 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
1910 | 1910 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
1911 | 1911 | if ($error != '') { |
1912 | 1912 | return $error; |
1913 | 1913 | } elseif ($globalDebug) echo "Done\n"; |
1914 | 1914 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
1915 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
1915 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
1916 | 1916 | if (file_exists($tmp_dir.'owner_m.csv')) { |
1917 | 1917 | if ($globalDebug) echo "Add to DB..."; |
1918 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
1918 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
1919 | 1919 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
1920 | 1920 | if ($error != '') { |
1921 | 1921 | return $error; |
1922 | 1922 | } elseif ($globalDebug) echo "Done\n"; |
1923 | 1923 | if ($globalMasterSource) { |
1924 | 1924 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
1925 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
1925 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
1926 | 1926 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
1927 | 1927 | if ($globalDebug) echo "Add to DB..."; |
1928 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
1928 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
1929 | 1929 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
1930 | 1930 | if ($error != '') { |
1931 | 1931 | return $error; |
1932 | 1932 | } elseif ($globalDebug) echo "Done\n"; |
1933 | 1933 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
1934 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
1934 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
1935 | 1935 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
1936 | 1936 | if ($globalDebug) echo "Add to DB..."; |
1937 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
1937 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
1938 | 1938 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
1939 | 1939 | if ($error != '') { |
1940 | 1940 | return $error; |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | global $tmp_dir, $globalDebug; |
1948 | 1948 | $error = ''; |
1949 | 1949 | if ($globalDebug) echo "Translation : Download..."; |
1950 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
1950 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
1951 | 1951 | if (file_exists($tmp_dir.'translation.zip')) { |
1952 | 1952 | if ($globalDebug) echo "Unzip..."; |
1953 | 1953 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -1963,7 +1963,7 @@ discard block |
||
1963 | 1963 | public static function update_translation_fam() { |
1964 | 1964 | global $tmp_dir, $globalDebug; |
1965 | 1965 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
1966 | - update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
1966 | + update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
1967 | 1967 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
1968 | 1968 | if ($globalDebug) echo "Gunzip..."; |
1969 | 1969 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
@@ -1978,7 +1978,7 @@ discard block |
||
1978 | 1978 | public static function update_ModeS_fam() { |
1979 | 1979 | global $tmp_dir, $globalDebug; |
1980 | 1980 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
1981 | - update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
1981 | + update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
1982 | 1982 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
1983 | 1983 | if ($globalDebug) echo "Gunzip..."; |
1984 | 1984 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
@@ -1994,9 +1994,9 @@ discard block |
||
1994 | 1994 | global $tmp_dir, $globalDebug, $globalOwner; |
1995 | 1995 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
1996 | 1996 | if ($globalOwner === TRUE) { |
1997 | - update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
1997 | + update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
1998 | 1998 | } else { |
1999 | - update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
1999 | + update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2000 | 2000 | } |
2001 | 2001 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
2002 | 2002 | if ($globalDebug) echo "Gunzip..."; |
@@ -2012,7 +2012,7 @@ discard block |
||
2012 | 2012 | public static function update_routes_fam() { |
2013 | 2013 | global $tmp_dir, $globalDebug; |
2014 | 2014 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
2015 | - update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
2015 | + update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
2016 | 2016 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
2017 | 2017 | if ($globalDebug) echo "Gunzip..."; |
2018 | 2018 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
@@ -2026,13 +2026,13 @@ discard block |
||
2026 | 2026 | } |
2027 | 2027 | public static function update_marine_identity_fam() { |
2028 | 2028 | global $tmp_dir, $globalDebug; |
2029 | - update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2029 | + update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2030 | 2030 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
2031 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2031 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2032 | 2032 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2033 | 2033 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2034 | 2034 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
2035 | - update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
2035 | + update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
2036 | 2036 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2037 | 2037 | if ($globalDebug) echo "Gunzip..."; |
2038 | 2038 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
@@ -2052,7 +2052,7 @@ discard block |
||
2052 | 2052 | public static function update_banned_fam() { |
2053 | 2053 | global $tmp_dir, $globalDebug; |
2054 | 2054 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
2055 | - update_db::download('http://data.flightairmap.fr/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
2055 | + update_db::download('http://data.flightairmap.fr/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
|
2056 | 2056 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2057 | 2057 | //if ($globalDebug) echo "Gunzip..."; |
2058 | 2058 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2071,18 +2071,18 @@ discard block |
||
2071 | 2071 | $error = ''; |
2072 | 2072 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
2073 | 2073 | if ($globalDBdriver == 'mysql') { |
2074 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2074 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2075 | 2075 | } else { |
2076 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2076 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2077 | 2077 | } |
2078 | 2078 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
2079 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2079 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2080 | 2080 | $airspace_md5 = $airspace_md5_file[0]; |
2081 | 2081 | if (!update_db::check_airspace_version($airspace_md5)) { |
2082 | 2082 | if ($globalDBdriver == 'mysql') { |
2083 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2083 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2084 | 2084 | } else { |
2085 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2085 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2086 | 2086 | } |
2087 | 2087 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2088 | 2088 | if ($globalDebug) echo "Gunzip..."; |
@@ -2094,7 +2094,7 @@ discard block |
||
2094 | 2094 | try { |
2095 | 2095 | $sth = $Connection->db->prepare($query); |
2096 | 2096 | $sth->execute(); |
2097 | - } catch(PDOException $e) { |
|
2097 | + } catch (PDOException $e) { |
|
2098 | 2098 | return "error : ".$e->getMessage(); |
2099 | 2099 | } |
2100 | 2100 | } |
@@ -2113,15 +2113,15 @@ discard block |
||
2113 | 2113 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2114 | 2114 | $error = ''; |
2115 | 2115 | if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
2116 | - update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2116 | + update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2117 | 2117 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2118 | - $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2118 | + $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2119 | 2119 | $geoid_md5 = $geoid_md5_file[0]; |
2120 | 2120 | if (!update_db::check_geoid_version($geoid_md5)) { |
2121 | - update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2121 | + update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2122 | 2122 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2123 | 2123 | if ($globalDebug) echo "Gunzip..."; |
2124 | - update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2124 | + update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2125 | 2125 | update_db::insert_geoid_version($geoid_md5); |
2126 | 2126 | } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
2127 | 2127 | } |
@@ -2135,15 +2135,15 @@ discard block |
||
2135 | 2135 | public static function update_tle() { |
2136 | 2136 | global $tmp_dir, $globalDebug; |
2137 | 2137 | if ($globalDebug) echo "Download TLE : Download..."; |
2138 | - $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
|
2139 | - 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
|
2140 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
|
2138 | + $alltle = array('stations.txt', 'gps-ops.txt', 'glo-ops.txt', 'galileo.txt', 'weather.txt', 'noaa.txt', 'goes.txt', 'resource.txt', 'dmc.txt', 'tdrss.txt', 'geo.txt', 'intelsat.txt', 'gorizont.txt', |
|
2139 | + 'raduga.txt', 'molniya.txt', 'iridium.txt', 'orbcomm.txt', 'globalstar.txt', 'amateur.txt', 'x-comm.txt', 'other-comm.txt', 'sbas.txt', 'nnss.txt', 'musson.txt', 'science.txt', 'geodetic.txt', |
|
2140 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt'); |
|
2141 | 2141 | foreach ($alltle as $filename) { |
2142 | 2142 | if ($globalDebug) echo "downloading ".$filename.'...'; |
2143 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
2143 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
2144 | 2144 | if (file_exists($tmp_dir.$filename)) { |
2145 | 2145 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
2146 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
2146 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
2147 | 2147 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
2148 | 2148 | if ($error != '') { |
2149 | 2149 | echo $error."\n"; |
@@ -2156,32 +2156,32 @@ discard block |
||
2156 | 2156 | global $tmp_dir, $globalDebug; |
2157 | 2157 | $error = ''; |
2158 | 2158 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
2159 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
2159 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
2160 | 2160 | if (file_exists($tmp_dir.'models.md5sum')) { |
2161 | 2161 | if ($globalDebug) echo "Check files...\n"; |
2162 | 2162 | $newmodelsdb = array(); |
2163 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
2164 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2163 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
2164 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2165 | 2165 | $model = trim($row[2]); |
2166 | 2166 | $newmodelsdb[$model] = trim($row[0]); |
2167 | 2167 | } |
2168 | 2168 | } |
2169 | 2169 | $modelsdb = array(); |
2170 | 2170 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
2171 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
2172 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2171 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
2172 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2173 | 2173 | $model = trim($row[2]); |
2174 | 2174 | $modelsdb[$model] = trim($row[0]); |
2175 | 2175 | } |
2176 | 2176 | } |
2177 | 2177 | } |
2178 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2178 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2179 | 2179 | foreach ($diff as $key => $value) { |
2180 | 2180 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2181 | - update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
2181 | + update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
2182 | 2182 | |
2183 | 2183 | } |
2184 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
2184 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
2185 | 2185 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2186 | 2186 | if ($error != '') { |
2187 | 2187 | return $error; |
@@ -2193,32 +2193,32 @@ discard block |
||
2193 | 2193 | global $tmp_dir, $globalDebug; |
2194 | 2194 | $error = ''; |
2195 | 2195 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
2196 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
2196 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
2197 | 2197 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2198 | 2198 | if ($globalDebug) echo "Check files...\n"; |
2199 | 2199 | $newmodelsdb = array(); |
2200 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
2201 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2200 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
2201 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2202 | 2202 | $model = trim($row[2]); |
2203 | 2203 | $newmodelsdb[$model] = trim($row[0]); |
2204 | 2204 | } |
2205 | 2205 | } |
2206 | 2206 | $modelsdb = array(); |
2207 | 2207 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
2208 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
2209 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2208 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
2209 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2210 | 2210 | $model = trim($row[2]); |
2211 | 2211 | $modelsdb[$model] = trim($row[0]); |
2212 | 2212 | } |
2213 | 2213 | } |
2214 | 2214 | } |
2215 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2215 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2216 | 2216 | foreach ($diff as $key => $value) { |
2217 | 2217 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
2218 | - update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
2218 | + update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
2219 | 2219 | |
2220 | 2220 | } |
2221 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2221 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2222 | 2222 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2223 | 2223 | if ($error != '') { |
2224 | 2224 | return $error; |
@@ -2230,32 +2230,32 @@ discard block |
||
2230 | 2230 | global $tmp_dir, $globalDebug; |
2231 | 2231 | $error = ''; |
2232 | 2232 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
2233 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
2233 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
2234 | 2234 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2235 | 2235 | if ($globalDebug) echo "Check files...\n"; |
2236 | 2236 | $newmodelsdb = array(); |
2237 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
2238 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2237 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2238 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2239 | 2239 | $model = trim($row[2]); |
2240 | 2240 | $newmodelsdb[$model] = trim($row[0]); |
2241 | 2241 | } |
2242 | 2242 | } |
2243 | 2243 | $modelsdb = array(); |
2244 | 2244 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
2245 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
2246 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2245 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2246 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2247 | 2247 | $model = trim($row[2]); |
2248 | 2248 | $modelsdb[$model] = trim($row[0]); |
2249 | 2249 | } |
2250 | 2250 | } |
2251 | 2251 | } |
2252 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2252 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2253 | 2253 | foreach ($diff as $key => $value) { |
2254 | 2254 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
2255 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2255 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2256 | 2256 | |
2257 | 2257 | } |
2258 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2258 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2259 | 2259 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2260 | 2260 | if ($error != '') { |
2261 | 2261 | return $error; |
@@ -2278,8 +2278,8 @@ discard block |
||
2278 | 2278 | */ |
2279 | 2279 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2280 | 2280 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
2281 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2282 | - $result = fread($fh,100000000); |
|
2281 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
2282 | + $result = fread($fh, 100000000); |
|
2283 | 2283 | //echo $result; |
2284 | 2284 | //var_dump(str_get_html($result)); |
2285 | 2285 | //print_r(self::table2array($result)); |
@@ -2297,23 +2297,23 @@ discard block |
||
2297 | 2297 | $Connection = new Connection(); |
2298 | 2298 | $sth = $Connection->db->prepare($query); |
2299 | 2299 | $sth->execute(); |
2300 | - } catch(PDOException $e) { |
|
2300 | + } catch (PDOException $e) { |
|
2301 | 2301 | return "error : ".$e->getMessage(); |
2302 | 2302 | } |
2303 | 2303 | |
2304 | 2304 | $error = ''; |
2305 | 2305 | if ($globalDebug) echo "Notam : Download..."; |
2306 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
2306 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
2307 | 2307 | if (file_exists($tmp_dir.'notam.rss')) { |
2308 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
2308 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
2309 | 2309 | foreach ($notams['channel']['item'] as $notam) { |
2310 | - $title = explode(':',$notam['title']); |
|
2310 | + $title = explode(':', $notam['title']); |
|
2311 | 2311 | $data['ref'] = trim($title[0]); |
2312 | 2312 | unset($title[0]); |
2313 | - $data['title'] = trim(implode(':',$title)); |
|
2314 | - $description = strip_tags($notam['description'],'<pre>'); |
|
2315 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
2316 | - $q = explode('/',$match[1]); |
|
2313 | + $data['title'] = trim(implode(':', $title)); |
|
2314 | + $description = strip_tags($notam['description'], '<pre>'); |
|
2315 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
2316 | + $q = explode('/', $match[1]); |
|
2317 | 2317 | $data['fir'] = $q[0]; |
2318 | 2318 | $data['code'] = $q[1]; |
2319 | 2319 | $ifrvfr = $q[2]; |
@@ -2329,30 +2329,30 @@ discard block |
||
2329 | 2329 | $data['lower_limit'] = $q[5]; |
2330 | 2330 | $data['upper_limit'] = $q[6]; |
2331 | 2331 | $latlonrad = $q[7]; |
2332 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
2333 | - $latitude = $Common->convertDec($las,'latitude'); |
|
2334 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
2332 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
2333 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
2334 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
2335 | 2335 | if ($lac == 'S') $latitude = '-'.$latitude; |
2336 | 2336 | if ($lnc == 'W') $longitude = '-'.$longitude; |
2337 | 2337 | $data['center_latitude'] = $latitude; |
2338 | 2338 | $data['center_longitude'] = $longitude; |
2339 | 2339 | $data['radius'] = intval($radius); |
2340 | 2340 | |
2341 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
2341 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
2342 | 2342 | $data['text'] = $match[1]; |
2343 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
2343 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
2344 | 2344 | $fromto = $match[1]; |
2345 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
2345 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
2346 | 2346 | $fromall = trim($match[1]); |
2347 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
2347 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
2348 | 2348 | $from = trim($match[1]); |
2349 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
2350 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
2349 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
2350 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
2351 | 2351 | $toall = trim($match[1]); |
2352 | - if (!preg_match(':Permanent:',$toall)) { |
|
2353 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
2352 | + if (!preg_match(':Permanent:', $toall)) { |
|
2353 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
2354 | 2354 | $to = trim($match[1]); |
2355 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
2355 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
2356 | 2356 | $data['permanent'] = 0; |
2357 | 2357 | } else { |
2358 | 2358 | $data['date_end'] = NULL; |
@@ -2360,7 +2360,7 @@ discard block |
||
2360 | 2360 | } |
2361 | 2361 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2362 | 2362 | $NOTAM = new NOTAM(); |
2363 | - $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
2363 | + $NOTAM->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['center_latitude'], $data['center_longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
2364 | 2364 | unset($data); |
2365 | 2365 | } |
2366 | 2366 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -2383,16 +2383,16 @@ discard block |
||
2383 | 2383 | $Connection = new Connection(); |
2384 | 2384 | $sth = $Connection->db->prepare($query); |
2385 | 2385 | $sth->execute(); |
2386 | - } catch(PDOException $e) { |
|
2386 | + } catch (PDOException $e) { |
|
2387 | 2387 | return "error : ".$e->getMessage(); |
2388 | 2388 | } |
2389 | 2389 | } |
2390 | 2390 | $Common = new Common(); |
2391 | 2391 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2392 | - $airspace_json = json_decode($airspace_lst,true); |
|
2392 | + $airspace_json = json_decode($airspace_lst, true); |
|
2393 | 2393 | foreach ($airspace_json['records'] as $airspace) { |
2394 | 2394 | if ($globalDebug) echo $airspace['name']."...\n"; |
2395 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
2395 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
2396 | 2396 | if (file_exists($tmp_dir.$airspace['name'])) { |
2397 | 2397 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
2398 | 2398 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -2414,7 +2414,7 @@ discard block |
||
2414 | 2414 | $Connection = new Connection(); |
2415 | 2415 | $sth = $Connection->db->prepare($query); |
2416 | 2416 | $sth->execute(array(':new' => $new, ':old' => $old)); |
2417 | - } catch(PDOException $e) { |
|
2417 | + } catch (PDOException $e) { |
|
2418 | 2418 | return "error : ".$e->getMessage(); |
2419 | 2419 | } |
2420 | 2420 | } |
@@ -2431,7 +2431,7 @@ discard block |
||
2431 | 2431 | $Connection = new Connection(); |
2432 | 2432 | $sth = $Connection->db->prepare($query); |
2433 | 2433 | $sth->execute(); |
2434 | - } catch(PDOException $e) { |
|
2434 | + } catch (PDOException $e) { |
|
2435 | 2435 | return "error : ".$e->getMessage(); |
2436 | 2436 | } |
2437 | 2437 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2446,7 +2446,7 @@ discard block |
||
2446 | 2446 | $Connection = new Connection(); |
2447 | 2447 | $sth = $Connection->db->prepare($query); |
2448 | 2448 | $sth->execute(); |
2449 | - } catch(PDOException $e) { |
|
2449 | + } catch (PDOException $e) { |
|
2450 | 2450 | return "error : ".$e->getMessage(); |
2451 | 2451 | } |
2452 | 2452 | } |
@@ -2457,7 +2457,7 @@ discard block |
||
2457 | 2457 | $Connection = new Connection(); |
2458 | 2458 | $sth = $Connection->db->prepare($query); |
2459 | 2459 | $sth->execute(array(':version' => $version)); |
2460 | - } catch(PDOException $e) { |
|
2460 | + } catch (PDOException $e) { |
|
2461 | 2461 | return "error : ".$e->getMessage(); |
2462 | 2462 | } |
2463 | 2463 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2471,7 +2471,7 @@ discard block |
||
2471 | 2471 | $Connection = new Connection(); |
2472 | 2472 | $sth = $Connection->db->prepare($query); |
2473 | 2473 | $sth->execute(array(':version' => $version)); |
2474 | - } catch(PDOException $e) { |
|
2474 | + } catch (PDOException $e) { |
|
2475 | 2475 | return "error : ".$e->getMessage(); |
2476 | 2476 | } |
2477 | 2477 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2485,7 +2485,7 @@ discard block |
||
2485 | 2485 | $Connection = new Connection(); |
2486 | 2486 | $sth = $Connection->db->prepare($query); |
2487 | 2487 | $sth->execute(array(':version' => $version)); |
2488 | - } catch(PDOException $e) { |
|
2488 | + } catch (PDOException $e) { |
|
2489 | 2489 | return "error : ".$e->getMessage(); |
2490 | 2490 | } |
2491 | 2491 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2501,7 +2501,7 @@ discard block |
||
2501 | 2501 | $Connection = new Connection(); |
2502 | 2502 | $sth = $Connection->db->prepare($query); |
2503 | 2503 | $sth->execute(array(':version' => $version)); |
2504 | - } catch(PDOException $e) { |
|
2504 | + } catch (PDOException $e) { |
|
2505 | 2505 | return "error : ".$e->getMessage(); |
2506 | 2506 | } |
2507 | 2507 | } |
@@ -2513,7 +2513,7 @@ discard block |
||
2513 | 2513 | $Connection = new Connection(); |
2514 | 2514 | $sth = $Connection->db->prepare($query); |
2515 | 2515 | $sth->execute(array(':version' => $version)); |
2516 | - } catch(PDOException $e) { |
|
2516 | + } catch (PDOException $e) { |
|
2517 | 2517 | return "error : ".$e->getMessage(); |
2518 | 2518 | } |
2519 | 2519 | } |
@@ -2525,7 +2525,7 @@ discard block |
||
2525 | 2525 | $Connection = new Connection(); |
2526 | 2526 | $sth = $Connection->db->prepare($query); |
2527 | 2527 | $sth->execute(array(':version' => $version)); |
2528 | - } catch(PDOException $e) { |
|
2528 | + } catch (PDOException $e) { |
|
2529 | 2529 | return "error : ".$e->getMessage(); |
2530 | 2530 | } |
2531 | 2531 | } |
@@ -2541,7 +2541,7 @@ discard block |
||
2541 | 2541 | $Connection = new Connection(); |
2542 | 2542 | $sth = $Connection->db->prepare($query); |
2543 | 2543 | $sth->execute(); |
2544 | - } catch(PDOException $e) { |
|
2544 | + } catch (PDOException $e) { |
|
2545 | 2545 | return "error : ".$e->getMessage(); |
2546 | 2546 | } |
2547 | 2547 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2556,7 +2556,7 @@ discard block |
||
2556 | 2556 | $Connection = new Connection(); |
2557 | 2557 | $sth = $Connection->db->prepare($query); |
2558 | 2558 | $sth->execute(); |
2559 | - } catch(PDOException $e) { |
|
2559 | + } catch (PDOException $e) { |
|
2560 | 2560 | return "error : ".$e->getMessage(); |
2561 | 2561 | } |
2562 | 2562 | } |
@@ -2572,7 +2572,7 @@ discard block |
||
2572 | 2572 | $Connection = new Connection(); |
2573 | 2573 | $sth = $Connection->db->prepare($query); |
2574 | 2574 | $sth->execute(); |
2575 | - } catch(PDOException $e) { |
|
2575 | + } catch (PDOException $e) { |
|
2576 | 2576 | return "error : ".$e->getMessage(); |
2577 | 2577 | } |
2578 | 2578 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2587,7 +2587,7 @@ discard block |
||
2587 | 2587 | $Connection = new Connection(); |
2588 | 2588 | $sth = $Connection->db->prepare($query); |
2589 | 2589 | $sth->execute(); |
2590 | - } catch(PDOException $e) { |
|
2590 | + } catch (PDOException $e) { |
|
2591 | 2591 | return "error : ".$e->getMessage(); |
2592 | 2592 | } |
2593 | 2593 | } |
@@ -2603,7 +2603,7 @@ discard block |
||
2603 | 2603 | $Connection = new Connection(); |
2604 | 2604 | $sth = $Connection->db->prepare($query); |
2605 | 2605 | $sth->execute(); |
2606 | - } catch(PDOException $e) { |
|
2606 | + } catch (PDOException $e) { |
|
2607 | 2607 | return "error : ".$e->getMessage(); |
2608 | 2608 | } |
2609 | 2609 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2618,7 +2618,7 @@ discard block |
||
2618 | 2618 | $Connection = new Connection(); |
2619 | 2619 | $sth = $Connection->db->prepare($query); |
2620 | 2620 | $sth->execute(); |
2621 | - } catch(PDOException $e) { |
|
2621 | + } catch (PDOException $e) { |
|
2622 | 2622 | return "error : ".$e->getMessage(); |
2623 | 2623 | } |
2624 | 2624 | } |
@@ -2634,7 +2634,7 @@ discard block |
||
2634 | 2634 | $Connection = new Connection(); |
2635 | 2635 | $sth = $Connection->db->prepare($query); |
2636 | 2636 | $sth->execute(); |
2637 | - } catch(PDOException $e) { |
|
2637 | + } catch (PDOException $e) { |
|
2638 | 2638 | return "error : ".$e->getMessage(); |
2639 | 2639 | } |
2640 | 2640 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2649,7 +2649,7 @@ discard block |
||
2649 | 2649 | $Connection = new Connection(); |
2650 | 2650 | $sth = $Connection->db->prepare($query); |
2651 | 2651 | $sth->execute(); |
2652 | - } catch(PDOException $e) { |
|
2652 | + } catch (PDOException $e) { |
|
2653 | 2653 | return "error : ".$e->getMessage(); |
2654 | 2654 | } |
2655 | 2655 | } |
@@ -2664,7 +2664,7 @@ discard block |
||
2664 | 2664 | $Connection = new Connection(); |
2665 | 2665 | $sth = $Connection->db->prepare($query); |
2666 | 2666 | $sth->execute(); |
2667 | - } catch(PDOException $e) { |
|
2667 | + } catch (PDOException $e) { |
|
2668 | 2668 | return "error : ".$e->getMessage(); |
2669 | 2669 | } |
2670 | 2670 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2679,7 +2679,7 @@ discard block |
||
2679 | 2679 | $Connection = new Connection(); |
2680 | 2680 | $sth = $Connection->db->prepare($query); |
2681 | 2681 | $sth->execute(); |
2682 | - } catch(PDOException $e) { |
|
2682 | + } catch (PDOException $e) { |
|
2683 | 2683 | return "error : ".$e->getMessage(); |
2684 | 2684 | } |
2685 | 2685 | } |
@@ -2694,7 +2694,7 @@ discard block |
||
2694 | 2694 | $Connection = new Connection(); |
2695 | 2695 | $sth = $Connection->db->prepare($query); |
2696 | 2696 | $sth->execute(); |
2697 | - } catch(PDOException $e) { |
|
2697 | + } catch (PDOException $e) { |
|
2698 | 2698 | return "error : ".$e->getMessage(); |
2699 | 2699 | } |
2700 | 2700 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2709,7 +2709,7 @@ discard block |
||
2709 | 2709 | $Connection = new Connection(); |
2710 | 2710 | $sth = $Connection->db->prepare($query); |
2711 | 2711 | $sth->execute(); |
2712 | - } catch(PDOException $e) { |
|
2712 | + } catch (PDOException $e) { |
|
2713 | 2713 | return "error : ".$e->getMessage(); |
2714 | 2714 | } |
2715 | 2715 | } |
@@ -2724,7 +2724,7 @@ discard block |
||
2724 | 2724 | $Connection = new Connection(); |
2725 | 2725 | $sth = $Connection->db->prepare($query); |
2726 | 2726 | $sth->execute(); |
2727 | - } catch(PDOException $e) { |
|
2727 | + } catch (PDOException $e) { |
|
2728 | 2728 | return "error : ".$e->getMessage(); |
2729 | 2729 | } |
2730 | 2730 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2739,7 +2739,7 @@ discard block |
||
2739 | 2739 | $Connection = new Connection(); |
2740 | 2740 | $sth = $Connection->db->prepare($query); |
2741 | 2741 | $sth->execute(); |
2742 | - } catch(PDOException $e) { |
|
2742 | + } catch (PDOException $e) { |
|
2743 | 2743 | return "error : ".$e->getMessage(); |
2744 | 2744 | } |
2745 | 2745 | } |
@@ -2754,7 +2754,7 @@ discard block |
||
2754 | 2754 | $Connection = new Connection(); |
2755 | 2755 | $sth = $Connection->db->prepare($query); |
2756 | 2756 | $sth->execute(); |
2757 | - } catch(PDOException $e) { |
|
2757 | + } catch (PDOException $e) { |
|
2758 | 2758 | return "error : ".$e->getMessage(); |
2759 | 2759 | } |
2760 | 2760 | } |
@@ -2769,7 +2769,7 @@ discard block |
||
2769 | 2769 | $Connection = new Connection(); |
2770 | 2770 | $sth = $Connection->db->prepare($query); |
2771 | 2771 | $sth->execute(); |
2772 | - } catch(PDOException $e) { |
|
2772 | + } catch (PDOException $e) { |
|
2773 | 2773 | return "error : ".$e->getMessage(); |
2774 | 2774 | } |
2775 | 2775 | } |