Completed
Push — master ( 7fab65...347b49 )
by Yannick
05:33
created
notam-data.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 <button type="button" class="close">&times;</button>
8 8
 <?php
9 9
 
10
-$notamref = filter_input(INPUT_GET,'notam',FILTER_SANITIZE_STRING);
10
+$notamref = filter_input(INPUT_GET, 'notam', FILTER_SANITIZE_STRING);
11 11
 $notamref = urldecode($notamref);
12 12
 $NOTAM = new NOTAM();
13 13
 $notam = $NOTAM->getNOTAMbyRef($notamref);
Please login to merge, or discard this patch.
require/class.NOTAM.php 4 patches
Indentation   +942 added lines, -942 removed lines patch added patch discarded remove patch
@@ -7,964 +7,964 @@
 block discarded – undo
7 7
 class NOTAM {
8 8
 	public $db;
9 9
 	private $abbr = array(
10
-	                    'A/A' => 'Air-to-air',
11
-	                    'A/G' => 'Air-to-ground',
12
-	                    'AAL' => 'Above Aerodrome Level',
13
-	                    'ABM' => 'Abeam',
14
-	                    'ABN' => 'Aerodrome Beacon',
15
-	                    'ABT' => 'About',
16
-	                    'ABV' => 'Above',
17
-	                    'ACC' => 'Area Control',
18
-	                    'ACFT' => 'Aircraft',
19
-	                    'ACK' => 'Acknowledge',
20
-	                    'ACL' => 'Altimeter Check Location',
21
-	                    'ACN' => 'Aircraft Classification Number',
22
-	                    'ACPT' => 'Accepted',
23
-	                    'ACT' => 'Active',
24
-	                    'AD' => 'Aerodrome',
25
-	                    'ADA' => 'Advisory Area',
26
-	                    'ADC' => 'Aerodrome Chart',
27
-	                    'ADDN' => 'Additional',
28
-	                    'ADIZ' => 'Air defense identification zone',
29
-	                    'ADJ' => 'Adjacent',
30
-	                    'ADR' => 'Advisory Route',
31
-	                    'ADS' => 'Automatic Dependent Surveillance',
32
-	                    'ADVS' => 'Advisory Service',
33
-	                    'ADZ' => 'Advised',
34
-	                    'AFIL' => 'Flight Plan Filed In The Air',
35
-	                    'AFIS' => 'Airport flight information service',
36
-	                    'AFM' => 'Affirm',
37
-	                    'AFT' => 'After',
38
-	                    'AGA' => 'Aerodromes, Air Routes and Ground Aids',
39
-	                    'AGN' => 'Again',
40
-	                    'AIS' => 'Aeronautical information service',
41
-	                    'ALERFA' => 'Alert Phase',
42
-	                    'ALRS' => 'Alerting Service',
43
-	                    'ALS' => 'Approach Lighting System',
44
-	                    'ALT' => 'Altitude',
45
-	                    'ALTN' => 'Alternate',
46
-	                    'AMA' => 'Area Minimum Altitude',
47
-	                    'ANC' => 'Aeronautical Chart',
48
-	                    'ANCS' => 'Aeronautical Navigation Chart',
49
-	                    'ANS' => 'Answer',
50
-	                    'AOC' => 'Aerodrome Obstacle Chart',
51
-	                    'AP' => 'Airport',
52
-	                    'APCH' => 'Approach',
53
-	                    'APDC' => 'Aircraft Parking/docking Chart',
54
-	                    'APN' => 'Apron',
55
-	                    'APNS' => 'Aprons',
56
-	                    'APP' => 'Approach Control',
57
-	                    'APR' => 'April',
58
-	                    'APRX' => 'Approximately',
59
-	                    'APSG' => 'After Passing',
60
-	                    'APV' => 'Approved',
61
-	                    'ARC' => 'Area Chart',
62
-	                    'ARNG' => 'Arrange',
63
-	                    'ARO' => 'Air Traffic Services Reporting Office',
64
-	                    'ARP' => 'Aerodrome Reference Point',
65
-	                    'ARR' => 'Arriving',
66
-	                    'ARST' => 'Arresting',
67
-	                    'ASC' => 'Ascend To',
68
-	                    'ASDA' => 'Accelerate-Stop Distance Available',
69
-	                    'ASPEEDG' => 'Airspeed Gain',
70
-	                    'ASPEEDL' => 'Airspeed Loss',
71
-	                    'ASPH' => 'Asphalt',
72
-	                    'ATA' => 'Actual Time of Arrival',
73
-	                    'ATD' => 'Actual Time of Departure',
74
-	                    'ATFM' => 'Air Traffic Flow Management',
75
-	                    'ATIS' => 'Automatic terminal information service',
76
-	                    'ATM' => 'Air Traffic Management',
77
-	                    'ATP' => 'At',
78
-	                    'ATTN' => 'Attention',
79
-	                    'ATZ' => 'Aerodrome Traffic Zone',
80
-	                    'AUG' => 'August',
81
-	                    'AUTH' => 'Authorization',
82
-	                    'AUW' => 'All Up Weight',
83
-	                    'AUX' => 'Auxiliary',
84
-	                    'AVBL' => 'Available',
85
-	                    'AVG' => 'Average',
86
-	                    'AVGAS' => 'Aviation Gasoline',
87
-	                    'AWTA' => 'Advise At What Time Able',
88
-	                    'AWY' => 'Airway',
89
-	                    'AWYS' => 'Airways',
90
-	                    'AZM' => 'Azimuth',
91
-	                    'BA' => 'Braking Action',
92
-	                    'BCN' => 'Beacon',
93
-	                    'BCST' => 'Broadcast',
94
-	                    'BDRY' => 'Boundary',
95
-	                    'BFR' => 'Before',
96
-	                    'BLDG' => 'Building',
97
-	                    'BLO' => 'Below Clouds',
98
-	                    'BLW' => 'Below',
99
-	                    'BRF' => 'Short',
100
-	                    'BRG' => 'Bearing',
101
-	                    'BRKG' => 'Breaking',
102
-	                    'BTL' => 'Between Layers',
103
-	                    'BTN' => 'Between',
104
-	                    'CD' => 'Candela',
105
-	                    'CDN' => 'Coordination',
106
-	                    'CF' => 'Change Frequency To',
107
-	                    'CFM' => 'Confirm',
108
-	                    'CGL' => 'Circling Guidance Light(s)',
109
-	                    'CH' => 'Channel',
110
-	                    'CHG' => 'Changed',
111
-	                    'CIT' => 'Near or Over Large Towns',
112
-	                    'CIV' => 'Civil',
113
-	                    'CK' => 'Check',
114
-	                    'CL' => 'Centre Line',
115
-	                    'CLBR' => 'Calibration',
116
-	                    'CLD' => 'Cloud',
117
-	                    'CLG' => 'Calling',
118
-	                    'CLIMB-OUT' => 'Climb-out Area',
119
-	                    'CLR' => 'Clearance',
120
-	                    'CLRD' => 'Cleared',
121
-	                    'CLSD' => 'Closed',
122
-	                    'CMB' => 'Climb',
123
-	                    'CMPL' => 'Complete',
124
-	                    'CNL' => 'Cancel',
125
-	                    'CNS' => 'Communications, Navigation And Surveillance',
126
-	                    'COM' => 'Communications',
127
-	                    'CONC' => 'Concrete',
128
-	                    'COND' => 'Condition',
129
-	                    'CONS' => 'Continuous',
130
-	                    'CONST' => 'Construction',
131
-	                    'CONT' => 'Continued',
132
-	                    'COOR' => 'Coordination',
133
-	                    'COORD' => 'Coordinates',
134
-	                    'COP' => 'Change-over Point',
135
-	                    'COR' => 'Correction',
136
-	                    'COT' => 'At The Coast',
137
-	                    'COV' => 'Covered',
138
-	                    'CPDLC' => 'Controller-pilot Data Link Communications',
139
-	                    'CPL' => 'Current Flight Plan',
140
-	                    'CRC' => 'Cyclic Redundancy Check',
141
-	                    'CRZ' => 'Cruise',
142
-	                    'CTA' => 'Control area',
143
-	                    'CTAM' => 'Climb To And Maintain',
144
-	                    'CTC' => 'Contact',
145
-	                    'CTL' => 'Control',
146
-	                    'CTN' => 'Caution',
147
-	                    'CTR' => 'Control Zone',
148
-	                    'CVR' => 'Cockpit Voice Recorder',
149
-	                    'CW' => 'Continuous Wave',
150
-	                    'CWY' => 'Clearway',
151
-	                    'DA' => 'Decision Altitude',
152
-	                    'DCKG' => 'Docking',
153
-	                    'DCP' => 'Datum Crossing Point',
154
-	                    'DCPC' => 'Direct Controller-pilot Communications',
155
-	                    'DCT' => 'Direct',
156
-	                    'DEC' => 'December',
157
-	                    'DEG' => 'Degrees',
158
-	                    'DEP' => 'Departing',
159
-	                    'DES' => 'Descend',
160
-	                    'DEST' => 'Destination',
161
-	                    'DETRESFA' => 'Distress Phase',
162
-	                    'DEV' => 'Deviating',
163
-	                    'DFDR' => 'Digital Flight Data Recorder',
164
-	                    'DFTI' => 'Distance From Touchdown Indicator',
165
-	                    'DH' => 'Decision Height',
166
-	                    'DIP' => 'Diffuse',
167
-	                    'DIST' => 'Distance',
168
-	                    'DIV' => 'Divert',
169
-	                    'DLA' => 'Delay',
170
-	                    'DLY' => 'Daily',
171
-	                    'DME' => 'Distance measuring equipment',
172
-	                    'DNG' => 'Dangerous',
173
-	                    'DOM' => 'Domestic',
174
-	                    'DPT' => 'Depth',
175
-	                    'DR' => 'Dead Reckoning',
176
-	                    'DRG' => 'During',
177
-	                    'DTAM' => 'Descend To And Maintain',
178
-	                    'DTG' => 'Date-time Group',
179
-	                    'DTHR' => 'Displaced Runway Threshold',
180
-	                    'DTRT' => 'Deteriorating',
181
-	                    'DTW' => 'Dual Tandem Wheels',
182
-	                    'DUPE' => 'This Is A Duplicate Message',
183
-	                    'DUR' => 'Duration',
184
-	                    'DVOR' => 'Doppler VOR',
185
-	                    'DW' => 'Dual Wheels',
186
-	                    'EAT' => 'Expected Approach Time',
187
-	                    'EB' => 'Eastbound',
188
-	                    'EDA' => 'Elevation Differential Area',
189
-	                    'EET' => 'Estimated Elapsed Time',
190
-	                    'EFC' => 'Expect Further Clearance',
191
-	                    'ELBA' => 'Emergency Location Beacon',
192
-	                    'ELEV' => 'Elevation',
193
-	                    'ELR' => 'Extra Long Range',
194
-	                    'EM' => 'Emission',
195
-	                    'EMERG' => 'Emergency',
196
-	                    'END' => 'Stop-end',
197
-	                    'ENE' => 'East-north-east',
198
-	                    'ENG' => 'Engine',
199
-	                    'ENR' => 'En-route',
200
-	                    'ENRC' => 'En-route Chart',
201
-	                    'EOBT' => 'Estimated Off-block Time',
202
-	                    'EQPT' => 'Equipment',
203
-	                    'ER' => 'Here',
204
-	                    'ESE' => 'East-south-east',
205
-	                    'EST' => 'Estimate',
206
-	                    'ETA' => 'Estimated Time Of Arrival',
207
-	                    'ETD' => 'Estimated Time Of Departure',
208
-	                    'ETO' => 'Estimated Time Over Significant Point',
209
-	                    'EV' => 'Every',
210
-	                    'EXC' => 'Except',
211
-	                    'EXER' => 'Exercise',
212
-	                    'EXP' => 'Expect',
213
-	                    'EXTD' => 'Extend',
214
-	                    'FAC' => 'Facilities',
215
-	                    'FAF' => 'Final Approach Fix',
216
-	                    'FAL' => 'Facilitation of International Airtransport',
217
-	                    'FAP' => 'Final Approach Point',
218
-	                    'FATO' => 'Final Approach And Take-off Area',
219
-	                    'FAX' => 'Fax',
220
-	                    'FBL' => 'Light',
221
-	                    'FCST' => 'Forecast',
222
-	                    'FCT' => 'Friction Coefficient',
223
-	                    'FDPS' => 'Flight Data Processing System',
224
-	                    'FEB' => 'February',
225
-	                    'FIR' => 'Flight information region',
226
-	                    'FIS' => 'Flight information service',
227
-	                    'FLD' => 'Field',
228
-	                    'FLG' => 'Flashing',
229
-	                    'FLR' => 'Flares',
230
-	                    'FLT' => 'Flight',
231
-	                    'FLTS' => 'Flights',
232
-	                    'FLTCK' => 'Flight Check',
233
-	                    'FLUC' => 'Fluctuating',
234
-	                    'FLW' => 'Follow(s)',
235
-	                    'FLY' => 'Fly',
236
-	                    'FM' => 'From',
237
-	                    'FMS' => 'Flight Management System',
238
-	                    'FMU' => 'Flow Management Unit',
239
-	                    'FNA' => 'Final Approach',
240
-	                    'FPAP' => 'Flight Path Alignment Point',
241
-	                    'FPL' => 'Flight Plan',
242
-	                    'FPLS' => 'Flight Plans',
243
-	                    'FPM' => 'Feet Per Minute',
244
-	                    'FPR' => 'Flight Plan Route',
245
-	                    'FR' => 'Fuel Remaining',
246
-	                    'FREQ' => 'Frequency',
247
-	                    'FRI' => 'Friday',
248
-	                    'FRMG' => 'Missile, gun or rocket firing',
249
-	                    'FRNG' => 'Firing',
250
-	                    'FRONT' => 'Front',
251
-	                    'FRQ' => 'Frequent',
252
-	                    'FSL' => 'Full Stop Landing',
253
-	                    'FSS' => 'Flight Service Station',
254
-	                    'FST' => 'First',
255
-	                    'FTP' => 'Fictitious Threshold Point',
256
-	                    'G/A' => 'Ground-to-air',
257
-	                    'G/A/G' => 'Ground-to-air and Air-to-ground',
258
-	                    'GARP' => 'GBAS Azimuth Reference Point',
259
-	                    'GBAS' => 'Ground-based Augmentation System',
260
-	                    'GCAJ' => 'Ground Controlled Approach',
261
-	                    'GCA' => 'Ground Controlled Approach System',
262
-	                    'GEN' => 'General',
263
-	                    'GEO' => 'Geographic or True',
264
-	                    'GES' => 'Ground Earth Station',
265
-	                    'GLD' => 'Glider',
266
-	                    'GMC' => 'Ground Movement Chart',
267
-	                    'GND' => 'Ground',
268
-	                    'GNDCK' => 'Ground Check',
269
-	                    'GP' => 'Glide Path',
270
-	                    'GRASS' => 'Grass landing area',
271
-	                    'GRVL' => 'Gravel',
272
-	                    'GUND' => 'Geoid Undulation',
273
-	                    'H24' => '24 Hours',
274
-	                    'HAPI' => 'Helicopter Approach Path Indicator',
275
-	                    'HBN' => 'Hazard Beacon',
276
-	                    'HDG' => 'Heading',
277
-	                    'HEL' => 'Helicopter',
278
-	                    'HGT' => 'Height',
279
-	                    'HJ' => 'Sunrise to Sunset',
280
-	                    'HLDG' => 'Holding',
281
-	                    'HN' => 'Sunset to Sunrise',
282
-	                    'HO' => 'Service Available To Meet Operational Requirements',
283
-	                    'HOL' => 'Holiday',
284
-	                    'HOSP' => 'Hospital Aircraft',
285
-	                    'HOT' => 'Height',
286
-	                    'HPA' => 'Hectopascal',
287
-	                    'HR' => 'Hours',
288
-	                    'HRS' => 'Hours',
289
-	                    'HS' => 'Service Available During Hours Of Scheduled Operations',
290
-	                    'HURCN' => 'Hurricane',
291
-	                    'HVY' => 'Heavy',
292
-	                    'HX' => 'No Specific Working Hours',
293
-	                    'HYR' => 'Higher',
294
-	                    'IAC' => 'Instrument Approach Chart',
295
-	                    'IAF' => 'Initial Approach Fix',
296
-	                    'IAO' => 'In And Out Of Clouds',
297
-	                    'IAP' => 'Instrument Approach Procedure',
298
-	                    'IAR' => 'Intersection Of Air Routes',
299
-	                    'IBN' => 'Identification Beacon',
300
-	                    'ID' => 'Identifier',
301
-	                    'IDENT' => 'Identification',
302
-	                    'IFF' => 'Identification Friend/Foe',
303
-	                    'IGA' => 'International General Aviation',
304
-	                    'IM' => 'Inner Marker',
305
-	                    'IMPR' => 'Improving',
306
-	                    'IMT' => 'Immediately',
307
-	                    'INA' => 'Initial Approach',
308
-	                    'INBD' => 'Inbound',
309
-	                    'INCERFA' => 'Uncertainty Phase',
310
-	                    'INFO' => 'Information',
311
-	                    'INOP' => 'Inoperative',
312
-	                    'INP' => 'If Not Possible',
313
-	                    'INPR' => 'In Progress',
314
-	                    'INSTL' => 'Installation',
315
-	                    'INSTR' => 'Instrument',
316
-	                    'INT' => 'Intersection',
317
-	                    'INTS' => 'Intersections',
318
-	                    'INTL' => 'International',
319
-	                    'INTRG' => 'Interrogator',
320
-	                    'INTRP' => 'Interruption',
321
-	                    'INTSF' => 'Intensifying',
322
-	                    'INTST' => 'Intensity',
323
-	                    'ISA' => 'International Standard Atmosphere',
324
-	                    'JAN' => 'January',
325
-	                    'JTST' => 'Jet stream',
326
-	                    'JUL' => 'July',
327
-	                    'JUN' => 'June',
328
-	                    'KMH' => 'Kilometres Per Hour',
329
-	                    'KPA' => 'Kilopascal',
330
-	                    'KT' => 'Knots',
331
-	                    'KW' => 'Kilowatts',
332
-	                    'LAN' => 'Inland',
333
-	                    'LAT' => 'Latitude',
334
-	                    'LDA' => 'Landing Distance Available',
335
-	                    'LDAH' => 'Landing Distance Available, Helicopter',
336
-	                    'LDG' => 'Landing',
337
-	                    'LDI' => 'Landing Direction Indicator',
338
-	                    'LEN' => 'Length',
339
-	                    'LGT' => 'Lighting',
340
-	                    'LGTD' => 'Lighted',
341
-	                    'LIH' => 'Light Intensity High',
342
-	                    'LIL' => 'Light Intensity Low',
343
-	                    'LIM' => 'Light Intensity Medium',
344
-	                    'LLZ' => 'Localizer',
345
-	                    'LM' => 'Locator, Middle',
346
-	                    'LMT' => 'Local Mean Time',
347
-	                    'LNG' => 'Long',
348
-	                    'LO' => 'Locator, Outer',
349
-	                    'LOG' => 'Located',
350
-	                    'LONG' => 'Longitude',
351
-	                    'LRG' => 'Long Range',
352
-	                    'LTD' => 'Limited',
353
-	                    'LTP' => 'Landing Threshold Point',
354
-	                    'LVE' => 'Leaving',
355
-	                    'LVL' => 'Level',
356
-	                    'LYR' => 'Layer',
357
-	                    'MAA' => 'Maximum Authorized Altitude',
358
-	                    'MAG' => 'Magnetic',
359
-	                    'MAINT' => 'Maintenance',
360
-	                    'MAP' => 'Aeronautical Maps and Charts',
361
-	                    'MAPT' => 'Missed Approach Point',
362
-	                    'MAR' => 'March',
363
-	                    'MAX' => 'Maximum',
364
-	                    'MAY' => 'May',
365
-	                    'MBST' => 'Microburst',
366
-	                    'MCA' => 'Minimum Crossing Altitude',
367
-	                    'MCW' => 'Modulated Continuous Wave',
368
-	                    'MDA' => 'Minimum Descent Altitude',
369
-	                    'MDH' => 'Minimum Descent Height',
370
-	                    'MEA' => 'Minimum En-route Altitude',
371
-	                    'MEHT' => 'Minimum Eye Height Over Threshold',
372
-	                    'MET' => 'Meteorological',
373
-	                    'MID' => 'Mid-point',
374
-	                    'MIL' => 'Military',
375
-	                    'MIN' => 'Minutes',
376
-	                    'MKR' => 'Marker Radio Beacon',
377
-	                    'MLS' => 'Microwave Landing System',
378
-	                    'MM' => 'Middle Marker',
379
-	                    'MNM' => 'Minimum',
380
-	                    'MNPS' => 'Minimum Navigation Performance Specifications',
381
-	                    'MNT' => 'Monitor',
382
-	                    'MNTN' => 'Maintain',
383
-	                    'MOA' => 'Military Operating Area',
384
-	                    'MOC' => 'Minimum Obstacle Clearance',
385
-	                    'MOD' => 'Moderate',
386
-	                    'MON' => 'Monday',
387
-	                    'MOPS' => 'Minimum Operational Performance Standards',
388
-	                    'MOV' => 'Movement',
389
-	                    'MRA' => 'Minimum Reception Altitude',
390
-	                    'MRG' => 'Medium Range',
391
-	                    'MRP' => 'ATS/MET Reporting Point',
392
-	                    'MS' => 'Minus',
393
-	                    'MSA' => 'Minimum Sector Altitude',
394
-	                    'MSAW' => 'Minimum Safe Altitude Warning',
395
-	                    'MSG' => 'Message',
396
-	                    'MSSR' => 'Monopulse Secondary Surveillance Radar',
397
-	                    'MT' => 'Mountain',
398
-	                    'MTU' => 'Metric Units',
399
-	                    'MTW' => 'Mountain Waves',
400
-	                    'NASC' => 'National AIS System Centre',
401
-	                    'NAT' => 'North Atlantic',
402
-	                    'NAV' => 'Navigation',
403
-	                    'NB' => 'Northbound',
404
-	                    'NBFR' => 'Not Before',
405
-	                    'NE' => 'North-east',
406
-	                    'NEB' => 'North-eastbound',
407
-	                    'NEG' => 'Negative',
408
-	                    'NGT' => 'Night',
409
-	                    'NIL' => 'None',
410
-	                    'NML' => 'Normal',
411
-	                    'NNE' => 'North-north-east',
412
-	                    'NNW' => 'North-north-west',
413
-	                    'NOF' => 'International NOTAM Office',
414
-	                    'NOV' => 'November',
415
-	                    'NOZ' => 'Normal Operating Zone',
416
-	                    'NR' => 'Number',
417
-	                    'NRH' => 'No Reply Heard',
418
-	                    'NTL' => 'National',
419
-	                    'NTZ' => 'No Transgression Zone',
420
-	                    'NW' => 'North-west',
421
-	                    'NWB' => 'North-westbound',
422
-	                    'NXT' => 'Next',
423
-	                    'O/R' => 'On Request',
424
-	                    'OAC' => 'Oceanic Area Control Centre',
425
-	                    'OAS' => 'Obstacle Assessment Surface',
426
-	                    'OBS' => 'Observe',
427
-	                    'OBST' => 'Obstacle',
428
-	                    'OBSTS' => 'Obstacles',
429
-	                    'OCA' => 'Oceanic Control Area',
430
-	                    'OCH' => 'Obstacle Clearance Height',
431
-	                    'OCL' => 'Obstacle Clearance Limit',
432
-	                    'OCS' => 'Obstacle Clearance Surface',
433
-	                    'OCT' => 'October',
434
-	                    'OFZ' => 'Obstacle Free Zone',
435
-	                    'OGN' => 'Originate',
436
-	                    'OHD' => 'Overhead',
437
-	                    'OM' => 'Outer Marker',
438
-	                    'OPC' => 'Control Indicated Is Operational Control',
439
-	                    'OPMET' => 'Operational Meteorological',
440
-	                    'OPN' => 'Open',
441
-	                    'OPR' => 'Operate',
442
-	                    'OPS' => 'Operations',
443
-	                    'ORD' => 'Order',
444
-	                    'OSV' => 'Ocean Station Vessel',
445
-	                    'OTLK' => 'Outlook',
446
-	                    'OTP' => 'On Top',
447
-	                    'OTS' => 'Organized Track System',
448
-	                    'OUBD' => 'Outbound',
449
-	                    'PA' => 'Precision Approach',
450
-	                    'PALS' => 'Precision Approach Lighting System',
451
-	                    'PANS' => 'Procedures for Air Navigation Services',
452
-	                    'PAR' => 'Precision Approach Radar',
453
-	                    'PARL' => 'Parallel',
454
-	                    'PATC' => 'Precision Approach Terrain Chart',
455
-	                    'PAX' => 'Passenger(s)',
456
-	                    'PCD' => 'Proceed',
457
-	                    'PCL' => 'Pilot-controlled Lighting',
458
-	                    'PCN' => 'Pavement Classification Number',
459
-	                    'PDC' => 'Pre-departure Clearance',
460
-	                    'PDG' => 'Procedure Design Gradient',
461
-	                    'PER' => 'Performance',
462
-	                    'PERM' => 'Permanent',
463
-	                    'PIB' => 'Pre-flight Information Bulletin',
464
-	                    'PJE' => 'Parachute Jumping Exercise',
465
-	                    'PLA' => 'Practice Low Approach',
466
-	                    'PLN' => 'Flight Plan',
467
-	                    'PLVL' => 'Present Level',
468
-	                    'PN' => 'Prior Notice Required',
469
-	                    'PNR' => 'Point Of No Return',
470
-	                    'POB' => 'Persons On Board',
471
-	                    'POSS' => 'Possible',
472
-	                    'PPI' => 'Plan Position Indicator',
473
-	                    'PPR' => 'Prior Permission Required',
474
-	                    'PPSN' => 'Present Position',
475
-	                    'PRI' => 'Primary',
476
-	                    'PRKG' => 'Parking',
477
-	                    'PROB' => 'Probability',
478
-	                    'PROC' => 'Procedure',
479
-	                    'PROV' => 'Provisional',
480
-	                    'PS' => 'Plus',
481
-	                    'PSG' => 'Passing',
482
-	                    'PSN' => 'Position',
483
-	                    'PSNS' => 'Positions',
484
-	                    'PSR' => 'Primary Surveillance Radar',
485
-	                    'PSYS' => 'Pressure System(s)',
486
-	                    'PTN' => 'Procedure Turn',
487
-	                    'PTS' => 'Polar Track Structure',
488
-	                    'PWR' => 'Power',
489
-	                    'QUAD' => 'Quadrant',
490
-	                    'RAC' => 'Rules of The Air and Air Traffic Services',
491
-	                    'RAG' => 'Runway Arresting Gear',
492
-	                    'RAI' => 'Runway Alignment Indicator',
493
-	                    'RASC' => 'Regional AIS System Centre',
494
-	                    'RASS' => 'Remote Altimeter Setting Source',
495
-	                    'RB' => 'Rescue Boat',
496
-	                    'RCA' => 'Reach Cruising Altitude',
497
-	                    'RCC' => 'Rescue Coordination Centre',
498
-	                    'RCF' => 'Radiocommunication Failure',
499
-	                    'RCH' => 'Reaching',
500
-	                    'RCL' => 'Runway Centre Line',
501
-	                    'RCLL' => 'Runway Centre Line Light(s)',
502
-	                    'RCLR' => 'Recleared',
503
-	                    'RDH' => 'Reference Datum Height',
504
-	                    'RDL' => 'Radial',
505
-	                    'RDO' => 'Radio',
506
-	                    'RE' => 'Recent',
507
-	                    'REC' => 'Receiver',
508
-	                    'REDL' => 'Runway Edge Light(s)',
509
-	                    'REF' => 'Refer To',
510
-	                    'REG' => 'Registration',
511
-	                    'RENL' => 'Runway End Light(s)',
512
-	                    'REP' => 'Report',
513
-	                    'REQ' => 'Requested',
514
-	                    'RERTE' => 'Re-route',
515
-	                    'RESA' => 'Runway End Safety Area',
516
-	                    'RG' => 'Range (lights)',
517
-	                    'RHC' => 'Right-hand Circuit',
518
-	                    'RIF' => 'Reclearance In Flight',
519
-	                    'RITE' => 'Right',
520
-	                    'RL' => 'Report Leaving',
521
-	                    'RLA' => 'Relay To',
522
-	                    'RLCE' => 'Request Level Change En Route',
523
-	                    'RLLS' => 'Runway Lead-in Lighting System',
524
-	                    'RLNA' => 'Request Level Not Available',
525
-	                    'RMAC' => 'Radar Minimum Altitude Chart',
526
-	                    'RMK' => 'Remark',
527
-	                    'RNG' => 'Radio Range',
528
-	                    'RNP' => 'Required Navigation Performance',
529
-	                    'ROC' => 'Rate Of Climb',
530
-	                    'ROD' => 'Rate Of Descent',
531
-	                    'ROFOR' => 'Route Forecast',
532
-	                    'RON' => 'Receiving Only',
533
-	                    'RPI' => 'Radar Position Indicator',
534
-	                    'RPL' => 'Repetitive Flight Plan',
535
-	                    'RPLC' => 'Replaced',
536
-	                    'RPS' => 'Radar Position Symbol',
537
-	                    'RQMNTS' => 'Requirements',
538
-	                    'RQP' => 'Request Flight Plan',
539
-	                    'RQS' => 'Request Supplementary Flight Plan',
540
-	                    'RR' => 'Report Reaching',
541
-	                    'RSC' => 'Rescue Sub-centre',
542
-	                    'RSCD' => 'Runway Surface Condition',
543
-	                    'RSP' => 'Responder Beacon',
544
-	                    'RSR' => 'En-route Surveillance Radar',
545
-	                    'RTE' => 'Route',
546
-	                    'RTES' => 'Routes',
547
-	                    'RTF' => 'Radiotelephone',
548
-	                    'RTG' => 'Radiotelegraph',
549
-	                    'RTHL' => 'Runway Threshold Light(s)',
550
-	                    'RTN' => 'Return',
551
-	                    'RTODAH' => 'Rejected Take-off Distance Available, Helicopter',
552
-	                    'RTS' => 'Return To Service',
553
-	                    'RTT' => 'Radioteletypewriter',
554
-	                    'RTZL' => 'Runway Touchdown Zone Light(s)',
555
-	                    'RUT' => 'Standard Regional Route Transmitting Frequencies',
556
-	                    'RV' => 'Rescue Vessel',
557
-	                    'RVSM' => 'Reduced Vertical Separation Minimum',
558
-	                    'RWY' => 'Runway',
559
-	                    'RWYS' => 'Runways',
560
-	                    'SALS' => 'Simple Approach Lighting System',
561
-	                    'SAN' => 'Sanitary',
562
-	                    'SAP' => 'As Soon As Possible',
563
-	                    'SAR' => 'Search and Rescue',
564
-	                    'SARPS' => 'Standards and Recommended Practices',
565
-	                    'SAT' => 'Saturday',
566
-	                    'SATCOM' => 'Satellite Communication',
567
-	                    'SB' => 'Southbound',
568
-	                    'SBAS' => 'Satellite-based Augmentation System',
569
-	                    'SDBY' => 'Stand by',
570
-	                    'SE' => 'South-east',
571
-	                    'SEA' => 'Sea',
572
-	                    'SEB' => 'South-eastbound',
573
-	                    'SEC' => 'Seconds',
574
-	                    'SECN' => 'Section',
575
-	                    'SECT' => 'Sector',
576
-	                    'SELCAL' => 'Selective calling system',
577
-	                    'SEP' => 'September',
578
-	                    'SER' => 'Service',
579
-	                    'SEV' => 'Severe',
580
-	                    'SFC' => 'Surface',
581
-	                    'SGL' => 'Signal',
582
-	                    'SID' => 'Standard Instrument Departure',
583
-	                    'SIF' => 'Selective Identification Feature',
584
-	                    'SIG' => 'Significant',
585
-	                    'SIMUL' => 'Simultaneous',
586
-	                    'SKED' => 'Schedule',
587
-	                    'SLP' => 'Speed Limiting Point',
588
-	                    'SLW' => 'Slow',
589
-	                    'SMC' => 'Surface Movement Control',
590
-	                    'SMR' => 'Surface Movement Radar',
591
-	                    'SPL' => 'Supplementary Flight Plan',
592
-	                    'SPOC' => 'SAR Point Of Contact',
593
-	                    'SPOT' => 'Spot Wind',
594
-	                    'SR' => 'Sunrise',
595
-	                    'SRA' => 'Surveillance Radar Approach',
596
-	                    'SRE' => 'Surveillance Radar Element Of Precision Approach Radar System',
597
-	                    'SRG' => 'Short Range',
598
-	                    'SRR' => 'Search and Rescue Region',
599
-	                    'SRY' => 'Secondary',
600
-	                    'SS' => 'Sunset',
601
-	                    'SSE' => 'South-south-east',
602
-	                    'SSR' => 'Secondary Surveillance Radar',
603
-	                    'SST' => 'Supersonic Transport',
604
-	                    'SSW' => 'South-south-west',
605
-	                    'STA' => 'Straight-in Approach',
606
-	                    'STAR' => 'Standard Instrument Arrival',
607
-	                    'STD' => 'Standard',
608
-	                    'STN' => 'Station',
609
-	                    'STNR' => 'Stationary',
610
-	                    'STOL' => 'Short Take-off and Landing',
611
-	                    'STS' => 'Status',
612
-	                    'STWL' => 'Stopway Light(s)',
613
-	                    'SUBJ' => 'Subject To',
614
-	                    'SUN' => 'Sunday',
615
-	                    'SUP' => 'Supplement',
616
-	                    'SUPPS' => 'Regional Supplementary Procedures Service Message',
617
-	                    'SVCBL' => 'Serviceable',
618
-	                    'SW' => 'South-west',
619
-	                    'SWB' => 'South-westbound',
620
-	                    'SWY' => 'Stopway',
621
-	                    'TA' => 'Transition Altitude',
622
-	                    'TAA' => 'Terminal Arrival Altitude',
623
-	                    'TAF' => 'Aerodrome Forecast',
624
-	                    'TAIL' => 'Tail Wind',
625
-	                    'TAR' => 'Terminal Area Surveillance Radar',
626
-	                    'TAX' => 'Taxi',
627
-	                    'TCAC' => 'Tropical Cyclone Advisory Centre',
628
-	                    'TDO' => 'Tornado',
629
-	                    'TDZ' => 'Touchdown Zone',
630
-	                    'TECR' => 'Technical Reason',
631
-	                    'TEMPO' => 'Temporarily',
632
-	                    'TFC' => 'Traffic',
633
-	                    'TGL' => 'Touch-and-go',
634
-	                    'TGS' => 'Taxiing Guidance System',
635
-	                    'THR' => 'Threshold',
636
-	                    'THRU' => 'Through',
637
-	                    'THU' => 'Thursday',
638
-	                    'TIBA' => 'Traffic Information Broadcast By Aircraft',
639
-	                    'TIL' => 'Until',
640
-	                    'TIP' => 'Until Past',
641
-	                    'TKOF' => 'Take-off',
642
-	                    'TL' => 'Till',
643
-	                    'TLOF' => 'Touchdown And Lift-off Area',
644
-	                    'TMA' => 'Terminal Control Area',
645
-	                    'TNA' => 'Turn Altitude',
646
-	                    'TNH' => 'Turn Height',
647
-	                    'TOC' => 'Top of Climb',
648
-	                    'TODA' => 'Take-off Distance Available',
649
-	                    'TODAH' => 'Take-off Distance Available, Helicopter',
650
-	                    'TORA' => 'Take-off Run Available',
651
-	                    'TP' => 'Turning Point',
652
-	                    'TR' => 'Track',
653
-	                    'TRA' => 'Temporary Reserved Airspace',
654
-	                    'TRANS' => 'Transmitter',
655
-	                    'TRL' => 'Transition Level',
656
-	                    'TUE' => 'Tuesday',
657
-	                    'TURB' => 'Turbulence',
658
-	                    'TVOR' => 'Terminal VOR',
659
-	                    'TWR' => 'Tower',
660
-	                    'TWY' => 'Taxiway',
661
-	                    'TWYL' => 'Taxiway-link',
662
-	                    'TXT' => 'Text',
663
-	                    'TYP' => 'Type of Aircraft',
664
-	                    'U/S' => 'Unserviceable',
665
-	                    'UAB' => 'Until Advised By',
666
-	                    'UAC' => 'Upper Area Control Centre',
667
-	                    'UAR' => 'Upper Air Route',
668
-	                    'UDA' => 'Upper advisory area',
669
-	                    'UFN' => 'Until Further Notice',
670
-	                    'UHDT' => 'Unable Higher Due Traffic',
671
-	                    'UIC' => 'Upper Information Centre',
672
-	                    'UIR' => 'Upper Flight Information Region',
673
-	                    'ULR' => 'Ultra Long Range',
674
-	                    'UNA' => 'Unable',
675
-	                    'UNAP' => 'Unable To Approve',
676
-	                    'UNL' => 'Unlimited',
677
-	                    'UNREL' => 'Unreliable',
678
-	                    'UTA' => 'Upper Control Area',
679
-	                    'VAAC' => 'Volcanic Ash Advisory Centre',
680
-	                    'VAC' => 'Visual Approach Chart',
681
-	                    'VAL' => 'In Valleys',
682
-	                    'VAN' => 'Runway Control Van',
683
-	                    'VAR' => 'Visual-aural Radio Range',
684
-	                    'VC' => 'Vicinity',
685
-	                    'VCY' => 'Vicinity',
686
-	                    'VER' => 'Vertical',
687
-	                    'VIS' => 'Visibility',
688
-	                    'VLR' => 'Very Long Range',
689
-	                    'VPA' => 'Vertical Path Angle',
690
-	                    'VRB' => 'Variable',
691
-	                    'VSA' => 'By Visual Reference To The Ground',
692
-	                    'VSP' => 'Vertical Speed',
693
-	                    'VTOL' => 'Vertical Take-off And Landing',
694
-	                    'WAC' => 'World Aeronautical Chart',
695
-	                    'WAFC' => 'World Area Forecast Centre',
696
-	                    'WB' => 'Westbound',
697
-	                    'WBAR' => 'Wing Bar Lights',
698
-	                    'WDI' => 'Wind Direction Indicator',
699
-	                    'WDSPR' => 'Widespread',
700
-	                    'WED' => 'Wednesday',
701
-	                    'WEF' => 'Effective From',
702
-	                    'WI' => 'Within',
703
-	                    'WID' => 'Width',
704
-	                    'WIE' => 'Effective Immediately',
705
-	                    'WILCO' => 'Will Comply',
706
-	                    'WIND' => 'Wind',
707
-	                    'WINTEM' => 'Forecast Upper Wind And Temperature For Aviation',
708
-	                    'WIP' => 'Work In Progress',
709
-	                    'WKN' => 'Weaken',
710
-	                    'WNW' => 'West-north-west',
711
-	                    'WO' => 'Without',
712
-	                    'WPT' => 'Way-point',
713
-	                    'WRNG' => 'Warning',
714
-	                    'WSW' => 'West-south-west',
715
-	                    'WT' => 'Weight',
716
-	                    'WWW' => 'Worldwide Web',
717
-	                    'WX' => 'Weather',
718
-	                    'XBAR' => 'Crossbar',
719
-	                    'XNG' => 'Crossing',
720
-	                    'XS' => 'Atmospherics',
721
-	                    'YCZ' => 'Yellow Caution Zone',
722
-	                    'YR' => 'Your');
10
+						'A/A' => 'Air-to-air',
11
+						'A/G' => 'Air-to-ground',
12
+						'AAL' => 'Above Aerodrome Level',
13
+						'ABM' => 'Abeam',
14
+						'ABN' => 'Aerodrome Beacon',
15
+						'ABT' => 'About',
16
+						'ABV' => 'Above',
17
+						'ACC' => 'Area Control',
18
+						'ACFT' => 'Aircraft',
19
+						'ACK' => 'Acknowledge',
20
+						'ACL' => 'Altimeter Check Location',
21
+						'ACN' => 'Aircraft Classification Number',
22
+						'ACPT' => 'Accepted',
23
+						'ACT' => 'Active',
24
+						'AD' => 'Aerodrome',
25
+						'ADA' => 'Advisory Area',
26
+						'ADC' => 'Aerodrome Chart',
27
+						'ADDN' => 'Additional',
28
+						'ADIZ' => 'Air defense identification zone',
29
+						'ADJ' => 'Adjacent',
30
+						'ADR' => 'Advisory Route',
31
+						'ADS' => 'Automatic Dependent Surveillance',
32
+						'ADVS' => 'Advisory Service',
33
+						'ADZ' => 'Advised',
34
+						'AFIL' => 'Flight Plan Filed In The Air',
35
+						'AFIS' => 'Airport flight information service',
36
+						'AFM' => 'Affirm',
37
+						'AFT' => 'After',
38
+						'AGA' => 'Aerodromes, Air Routes and Ground Aids',
39
+						'AGN' => 'Again',
40
+						'AIS' => 'Aeronautical information service',
41
+						'ALERFA' => 'Alert Phase',
42
+						'ALRS' => 'Alerting Service',
43
+						'ALS' => 'Approach Lighting System',
44
+						'ALT' => 'Altitude',
45
+						'ALTN' => 'Alternate',
46
+						'AMA' => 'Area Minimum Altitude',
47
+						'ANC' => 'Aeronautical Chart',
48
+						'ANCS' => 'Aeronautical Navigation Chart',
49
+						'ANS' => 'Answer',
50
+						'AOC' => 'Aerodrome Obstacle Chart',
51
+						'AP' => 'Airport',
52
+						'APCH' => 'Approach',
53
+						'APDC' => 'Aircraft Parking/docking Chart',
54
+						'APN' => 'Apron',
55
+						'APNS' => 'Aprons',
56
+						'APP' => 'Approach Control',
57
+						'APR' => 'April',
58
+						'APRX' => 'Approximately',
59
+						'APSG' => 'After Passing',
60
+						'APV' => 'Approved',
61
+						'ARC' => 'Area Chart',
62
+						'ARNG' => 'Arrange',
63
+						'ARO' => 'Air Traffic Services Reporting Office',
64
+						'ARP' => 'Aerodrome Reference Point',
65
+						'ARR' => 'Arriving',
66
+						'ARST' => 'Arresting',
67
+						'ASC' => 'Ascend To',
68
+						'ASDA' => 'Accelerate-Stop Distance Available',
69
+						'ASPEEDG' => 'Airspeed Gain',
70
+						'ASPEEDL' => 'Airspeed Loss',
71
+						'ASPH' => 'Asphalt',
72
+						'ATA' => 'Actual Time of Arrival',
73
+						'ATD' => 'Actual Time of Departure',
74
+						'ATFM' => 'Air Traffic Flow Management',
75
+						'ATIS' => 'Automatic terminal information service',
76
+						'ATM' => 'Air Traffic Management',
77
+						'ATP' => 'At',
78
+						'ATTN' => 'Attention',
79
+						'ATZ' => 'Aerodrome Traffic Zone',
80
+						'AUG' => 'August',
81
+						'AUTH' => 'Authorization',
82
+						'AUW' => 'All Up Weight',
83
+						'AUX' => 'Auxiliary',
84
+						'AVBL' => 'Available',
85
+						'AVG' => 'Average',
86
+						'AVGAS' => 'Aviation Gasoline',
87
+						'AWTA' => 'Advise At What Time Able',
88
+						'AWY' => 'Airway',
89
+						'AWYS' => 'Airways',
90
+						'AZM' => 'Azimuth',
91
+						'BA' => 'Braking Action',
92
+						'BCN' => 'Beacon',
93
+						'BCST' => 'Broadcast',
94
+						'BDRY' => 'Boundary',
95
+						'BFR' => 'Before',
96
+						'BLDG' => 'Building',
97
+						'BLO' => 'Below Clouds',
98
+						'BLW' => 'Below',
99
+						'BRF' => 'Short',
100
+						'BRG' => 'Bearing',
101
+						'BRKG' => 'Breaking',
102
+						'BTL' => 'Between Layers',
103
+						'BTN' => 'Between',
104
+						'CD' => 'Candela',
105
+						'CDN' => 'Coordination',
106
+						'CF' => 'Change Frequency To',
107
+						'CFM' => 'Confirm',
108
+						'CGL' => 'Circling Guidance Light(s)',
109
+						'CH' => 'Channel',
110
+						'CHG' => 'Changed',
111
+						'CIT' => 'Near or Over Large Towns',
112
+						'CIV' => 'Civil',
113
+						'CK' => 'Check',
114
+						'CL' => 'Centre Line',
115
+						'CLBR' => 'Calibration',
116
+						'CLD' => 'Cloud',
117
+						'CLG' => 'Calling',
118
+						'CLIMB-OUT' => 'Climb-out Area',
119
+						'CLR' => 'Clearance',
120
+						'CLRD' => 'Cleared',
121
+						'CLSD' => 'Closed',
122
+						'CMB' => 'Climb',
123
+						'CMPL' => 'Complete',
124
+						'CNL' => 'Cancel',
125
+						'CNS' => 'Communications, Navigation And Surveillance',
126
+						'COM' => 'Communications',
127
+						'CONC' => 'Concrete',
128
+						'COND' => 'Condition',
129
+						'CONS' => 'Continuous',
130
+						'CONST' => 'Construction',
131
+						'CONT' => 'Continued',
132
+						'COOR' => 'Coordination',
133
+						'COORD' => 'Coordinates',
134
+						'COP' => 'Change-over Point',
135
+						'COR' => 'Correction',
136
+						'COT' => 'At The Coast',
137
+						'COV' => 'Covered',
138
+						'CPDLC' => 'Controller-pilot Data Link Communications',
139
+						'CPL' => 'Current Flight Plan',
140
+						'CRC' => 'Cyclic Redundancy Check',
141
+						'CRZ' => 'Cruise',
142
+						'CTA' => 'Control area',
143
+						'CTAM' => 'Climb To And Maintain',
144
+						'CTC' => 'Contact',
145
+						'CTL' => 'Control',
146
+						'CTN' => 'Caution',
147
+						'CTR' => 'Control Zone',
148
+						'CVR' => 'Cockpit Voice Recorder',
149
+						'CW' => 'Continuous Wave',
150
+						'CWY' => 'Clearway',
151
+						'DA' => 'Decision Altitude',
152
+						'DCKG' => 'Docking',
153
+						'DCP' => 'Datum Crossing Point',
154
+						'DCPC' => 'Direct Controller-pilot Communications',
155
+						'DCT' => 'Direct',
156
+						'DEC' => 'December',
157
+						'DEG' => 'Degrees',
158
+						'DEP' => 'Departing',
159
+						'DES' => 'Descend',
160
+						'DEST' => 'Destination',
161
+						'DETRESFA' => 'Distress Phase',
162
+						'DEV' => 'Deviating',
163
+						'DFDR' => 'Digital Flight Data Recorder',
164
+						'DFTI' => 'Distance From Touchdown Indicator',
165
+						'DH' => 'Decision Height',
166
+						'DIP' => 'Diffuse',
167
+						'DIST' => 'Distance',
168
+						'DIV' => 'Divert',
169
+						'DLA' => 'Delay',
170
+						'DLY' => 'Daily',
171
+						'DME' => 'Distance measuring equipment',
172
+						'DNG' => 'Dangerous',
173
+						'DOM' => 'Domestic',
174
+						'DPT' => 'Depth',
175
+						'DR' => 'Dead Reckoning',
176
+						'DRG' => 'During',
177
+						'DTAM' => 'Descend To And Maintain',
178
+						'DTG' => 'Date-time Group',
179
+						'DTHR' => 'Displaced Runway Threshold',
180
+						'DTRT' => 'Deteriorating',
181
+						'DTW' => 'Dual Tandem Wheels',
182
+						'DUPE' => 'This Is A Duplicate Message',
183
+						'DUR' => 'Duration',
184
+						'DVOR' => 'Doppler VOR',
185
+						'DW' => 'Dual Wheels',
186
+						'EAT' => 'Expected Approach Time',
187
+						'EB' => 'Eastbound',
188
+						'EDA' => 'Elevation Differential Area',
189
+						'EET' => 'Estimated Elapsed Time',
190
+						'EFC' => 'Expect Further Clearance',
191
+						'ELBA' => 'Emergency Location Beacon',
192
+						'ELEV' => 'Elevation',
193
+						'ELR' => 'Extra Long Range',
194
+						'EM' => 'Emission',
195
+						'EMERG' => 'Emergency',
196
+						'END' => 'Stop-end',
197
+						'ENE' => 'East-north-east',
198
+						'ENG' => 'Engine',
199
+						'ENR' => 'En-route',
200
+						'ENRC' => 'En-route Chart',
201
+						'EOBT' => 'Estimated Off-block Time',
202
+						'EQPT' => 'Equipment',
203
+						'ER' => 'Here',
204
+						'ESE' => 'East-south-east',
205
+						'EST' => 'Estimate',
206
+						'ETA' => 'Estimated Time Of Arrival',
207
+						'ETD' => 'Estimated Time Of Departure',
208
+						'ETO' => 'Estimated Time Over Significant Point',
209
+						'EV' => 'Every',
210
+						'EXC' => 'Except',
211
+						'EXER' => 'Exercise',
212
+						'EXP' => 'Expect',
213
+						'EXTD' => 'Extend',
214
+						'FAC' => 'Facilities',
215
+						'FAF' => 'Final Approach Fix',
216
+						'FAL' => 'Facilitation of International Airtransport',
217
+						'FAP' => 'Final Approach Point',
218
+						'FATO' => 'Final Approach And Take-off Area',
219
+						'FAX' => 'Fax',
220
+						'FBL' => 'Light',
221
+						'FCST' => 'Forecast',
222
+						'FCT' => 'Friction Coefficient',
223
+						'FDPS' => 'Flight Data Processing System',
224
+						'FEB' => 'February',
225
+						'FIR' => 'Flight information region',
226
+						'FIS' => 'Flight information service',
227
+						'FLD' => 'Field',
228
+						'FLG' => 'Flashing',
229
+						'FLR' => 'Flares',
230
+						'FLT' => 'Flight',
231
+						'FLTS' => 'Flights',
232
+						'FLTCK' => 'Flight Check',
233
+						'FLUC' => 'Fluctuating',
234
+						'FLW' => 'Follow(s)',
235
+						'FLY' => 'Fly',
236
+						'FM' => 'From',
237
+						'FMS' => 'Flight Management System',
238
+						'FMU' => 'Flow Management Unit',
239
+						'FNA' => 'Final Approach',
240
+						'FPAP' => 'Flight Path Alignment Point',
241
+						'FPL' => 'Flight Plan',
242
+						'FPLS' => 'Flight Plans',
243
+						'FPM' => 'Feet Per Minute',
244
+						'FPR' => 'Flight Plan Route',
245
+						'FR' => 'Fuel Remaining',
246
+						'FREQ' => 'Frequency',
247
+						'FRI' => 'Friday',
248
+						'FRMG' => 'Missile, gun or rocket firing',
249
+						'FRNG' => 'Firing',
250
+						'FRONT' => 'Front',
251
+						'FRQ' => 'Frequent',
252
+						'FSL' => 'Full Stop Landing',
253
+						'FSS' => 'Flight Service Station',
254
+						'FST' => 'First',
255
+						'FTP' => 'Fictitious Threshold Point',
256
+						'G/A' => 'Ground-to-air',
257
+						'G/A/G' => 'Ground-to-air and Air-to-ground',
258
+						'GARP' => 'GBAS Azimuth Reference Point',
259
+						'GBAS' => 'Ground-based Augmentation System',
260
+						'GCAJ' => 'Ground Controlled Approach',
261
+						'GCA' => 'Ground Controlled Approach System',
262
+						'GEN' => 'General',
263
+						'GEO' => 'Geographic or True',
264
+						'GES' => 'Ground Earth Station',
265
+						'GLD' => 'Glider',
266
+						'GMC' => 'Ground Movement Chart',
267
+						'GND' => 'Ground',
268
+						'GNDCK' => 'Ground Check',
269
+						'GP' => 'Glide Path',
270
+						'GRASS' => 'Grass landing area',
271
+						'GRVL' => 'Gravel',
272
+						'GUND' => 'Geoid Undulation',
273
+						'H24' => '24 Hours',
274
+						'HAPI' => 'Helicopter Approach Path Indicator',
275
+						'HBN' => 'Hazard Beacon',
276
+						'HDG' => 'Heading',
277
+						'HEL' => 'Helicopter',
278
+						'HGT' => 'Height',
279
+						'HJ' => 'Sunrise to Sunset',
280
+						'HLDG' => 'Holding',
281
+						'HN' => 'Sunset to Sunrise',
282
+						'HO' => 'Service Available To Meet Operational Requirements',
283
+						'HOL' => 'Holiday',
284
+						'HOSP' => 'Hospital Aircraft',
285
+						'HOT' => 'Height',
286
+						'HPA' => 'Hectopascal',
287
+						'HR' => 'Hours',
288
+						'HRS' => 'Hours',
289
+						'HS' => 'Service Available During Hours Of Scheduled Operations',
290
+						'HURCN' => 'Hurricane',
291
+						'HVY' => 'Heavy',
292
+						'HX' => 'No Specific Working Hours',
293
+						'HYR' => 'Higher',
294
+						'IAC' => 'Instrument Approach Chart',
295
+						'IAF' => 'Initial Approach Fix',
296
+						'IAO' => 'In And Out Of Clouds',
297
+						'IAP' => 'Instrument Approach Procedure',
298
+						'IAR' => 'Intersection Of Air Routes',
299
+						'IBN' => 'Identification Beacon',
300
+						'ID' => 'Identifier',
301
+						'IDENT' => 'Identification',
302
+						'IFF' => 'Identification Friend/Foe',
303
+						'IGA' => 'International General Aviation',
304
+						'IM' => 'Inner Marker',
305
+						'IMPR' => 'Improving',
306
+						'IMT' => 'Immediately',
307
+						'INA' => 'Initial Approach',
308
+						'INBD' => 'Inbound',
309
+						'INCERFA' => 'Uncertainty Phase',
310
+						'INFO' => 'Information',
311
+						'INOP' => 'Inoperative',
312
+						'INP' => 'If Not Possible',
313
+						'INPR' => 'In Progress',
314
+						'INSTL' => 'Installation',
315
+						'INSTR' => 'Instrument',
316
+						'INT' => 'Intersection',
317
+						'INTS' => 'Intersections',
318
+						'INTL' => 'International',
319
+						'INTRG' => 'Interrogator',
320
+						'INTRP' => 'Interruption',
321
+						'INTSF' => 'Intensifying',
322
+						'INTST' => 'Intensity',
323
+						'ISA' => 'International Standard Atmosphere',
324
+						'JAN' => 'January',
325
+						'JTST' => 'Jet stream',
326
+						'JUL' => 'July',
327
+						'JUN' => 'June',
328
+						'KMH' => 'Kilometres Per Hour',
329
+						'KPA' => 'Kilopascal',
330
+						'KT' => 'Knots',
331
+						'KW' => 'Kilowatts',
332
+						'LAN' => 'Inland',
333
+						'LAT' => 'Latitude',
334
+						'LDA' => 'Landing Distance Available',
335
+						'LDAH' => 'Landing Distance Available, Helicopter',
336
+						'LDG' => 'Landing',
337
+						'LDI' => 'Landing Direction Indicator',
338
+						'LEN' => 'Length',
339
+						'LGT' => 'Lighting',
340
+						'LGTD' => 'Lighted',
341
+						'LIH' => 'Light Intensity High',
342
+						'LIL' => 'Light Intensity Low',
343
+						'LIM' => 'Light Intensity Medium',
344
+						'LLZ' => 'Localizer',
345
+						'LM' => 'Locator, Middle',
346
+						'LMT' => 'Local Mean Time',
347
+						'LNG' => 'Long',
348
+						'LO' => 'Locator, Outer',
349
+						'LOG' => 'Located',
350
+						'LONG' => 'Longitude',
351
+						'LRG' => 'Long Range',
352
+						'LTD' => 'Limited',
353
+						'LTP' => 'Landing Threshold Point',
354
+						'LVE' => 'Leaving',
355
+						'LVL' => 'Level',
356
+						'LYR' => 'Layer',
357
+						'MAA' => 'Maximum Authorized Altitude',
358
+						'MAG' => 'Magnetic',
359
+						'MAINT' => 'Maintenance',
360
+						'MAP' => 'Aeronautical Maps and Charts',
361
+						'MAPT' => 'Missed Approach Point',
362
+						'MAR' => 'March',
363
+						'MAX' => 'Maximum',
364
+						'MAY' => 'May',
365
+						'MBST' => 'Microburst',
366
+						'MCA' => 'Minimum Crossing Altitude',
367
+						'MCW' => 'Modulated Continuous Wave',
368
+						'MDA' => 'Minimum Descent Altitude',
369
+						'MDH' => 'Minimum Descent Height',
370
+						'MEA' => 'Minimum En-route Altitude',
371
+						'MEHT' => 'Minimum Eye Height Over Threshold',
372
+						'MET' => 'Meteorological',
373
+						'MID' => 'Mid-point',
374
+						'MIL' => 'Military',
375
+						'MIN' => 'Minutes',
376
+						'MKR' => 'Marker Radio Beacon',
377
+						'MLS' => 'Microwave Landing System',
378
+						'MM' => 'Middle Marker',
379
+						'MNM' => 'Minimum',
380
+						'MNPS' => 'Minimum Navigation Performance Specifications',
381
+						'MNT' => 'Monitor',
382
+						'MNTN' => 'Maintain',
383
+						'MOA' => 'Military Operating Area',
384
+						'MOC' => 'Minimum Obstacle Clearance',
385
+						'MOD' => 'Moderate',
386
+						'MON' => 'Monday',
387
+						'MOPS' => 'Minimum Operational Performance Standards',
388
+						'MOV' => 'Movement',
389
+						'MRA' => 'Minimum Reception Altitude',
390
+						'MRG' => 'Medium Range',
391
+						'MRP' => 'ATS/MET Reporting Point',
392
+						'MS' => 'Minus',
393
+						'MSA' => 'Minimum Sector Altitude',
394
+						'MSAW' => 'Minimum Safe Altitude Warning',
395
+						'MSG' => 'Message',
396
+						'MSSR' => 'Monopulse Secondary Surveillance Radar',
397
+						'MT' => 'Mountain',
398
+						'MTU' => 'Metric Units',
399
+						'MTW' => 'Mountain Waves',
400
+						'NASC' => 'National AIS System Centre',
401
+						'NAT' => 'North Atlantic',
402
+						'NAV' => 'Navigation',
403
+						'NB' => 'Northbound',
404
+						'NBFR' => 'Not Before',
405
+						'NE' => 'North-east',
406
+						'NEB' => 'North-eastbound',
407
+						'NEG' => 'Negative',
408
+						'NGT' => 'Night',
409
+						'NIL' => 'None',
410
+						'NML' => 'Normal',
411
+						'NNE' => 'North-north-east',
412
+						'NNW' => 'North-north-west',
413
+						'NOF' => 'International NOTAM Office',
414
+						'NOV' => 'November',
415
+						'NOZ' => 'Normal Operating Zone',
416
+						'NR' => 'Number',
417
+						'NRH' => 'No Reply Heard',
418
+						'NTL' => 'National',
419
+						'NTZ' => 'No Transgression Zone',
420
+						'NW' => 'North-west',
421
+						'NWB' => 'North-westbound',
422
+						'NXT' => 'Next',
423
+						'O/R' => 'On Request',
424
+						'OAC' => 'Oceanic Area Control Centre',
425
+						'OAS' => 'Obstacle Assessment Surface',
426
+						'OBS' => 'Observe',
427
+						'OBST' => 'Obstacle',
428
+						'OBSTS' => 'Obstacles',
429
+						'OCA' => 'Oceanic Control Area',
430
+						'OCH' => 'Obstacle Clearance Height',
431
+						'OCL' => 'Obstacle Clearance Limit',
432
+						'OCS' => 'Obstacle Clearance Surface',
433
+						'OCT' => 'October',
434
+						'OFZ' => 'Obstacle Free Zone',
435
+						'OGN' => 'Originate',
436
+						'OHD' => 'Overhead',
437
+						'OM' => 'Outer Marker',
438
+						'OPC' => 'Control Indicated Is Operational Control',
439
+						'OPMET' => 'Operational Meteorological',
440
+						'OPN' => 'Open',
441
+						'OPR' => 'Operate',
442
+						'OPS' => 'Operations',
443
+						'ORD' => 'Order',
444
+						'OSV' => 'Ocean Station Vessel',
445
+						'OTLK' => 'Outlook',
446
+						'OTP' => 'On Top',
447
+						'OTS' => 'Organized Track System',
448
+						'OUBD' => 'Outbound',
449
+						'PA' => 'Precision Approach',
450
+						'PALS' => 'Precision Approach Lighting System',
451
+						'PANS' => 'Procedures for Air Navigation Services',
452
+						'PAR' => 'Precision Approach Radar',
453
+						'PARL' => 'Parallel',
454
+						'PATC' => 'Precision Approach Terrain Chart',
455
+						'PAX' => 'Passenger(s)',
456
+						'PCD' => 'Proceed',
457
+						'PCL' => 'Pilot-controlled Lighting',
458
+						'PCN' => 'Pavement Classification Number',
459
+						'PDC' => 'Pre-departure Clearance',
460
+						'PDG' => 'Procedure Design Gradient',
461
+						'PER' => 'Performance',
462
+						'PERM' => 'Permanent',
463
+						'PIB' => 'Pre-flight Information Bulletin',
464
+						'PJE' => 'Parachute Jumping Exercise',
465
+						'PLA' => 'Practice Low Approach',
466
+						'PLN' => 'Flight Plan',
467
+						'PLVL' => 'Present Level',
468
+						'PN' => 'Prior Notice Required',
469
+						'PNR' => 'Point Of No Return',
470
+						'POB' => 'Persons On Board',
471
+						'POSS' => 'Possible',
472
+						'PPI' => 'Plan Position Indicator',
473
+						'PPR' => 'Prior Permission Required',
474
+						'PPSN' => 'Present Position',
475
+						'PRI' => 'Primary',
476
+						'PRKG' => 'Parking',
477
+						'PROB' => 'Probability',
478
+						'PROC' => 'Procedure',
479
+						'PROV' => 'Provisional',
480
+						'PS' => 'Plus',
481
+						'PSG' => 'Passing',
482
+						'PSN' => 'Position',
483
+						'PSNS' => 'Positions',
484
+						'PSR' => 'Primary Surveillance Radar',
485
+						'PSYS' => 'Pressure System(s)',
486
+						'PTN' => 'Procedure Turn',
487
+						'PTS' => 'Polar Track Structure',
488
+						'PWR' => 'Power',
489
+						'QUAD' => 'Quadrant',
490
+						'RAC' => 'Rules of The Air and Air Traffic Services',
491
+						'RAG' => 'Runway Arresting Gear',
492
+						'RAI' => 'Runway Alignment Indicator',
493
+						'RASC' => 'Regional AIS System Centre',
494
+						'RASS' => 'Remote Altimeter Setting Source',
495
+						'RB' => 'Rescue Boat',
496
+						'RCA' => 'Reach Cruising Altitude',
497
+						'RCC' => 'Rescue Coordination Centre',
498
+						'RCF' => 'Radiocommunication Failure',
499
+						'RCH' => 'Reaching',
500
+						'RCL' => 'Runway Centre Line',
501
+						'RCLL' => 'Runway Centre Line Light(s)',
502
+						'RCLR' => 'Recleared',
503
+						'RDH' => 'Reference Datum Height',
504
+						'RDL' => 'Radial',
505
+						'RDO' => 'Radio',
506
+						'RE' => 'Recent',
507
+						'REC' => 'Receiver',
508
+						'REDL' => 'Runway Edge Light(s)',
509
+						'REF' => 'Refer To',
510
+						'REG' => 'Registration',
511
+						'RENL' => 'Runway End Light(s)',
512
+						'REP' => 'Report',
513
+						'REQ' => 'Requested',
514
+						'RERTE' => 'Re-route',
515
+						'RESA' => 'Runway End Safety Area',
516
+						'RG' => 'Range (lights)',
517
+						'RHC' => 'Right-hand Circuit',
518
+						'RIF' => 'Reclearance In Flight',
519
+						'RITE' => 'Right',
520
+						'RL' => 'Report Leaving',
521
+						'RLA' => 'Relay To',
522
+						'RLCE' => 'Request Level Change En Route',
523
+						'RLLS' => 'Runway Lead-in Lighting System',
524
+						'RLNA' => 'Request Level Not Available',
525
+						'RMAC' => 'Radar Minimum Altitude Chart',
526
+						'RMK' => 'Remark',
527
+						'RNG' => 'Radio Range',
528
+						'RNP' => 'Required Navigation Performance',
529
+						'ROC' => 'Rate Of Climb',
530
+						'ROD' => 'Rate Of Descent',
531
+						'ROFOR' => 'Route Forecast',
532
+						'RON' => 'Receiving Only',
533
+						'RPI' => 'Radar Position Indicator',
534
+						'RPL' => 'Repetitive Flight Plan',
535
+						'RPLC' => 'Replaced',
536
+						'RPS' => 'Radar Position Symbol',
537
+						'RQMNTS' => 'Requirements',
538
+						'RQP' => 'Request Flight Plan',
539
+						'RQS' => 'Request Supplementary Flight Plan',
540
+						'RR' => 'Report Reaching',
541
+						'RSC' => 'Rescue Sub-centre',
542
+						'RSCD' => 'Runway Surface Condition',
543
+						'RSP' => 'Responder Beacon',
544
+						'RSR' => 'En-route Surveillance Radar',
545
+						'RTE' => 'Route',
546
+						'RTES' => 'Routes',
547
+						'RTF' => 'Radiotelephone',
548
+						'RTG' => 'Radiotelegraph',
549
+						'RTHL' => 'Runway Threshold Light(s)',
550
+						'RTN' => 'Return',
551
+						'RTODAH' => 'Rejected Take-off Distance Available, Helicopter',
552
+						'RTS' => 'Return To Service',
553
+						'RTT' => 'Radioteletypewriter',
554
+						'RTZL' => 'Runway Touchdown Zone Light(s)',
555
+						'RUT' => 'Standard Regional Route Transmitting Frequencies',
556
+						'RV' => 'Rescue Vessel',
557
+						'RVSM' => 'Reduced Vertical Separation Minimum',
558
+						'RWY' => 'Runway',
559
+						'RWYS' => 'Runways',
560
+						'SALS' => 'Simple Approach Lighting System',
561
+						'SAN' => 'Sanitary',
562
+						'SAP' => 'As Soon As Possible',
563
+						'SAR' => 'Search and Rescue',
564
+						'SARPS' => 'Standards and Recommended Practices',
565
+						'SAT' => 'Saturday',
566
+						'SATCOM' => 'Satellite Communication',
567
+						'SB' => 'Southbound',
568
+						'SBAS' => 'Satellite-based Augmentation System',
569
+						'SDBY' => 'Stand by',
570
+						'SE' => 'South-east',
571
+						'SEA' => 'Sea',
572
+						'SEB' => 'South-eastbound',
573
+						'SEC' => 'Seconds',
574
+						'SECN' => 'Section',
575
+						'SECT' => 'Sector',
576
+						'SELCAL' => 'Selective calling system',
577
+						'SEP' => 'September',
578
+						'SER' => 'Service',
579
+						'SEV' => 'Severe',
580
+						'SFC' => 'Surface',
581
+						'SGL' => 'Signal',
582
+						'SID' => 'Standard Instrument Departure',
583
+						'SIF' => 'Selective Identification Feature',
584
+						'SIG' => 'Significant',
585
+						'SIMUL' => 'Simultaneous',
586
+						'SKED' => 'Schedule',
587
+						'SLP' => 'Speed Limiting Point',
588
+						'SLW' => 'Slow',
589
+						'SMC' => 'Surface Movement Control',
590
+						'SMR' => 'Surface Movement Radar',
591
+						'SPL' => 'Supplementary Flight Plan',
592
+						'SPOC' => 'SAR Point Of Contact',
593
+						'SPOT' => 'Spot Wind',
594
+						'SR' => 'Sunrise',
595
+						'SRA' => 'Surveillance Radar Approach',
596
+						'SRE' => 'Surveillance Radar Element Of Precision Approach Radar System',
597
+						'SRG' => 'Short Range',
598
+						'SRR' => 'Search and Rescue Region',
599
+						'SRY' => 'Secondary',
600
+						'SS' => 'Sunset',
601
+						'SSE' => 'South-south-east',
602
+						'SSR' => 'Secondary Surveillance Radar',
603
+						'SST' => 'Supersonic Transport',
604
+						'SSW' => 'South-south-west',
605
+						'STA' => 'Straight-in Approach',
606
+						'STAR' => 'Standard Instrument Arrival',
607
+						'STD' => 'Standard',
608
+						'STN' => 'Station',
609
+						'STNR' => 'Stationary',
610
+						'STOL' => 'Short Take-off and Landing',
611
+						'STS' => 'Status',
612
+						'STWL' => 'Stopway Light(s)',
613
+						'SUBJ' => 'Subject To',
614
+						'SUN' => 'Sunday',
615
+						'SUP' => 'Supplement',
616
+						'SUPPS' => 'Regional Supplementary Procedures Service Message',
617
+						'SVCBL' => 'Serviceable',
618
+						'SW' => 'South-west',
619
+						'SWB' => 'South-westbound',
620
+						'SWY' => 'Stopway',
621
+						'TA' => 'Transition Altitude',
622
+						'TAA' => 'Terminal Arrival Altitude',
623
+						'TAF' => 'Aerodrome Forecast',
624
+						'TAIL' => 'Tail Wind',
625
+						'TAR' => 'Terminal Area Surveillance Radar',
626
+						'TAX' => 'Taxi',
627
+						'TCAC' => 'Tropical Cyclone Advisory Centre',
628
+						'TDO' => 'Tornado',
629
+						'TDZ' => 'Touchdown Zone',
630
+						'TECR' => 'Technical Reason',
631
+						'TEMPO' => 'Temporarily',
632
+						'TFC' => 'Traffic',
633
+						'TGL' => 'Touch-and-go',
634
+						'TGS' => 'Taxiing Guidance System',
635
+						'THR' => 'Threshold',
636
+						'THRU' => 'Through',
637
+						'THU' => 'Thursday',
638
+						'TIBA' => 'Traffic Information Broadcast By Aircraft',
639
+						'TIL' => 'Until',
640
+						'TIP' => 'Until Past',
641
+						'TKOF' => 'Take-off',
642
+						'TL' => 'Till',
643
+						'TLOF' => 'Touchdown And Lift-off Area',
644
+						'TMA' => 'Terminal Control Area',
645
+						'TNA' => 'Turn Altitude',
646
+						'TNH' => 'Turn Height',
647
+						'TOC' => 'Top of Climb',
648
+						'TODA' => 'Take-off Distance Available',
649
+						'TODAH' => 'Take-off Distance Available, Helicopter',
650
+						'TORA' => 'Take-off Run Available',
651
+						'TP' => 'Turning Point',
652
+						'TR' => 'Track',
653
+						'TRA' => 'Temporary Reserved Airspace',
654
+						'TRANS' => 'Transmitter',
655
+						'TRL' => 'Transition Level',
656
+						'TUE' => 'Tuesday',
657
+						'TURB' => 'Turbulence',
658
+						'TVOR' => 'Terminal VOR',
659
+						'TWR' => 'Tower',
660
+						'TWY' => 'Taxiway',
661
+						'TWYL' => 'Taxiway-link',
662
+						'TXT' => 'Text',
663
+						'TYP' => 'Type of Aircraft',
664
+						'U/S' => 'Unserviceable',
665
+						'UAB' => 'Until Advised By',
666
+						'UAC' => 'Upper Area Control Centre',
667
+						'UAR' => 'Upper Air Route',
668
+						'UDA' => 'Upper advisory area',
669
+						'UFN' => 'Until Further Notice',
670
+						'UHDT' => 'Unable Higher Due Traffic',
671
+						'UIC' => 'Upper Information Centre',
672
+						'UIR' => 'Upper Flight Information Region',
673
+						'ULR' => 'Ultra Long Range',
674
+						'UNA' => 'Unable',
675
+						'UNAP' => 'Unable To Approve',
676
+						'UNL' => 'Unlimited',
677
+						'UNREL' => 'Unreliable',
678
+						'UTA' => 'Upper Control Area',
679
+						'VAAC' => 'Volcanic Ash Advisory Centre',
680
+						'VAC' => 'Visual Approach Chart',
681
+						'VAL' => 'In Valleys',
682
+						'VAN' => 'Runway Control Van',
683
+						'VAR' => 'Visual-aural Radio Range',
684
+						'VC' => 'Vicinity',
685
+						'VCY' => 'Vicinity',
686
+						'VER' => 'Vertical',
687
+						'VIS' => 'Visibility',
688
+						'VLR' => 'Very Long Range',
689
+						'VPA' => 'Vertical Path Angle',
690
+						'VRB' => 'Variable',
691
+						'VSA' => 'By Visual Reference To The Ground',
692
+						'VSP' => 'Vertical Speed',
693
+						'VTOL' => 'Vertical Take-off And Landing',
694
+						'WAC' => 'World Aeronautical Chart',
695
+						'WAFC' => 'World Area Forecast Centre',
696
+						'WB' => 'Westbound',
697
+						'WBAR' => 'Wing Bar Lights',
698
+						'WDI' => 'Wind Direction Indicator',
699
+						'WDSPR' => 'Widespread',
700
+						'WED' => 'Wednesday',
701
+						'WEF' => 'Effective From',
702
+						'WI' => 'Within',
703
+						'WID' => 'Width',
704
+						'WIE' => 'Effective Immediately',
705
+						'WILCO' => 'Will Comply',
706
+						'WIND' => 'Wind',
707
+						'WINTEM' => 'Forecast Upper Wind And Temperature For Aviation',
708
+						'WIP' => 'Work In Progress',
709
+						'WKN' => 'Weaken',
710
+						'WNW' => 'West-north-west',
711
+						'WO' => 'Without',
712
+						'WPT' => 'Way-point',
713
+						'WRNG' => 'Warning',
714
+						'WSW' => 'West-south-west',
715
+						'WT' => 'Weight',
716
+						'WWW' => 'Worldwide Web',
717
+						'WX' => 'Weather',
718
+						'XBAR' => 'Crossbar',
719
+						'XNG' => 'Crossing',
720
+						'XS' => 'Atmospherics',
721
+						'YCZ' => 'Yellow Caution Zone',
722
+						'YR' => 'Your');
723 723
 	public $code_airspace = array(
724
-			    'AA' => 'Minimum altitude',
725
-			    'AC' => 'Class B, C, D, or E Surface Area',
726
-			    'AD' => 'Air defense identification zone',
727
-			    'AE' => 'Control area',
728
-			    'AF' => 'Flight information region',
729
-			    'AH' => 'Upper control area',
730
-			    'AL' => 'Minimum usable flight level',
731
-			    'AN' => 'Area navigation route',
732
-			    'AO' => 'Oceanic control area',
733
-			    'AP' => 'Reporting point',
734
-			    'AR' => 'ATS route',
735
-			    'AT' => 'Class B Airspace',
736
-			    'AU' => 'Upper flight information region',
737
-			    'AV' => 'Upper advisory area',
738
-			    'AX' => 'Intersection',
739
-			    'AZ' => 'Aerodrome traffic zone');
724
+				'AA' => 'Minimum altitude',
725
+				'AC' => 'Class B, C, D, or E Surface Area',
726
+				'AD' => 'Air defense identification zone',
727
+				'AE' => 'Control area',
728
+				'AF' => 'Flight information region',
729
+				'AH' => 'Upper control area',
730
+				'AL' => 'Minimum usable flight level',
731
+				'AN' => 'Area navigation route',
732
+				'AO' => 'Oceanic control area',
733
+				'AP' => 'Reporting point',
734
+				'AR' => 'ATS route',
735
+				'AT' => 'Class B Airspace',
736
+				'AU' => 'Upper flight information region',
737
+				'AV' => 'Upper advisory area',
738
+				'AX' => 'Intersection',
739
+				'AZ' => 'Aerodrome traffic zone');
740 740
 	public $code_comradar = array(
741
-			    'CA' => 'Air/ground',
742
-			    'CE' => 'En route surveillance radar',
743
-			    'CG' => 'Ground controlled approach system',
744
-			    'CL' => 'Selective calling system',
745
-			    'CM' => 'Surface movement radar',
746
-			    'CP' => 'Precision approach radar',
747
-			    'CR' => 'Surveillance radar element of precision approach radar system',
748
-			    'CS' => 'Secondary surveillance radar',
749
-			    'CT' => 'Terminal area surveillance radar');
741
+				'CA' => 'Air/ground',
742
+				'CE' => 'En route surveillance radar',
743
+				'CG' => 'Ground controlled approach system',
744
+				'CL' => 'Selective calling system',
745
+				'CM' => 'Surface movement radar',
746
+				'CP' => 'Precision approach radar',
747
+				'CR' => 'Surveillance radar element of precision approach radar system',
748
+				'CS' => 'Secondary surveillance radar',
749
+				'CT' => 'Terminal area surveillance radar');
750 750
 	public $code_facilities = array(
751
-			    'FA' => 'airport',
752
-			    'FB' => 'Braking action measurement equipment',
753
-			    'FC' => 'Ceiling measurement equipment',
754
-			    'FD' => 'Docking system',
755
-			    'FF' => 'Fire fighting and rescue',
756
-			    'FG' => 'Ground movement control',
757
-			    'FH' => 'Helicopter alighting area/platform',
758
-			    'FL' => 'Landing direction indicator',
759
-			    'FM' => 'Meteorological service',
760
-			    'FO' => 'Fog dispersal system',
761
-			    'FP' => 'Heliport',
762
-			    'FS' => 'Snow removal equipment',
763
-			    'FT' => 'Transmissometer',
764
-			    'FU' => 'Fuel availability',
765
-			    'FW' => 'Wind direction indicator',
766
-			    'FZ' => 'Customs');
751
+				'FA' => 'airport',
752
+				'FB' => 'Braking action measurement equipment',
753
+				'FC' => 'Ceiling measurement equipment',
754
+				'FD' => 'Docking system',
755
+				'FF' => 'Fire fighting and rescue',
756
+				'FG' => 'Ground movement control',
757
+				'FH' => 'Helicopter alighting area/platform',
758
+				'FL' => 'Landing direction indicator',
759
+				'FM' => 'Meteorological service',
760
+				'FO' => 'Fog dispersal system',
761
+				'FP' => 'Heliport',
762
+				'FS' => 'Snow removal equipment',
763
+				'FT' => 'Transmissometer',
764
+				'FU' => 'Fuel availability',
765
+				'FW' => 'Wind direction indicator',
766
+				'FZ' => 'Customs');
767 767
 	public $code_instrumentlanding = array(
768
-			    'ID' => 'DME associated with ILS',
769
-			    'IG' => 'Glide path',
770
-			    'II' => 'Inner marker',
771
-			    'IL' => 'Localizer',
772
-			    'IM' => 'Middle marker',
773
-			    'IO' => 'Outer marker',
774
-			    'IS' => 'ILS Category I',
775
-			    'IT' => 'ILS Category II',
776
-			    'IU' => 'ILS Category III',
777
-			    'IW' => 'Microwave landing system',
778
-			    'IX' => 'Locator, outer',
779
-			    'IY' => 'Locator, middle');
768
+				'ID' => 'DME associated with ILS',
769
+				'IG' => 'Glide path',
770
+				'II' => 'Inner marker',
771
+				'IL' => 'Localizer',
772
+				'IM' => 'Middle marker',
773
+				'IO' => 'Outer marker',
774
+				'IS' => 'ILS Category I',
775
+				'IT' => 'ILS Category II',
776
+				'IU' => 'ILS Category III',
777
+				'IW' => 'Microwave landing system',
778
+				'IX' => 'Locator, outer',
779
+				'IY' => 'Locator, middle');
780 780
 	public $code_lightingfacilities = array(
781
-			    'LA' => 'Approach lighting system',
782
-			    'LB' => 'Airport beacon',
783
-			    'LC' => 'Runway center line lights',
784
-			    'LD' => 'Landing direction indicator lights',
785
-			    'LE' => 'Runway edge lights',
786
-			    'LF' => 'Sequenced flashing lights',
787
-			    'LH' => 'High intensity runway lights',
788
-			    'LI' => 'Runway end identifier lights',
789
-			    'LK' => 'Category II components of approach lighting system',
790
-			    'LL' => 'Low intensity runway lights',
791
-			    'LM' => 'Medium intensity runway lights',
792
-			    'LP' => 'Precision approach path indicator',
793
-			    'LR' => 'All landing area lighting facilities',
794
-			    'LS' => 'Stopway lights',
795
-			    'LT' => 'Threshold lights',
796
-			    'LV' => 'Visual approach slope indicator system',
797
-			    'LW' => 'Heliport lighting',
798
-			    'LX' => 'Taxiway center line lights',
799
-			    'LY' => 'Taxiway edge lights',
800
-			    'LZ' => 'Runway touchdown zone lights');
781
+				'LA' => 'Approach lighting system',
782
+				'LB' => 'Airport beacon',
783
+				'LC' => 'Runway center line lights',
784
+				'LD' => 'Landing direction indicator lights',
785
+				'LE' => 'Runway edge lights',
786
+				'LF' => 'Sequenced flashing lights',
787
+				'LH' => 'High intensity runway lights',
788
+				'LI' => 'Runway end identifier lights',
789
+				'LK' => 'Category II components of approach lighting system',
790
+				'LL' => 'Low intensity runway lights',
791
+				'LM' => 'Medium intensity runway lights',
792
+				'LP' => 'Precision approach path indicator',
793
+				'LR' => 'All landing area lighting facilities',
794
+				'LS' => 'Stopway lights',
795
+				'LT' => 'Threshold lights',
796
+				'LV' => 'Visual approach slope indicator system',
797
+				'LW' => 'Heliport lighting',
798
+				'LX' => 'Taxiway center line lights',
799
+				'LY' => 'Taxiway edge lights',
800
+				'LZ' => 'Runway touchdown zone lights');
801 801
 	public $code_movementareas = array(
802
-			    'MA' => 'Movement area',
803
-			    'MB' => 'Bearing strength',
804
-			    'MC' => 'Clearway',
805
-			    'MD' => 'Declared distances',
806
-			    'MG' => 'Taxiing guidance system',
807
-			    'MH' => 'Runway arresting gear',
808
-			    'MK' => 'Parking area',
809
-			    'MM' => 'Daylight markings',
810
-			    'MN' => 'Apron',
811
-			    'MP' => 'Aircraft stands',
812
-			    'MR' => 'Runway',
813
-			    'MS' => 'Stopway',
814
-			    'MT' => 'Threshold',
815
-			    'MU' => 'Runway turning bay',
816
-			    'MW' => 'Strip',
817
-			    'MX' => 'Taxiway');
802
+				'MA' => 'Movement area',
803
+				'MB' => 'Bearing strength',
804
+				'MC' => 'Clearway',
805
+				'MD' => 'Declared distances',
806
+				'MG' => 'Taxiing guidance system',
807
+				'MH' => 'Runway arresting gear',
808
+				'MK' => 'Parking area',
809
+				'MM' => 'Daylight markings',
810
+				'MN' => 'Apron',
811
+				'MP' => 'Aircraft stands',
812
+				'MR' => 'Runway',
813
+				'MS' => 'Stopway',
814
+				'MT' => 'Threshold',
815
+				'MU' => 'Runway turning bay',
816
+				'MW' => 'Strip',
817
+				'MX' => 'Taxiway');
818 818
 	public $code_terminalfacilities = array(
819
-			    'NA' => 'All radio navigation facilities',
820
-			    'NB' => 'Non directional beacon',
821
-			    'NC' => 'DECCA',
822
-			    'ND' => 'Distance measuring equipment',
823
-			    'NF' => 'Fan marker',
824
-			    'NL' => 'Locator',
825
-			    'NM' => 'VOR/DME',
826
-			    'NN' => 'TACAN',
827
-			    'NO' => 'OMEGA',
828
-			    'NT' => 'VORTAC',
829
-			    'NV' => 'VOR',
830
-			    'NX' => 'Direction finding station');
819
+				'NA' => 'All radio navigation facilities',
820
+				'NB' => 'Non directional beacon',
821
+				'NC' => 'DECCA',
822
+				'ND' => 'Distance measuring equipment',
823
+				'NF' => 'Fan marker',
824
+				'NL' => 'Locator',
825
+				'NM' => 'VOR/DME',
826
+				'NN' => 'TACAN',
827
+				'NO' => 'OMEGA',
828
+				'NT' => 'VORTAC',
829
+				'NV' => 'VOR',
830
+				'NX' => 'Direction finding station');
831 831
 	public $code_information = array(
832
-			    'OA' => 'Aeronautical information service',
833
-			    'OB' => 'Obstacle',
834
-			    'OE' => 'Aircraft entry requirements',
835
-			    'OL' => 'Obstacle lights on',
836
-			    'OR' => 'Rescue coordination centre');
832
+				'OA' => 'Aeronautical information service',
833
+				'OB' => 'Obstacle',
834
+				'OE' => 'Aircraft entry requirements',
835
+				'OL' => 'Obstacle lights on',
836
+				'OR' => 'Rescue coordination centre');
837 837
 	public $code_airtraffic = array(
838
-			    'PA' => 'Standard instrument arrival',
839
-			    'PD' => 'Standard instrument departure',
840
-			    'PF' => 'Flow control procedure',
841
-			    'PH' => 'Holding procedure',
842
-			    'PI' => 'Instrument approach procedure',
843
-			    'PL' => 'Obstacle clearance limit',
844
-			    'PM' => 'Aerodrome operating minima',
845
-			    'PO' => 'Obstacle clearance altitude',
846
-			    'PP' => 'Obstacle clearance height',
847
-			    'PR' => 'Radio failure procedure',
848
-			    'PT' => 'Transition altitude',
849
-			    'PU' => 'Missed approach procedure',
850
-			    'PX' => 'Minimum holding altitude',
851
-			    'PZ' => 'ADIZ procedure');
838
+				'PA' => 'Standard instrument arrival',
839
+				'PD' => 'Standard instrument departure',
840
+				'PF' => 'Flow control procedure',
841
+				'PH' => 'Holding procedure',
842
+				'PI' => 'Instrument approach procedure',
843
+				'PL' => 'Obstacle clearance limit',
844
+				'PM' => 'Aerodrome operating minima',
845
+				'PO' => 'Obstacle clearance altitude',
846
+				'PP' => 'Obstacle clearance height',
847
+				'PR' => 'Radio failure procedure',
848
+				'PT' => 'Transition altitude',
849
+				'PU' => 'Missed approach procedure',
850
+				'PX' => 'Minimum holding altitude',
851
+				'PZ' => 'ADIZ procedure');
852 852
 	public $code_navigationw = array(
853
-			    'RA' => 'Airspace reservation',
854
-			    'RD' => 'Danger area',
855
-			    'RO' => 'Overflying of',
856
-			    'RP' => 'Prohibited area',
857
-			    'RR' => 'Restricted area',
858
-			    'RT' => 'Temporary restricted area');
853
+				'RA' => 'Airspace reservation',
854
+				'RD' => 'Danger area',
855
+				'RO' => 'Overflying of',
856
+				'RP' => 'Prohibited area',
857
+				'RR' => 'Restricted area',
858
+				'RT' => 'Temporary restricted area');
859 859
 	public $code_volmet = array(
860
-			    'SA' => 'Automatic terminal information service',
861
-			    'SB' => 'ATS reporting office',
862
-			    'SC' => 'Area control center',
863
-			    'SE' => 'Flight information service',
864
-			    'SF' => 'Airport flight information service',
865
-			    'SL' => 'Flow control centre',
866
-			    'SO' => 'Oceanic area control centre',
867
-			    'SP' => 'Approach control service',
868
-			    'SS' => 'Flight service station',
869
-			    'ST' => 'Airport control tower',
870
-			    'SU' => 'Upper area control centre',
871
-			    'SV' => 'VOLMET broadcast',
872
-			    'SY' => 'Upper advisory service');
860
+				'SA' => 'Automatic terminal information service',
861
+				'SB' => 'ATS reporting office',
862
+				'SC' => 'Area control center',
863
+				'SE' => 'Flight information service',
864
+				'SF' => 'Airport flight information service',
865
+				'SL' => 'Flow control centre',
866
+				'SO' => 'Oceanic area control centre',
867
+				'SP' => 'Approach control service',
868
+				'SS' => 'Flight service station',
869
+				'ST' => 'Airport control tower',
870
+				'SU' => 'Upper area control centre',
871
+				'SV' => 'VOLMET broadcast',
872
+				'SY' => 'Upper advisory service');
873 873
 	public $code_warnings = array(
874
-			    'WA' => 'Air display',
875
-			    'WB' => 'Aerobatics',
876
-			    'WC' => 'Captive balloon or kite',
877
-			    'WD' => 'Demolition of explosives',
878
-			    'WE' => 'Exercises',
879
-			    'WF' => 'Air refueling',
880
-			    'WG' => 'Glider flying',
881
-			    'WJ' => 'Banner/target towing',
882
-			    'WL' => 'Ascent of free balloon',
883
-			    'WM' => 'Missile, gun or rocket firing',
884
-			    'WP' => 'Parachute jumping exercise',
885
-			    'WS' => 'Burning or blowing gas',
886
-			    'WT' => 'Mass movement of aircraft',
887
-			    'WV' => 'Formation flight',
888
-			    'WZ' => 'model flying');
874
+				'WA' => 'Air display',
875
+				'WB' => 'Aerobatics',
876
+				'WC' => 'Captive balloon or kite',
877
+				'WD' => 'Demolition of explosives',
878
+				'WE' => 'Exercises',
879
+				'WF' => 'Air refueling',
880
+				'WG' => 'Glider flying',
881
+				'WJ' => 'Banner/target towing',
882
+				'WL' => 'Ascent of free balloon',
883
+				'WM' => 'Missile, gun or rocket firing',
884
+				'WP' => 'Parachute jumping exercise',
885
+				'WS' => 'Burning or blowing gas',
886
+				'WT' => 'Mass movement of aircraft',
887
+				'WV' => 'Formation flight',
888
+				'WZ' => 'model flying');
889 889
 	public $code_sp_availabity = array(
890
-			    'AC' => 'Withdrawn for maintenance',
891
-			    'AD' => 'Available for daylight operation',
892
-			    'AF' => 'Flight checked and found reliable',
893
-			    'AG' => 'Operating but ground checked only, awaiting flight check',
894
-			    'AH' => 'Hours of service are now',
895
-			    'AK' => 'Resumed normal operations',
896
-			    'AM' => 'Military operations only',
897
-			    'AN' => 'Available for night operation',
898
-			    'AO' => 'Operational',
899
-			    'AP' => 'Available, prior permission required',
900
-			    'AR' => 'Available on request',
901
-			    'AS' => 'Unserviceable',
902
-			    'AU' => 'Not available',
903
-			    'AW' => 'Completely withdrawn',
904
-			    'AX' => 'Previously promulgated shutdown has been cancelled');
890
+				'AC' => 'Withdrawn for maintenance',
891
+				'AD' => 'Available for daylight operation',
892
+				'AF' => 'Flight checked and found reliable',
893
+				'AG' => 'Operating but ground checked only, awaiting flight check',
894
+				'AH' => 'Hours of service are now',
895
+				'AK' => 'Resumed normal operations',
896
+				'AM' => 'Military operations only',
897
+				'AN' => 'Available for night operation',
898
+				'AO' => 'Operational',
899
+				'AP' => 'Available, prior permission required',
900
+				'AR' => 'Available on request',
901
+				'AS' => 'Unserviceable',
902
+				'AU' => 'Not available',
903
+				'AW' => 'Completely withdrawn',
904
+				'AX' => 'Previously promulgated shutdown has been cancelled');
905 905
 	public $code_sp_changes = array(
906
-			    'CA' => 'Activated',
907
-			    'CC' => 'Completed',
908
-			    'CD' => 'Deactivated',
909
-			    'CE' => 'Erected',
910
-			    'CF' => 'Operating frequency(ies) changed to',
911
-			    'CG' => 'Downgraded to',
912
-			    'CH' => 'Changed',
913
-			    'CI' => 'dentification or radio call sign changed to',
914
-			    'CL' => 'Realigned',
915
-			    'CM' => 'Displaced',
916
-			    'CO' => 'Operating',
917
-			    'CP' => 'Operating on reduced power',
918
-			    'CR' => 'Temporarily replaced by',
919
-			    'CS' => 'Installed',
920
-			    'CT' => 'On test, do not use');
906
+				'CA' => 'Activated',
907
+				'CC' => 'Completed',
908
+				'CD' => 'Deactivated',
909
+				'CE' => 'Erected',
910
+				'CF' => 'Operating frequency(ies) changed to',
911
+				'CG' => 'Downgraded to',
912
+				'CH' => 'Changed',
913
+				'CI' => 'dentification or radio call sign changed to',
914
+				'CL' => 'Realigned',
915
+				'CM' => 'Displaced',
916
+				'CO' => 'Operating',
917
+				'CP' => 'Operating on reduced power',
918
+				'CR' => 'Temporarily replaced by',
919
+				'CS' => 'Installed',
920
+				'CT' => 'On test, do not use');
921 921
 	public $code_sp_hazardous = array(
922
-			    'HA' => 'Braking action is',
923
-			    'HB' => 'Braking coefficient is',
924
-			    'HC' => 'Covered by compacted snow to depth of x Ft',
925
-			    'HD' => 'Covered by dry snow to a depth of x Ft',
926
-			    'HE' => 'Covered by water to a depth of x Ft',
927
-			    'HF' => 'Totally free of snow and ice',
928
-			    'HG' => 'Grass cutting in progress',
929
-			    'HH' => 'Hazard due to',
930
-			    'HI' => 'Covered by ice',
931
-			    'HJ' => 'Launch planned',
932
-			    'HK' => 'Migration in progress',
933
-			    'HL' => 'Snow clearance completed',
934
-			    'HM' => 'Marked by',
935
-			    'HN' => 'Covered by wet snow or slush to a depth of x Ft',
936
-			    'HO' => 'Obscured by snow',
937
-			    'HP' => 'Snow clearance in progress',
938
-			    'HQ' => 'Operation cancelled',
939
-			    'HR' => 'Standing water',
940
-			    'HS' => 'Sanding in progress',
941
-			    'HT' => 'Approach according to signal area only',
942
-			    'HU' => 'Launch in progress',
943
-			    'HV' => 'Work completed',
944
-			    'HW' => 'Work in progress',
945
-			    'HX' => 'Concentration of birds',
946
-			    'HY' => 'Snow banks exist',
947
-			    'HZ' => 'Covered by frozen ruts and ridges');
922
+				'HA' => 'Braking action is',
923
+				'HB' => 'Braking coefficient is',
924
+				'HC' => 'Covered by compacted snow to depth of x Ft',
925
+				'HD' => 'Covered by dry snow to a depth of x Ft',
926
+				'HE' => 'Covered by water to a depth of x Ft',
927
+				'HF' => 'Totally free of snow and ice',
928
+				'HG' => 'Grass cutting in progress',
929
+				'HH' => 'Hazard due to',
930
+				'HI' => 'Covered by ice',
931
+				'HJ' => 'Launch planned',
932
+				'HK' => 'Migration in progress',
933
+				'HL' => 'Snow clearance completed',
934
+				'HM' => 'Marked by',
935
+				'HN' => 'Covered by wet snow or slush to a depth of x Ft',
936
+				'HO' => 'Obscured by snow',
937
+				'HP' => 'Snow clearance in progress',
938
+				'HQ' => 'Operation cancelled',
939
+				'HR' => 'Standing water',
940
+				'HS' => 'Sanding in progress',
941
+				'HT' => 'Approach according to signal area only',
942
+				'HU' => 'Launch in progress',
943
+				'HV' => 'Work completed',
944
+				'HW' => 'Work in progress',
945
+				'HX' => 'Concentration of birds',
946
+				'HY' => 'Snow banks exist',
947
+				'HZ' => 'Covered by frozen ruts and ridges');
948 948
 	public $code_sp_limitations = array(
949
-			    'LA' => 'Operating on Auxiliary Power Supply',
950
-			    'LB' => 'Reserved for aircraft based therein',
951
-			    'LC' => 'Closed',
952
-			    'LD' => 'Unsafe',
953
-			    'LE' => 'Operated without auxiliary power supply',
954
-			    'LF' => 'Interference from',
955
-			    'LG' => 'Operating without identification',
956
-			    'LH' => 'Unserviceable for aircraft heavier than',
957
-			    'LI' => 'Close to IFR operations',
958
-			    'LK' => 'Operating as a fixed light',
959
-			    'LL' => 'Usable for lenght of... and width of...',
960
-			    'LN' => 'Close to all night operations',
961
-			    'LP' => 'Prohibited to',
962
-			    'LR' => 'Aircraft restricted to runways and taxiways',
963
-			    'LS' => 'Subject to interruption',
964
-			    'LT' => 'Limited to',
965
-			    'LV' => 'Close to VFR operations',
966
-			    'LW' => 'Will take place',
967
-			    'LX' => 'Operating but caution advised to'); 
949
+				'LA' => 'Operating on Auxiliary Power Supply',
950
+				'LB' => 'Reserved for aircraft based therein',
951
+				'LC' => 'Closed',
952
+				'LD' => 'Unsafe',
953
+				'LE' => 'Operated without auxiliary power supply',
954
+				'LF' => 'Interference from',
955
+				'LG' => 'Operating without identification',
956
+				'LH' => 'Unserviceable for aircraft heavier than',
957
+				'LI' => 'Close to IFR operations',
958
+				'LK' => 'Operating as a fixed light',
959
+				'LL' => 'Usable for lenght of... and width of...',
960
+				'LN' => 'Close to all night operations',
961
+				'LP' => 'Prohibited to',
962
+				'LR' => 'Aircraft restricted to runways and taxiways',
963
+				'LS' => 'Subject to interruption',
964
+				'LT' => 'Limited to',
965
+				'LV' => 'Close to VFR operations',
966
+				'LW' => 'Will take place',
967
+				'LX' => 'Operating but caution advised to'); 
968 968
 
969 969
 	public function __construct($dbc = null) {
970 970
 		$Connection = new Connection($dbc);
Please login to merge, or discard this patch.
Doc Comments   +14 added lines patch added patch discarded remove patch
@@ -1098,6 +1098,10 @@  discard block
 block discarded – undo
1098 1098
 		else return array();
1099 1099
 	}
1100 1100
 
1101
+	/**
1102
+	 * @param string $type
1103
+	 * @param string $rules
1104
+	 */
1101 1105
 	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
1102 1106
 		$query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)";
1103 1107
 		$query_values = array(':ref' => $ref,':title' => $title,':type' => $type,':fir' => $fir,':code' => $code,':rules' => $rules,':scope' => $scope,':lower_limit' => $lower_limit,':upper_limit' => $upper_limit,':center_latitude' => $center_latitude,':center_longitude' => $center_longitude,':radius' => $radius,':date_begin' => $date_begin,':date_end' => $date_end,':permanent' => $permanent,':text' => $text,':full_notam' => $full_notam);
@@ -1179,6 +1183,10 @@  discard block
 block discarded – undo
1179 1183
 			}
1180 1184
 		}
1181 1185
 	}
1186
+
1187
+	/**
1188
+	 * @param string $filename
1189
+	 */
1182 1190
 	public function updateNOTAMfromTextFile($filename) {
1183 1191
 		$alldata = $this->parseNOTAMtextFile($filename);
1184 1192
 		if (count($alldata) > 0) {
@@ -1223,6 +1231,9 @@  discard block
 block discarded – undo
1223 1231
 		}
1224 1232
 	}
1225 1233
 
1234
+	/**
1235
+	 * @param string $icao
1236
+	 */
1226 1237
 	public function downloadNOTAM($icao) {
1227 1238
 		date_default_timezone_set("UTC");
1228 1239
 		$Common = new Common();
@@ -1359,6 +1370,9 @@  discard block
 block discarded – undo
1359 1370
 		return $result;
1360 1371
 	}
1361 1372
 	
1373
+	/**
1374
+	 * @param string $code
1375
+	 */
1362 1376
 	public function parse_code($code) {
1363 1377
 		$code = str_split($code);
1364 1378
 		$code_fp = $code[1].$code[2];
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -982,19 +982,19 @@  discard block
 block discarded – undo
982 982
 		try {
983 983
 			$sth = $this->db->prepare($query);
984 984
 			$sth->execute($query_values);
985
-		} catch(PDOException $e) {
985
+		} catch (PDOException $e) {
986 986
 			echo "error : ".$e->getMessage();
987 987
 		}
988 988
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
989 989
 		return $all;
990 990
 	}
991 991
 	public function getAllNOTAMtext() {
992
-		$query  = 'SELECT full_notam FROM notam';
992
+		$query = 'SELECT full_notam FROM notam';
993 993
 		$query_values = array();
994 994
 		try {
995 995
 			$sth = $this->db->prepare($query);
996 996
 			$sth->execute($query_values);
997
-		} catch(PDOException $e) {
997
+		} catch (PDOException $e) {
998 998
 			echo "error : ".$e->getMessage();
999 999
 		}
1000 1000
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1003,13 +1003,13 @@  discard block
 block discarded – undo
1003 1003
 	public function createNOTAMtextFile($filename) {
1004 1004
 		$allnotam_result = $this->getAllNOTAMtext();
1005 1005
 		$notamtext = '';
1006
-		foreach($allnotam_result as $notam) {
1006
+		foreach ($allnotam_result as $notam) {
1007 1007
 			$notamtext .= '%%'."\n";
1008 1008
 			$notamtext .= $notam['full_notam'];
1009 1009
 			$notamtext .= "\n".'%%'."\n";
1010 1010
 		}
1011 1011
 		//$allnotam = implode('\n%%%%\n',$allnotam_result);
1012
-		file_put_contents($filename,$notamtext);
1012
+		file_put_contents($filename, $notamtext);
1013 1013
 	}
1014 1014
 	public function parseNOTAMtextFile($filename) {
1015 1015
 		$data = file_get_contents($filename);
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 		try {
1031 1031
 			$sth = $this->db->prepare($query);
1032 1032
 			$sth->execute($query_values);
1033
-		} catch(PDOException $e) {
1033
+		} catch (PDOException $e) {
1034 1034
 			echo "error : ".$e->getMessage();
1035 1035
 		}
1036 1036
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1039,10 +1039,10 @@  discard block
 block discarded – undo
1039 1039
 	public function getAllNOTAMbyCoord($coord) {
1040 1040
 		global $globalDBdriver;
1041 1041
 		if (is_array($coord)) {
1042
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1043
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1044
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1045
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1042
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1043
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1044
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1045
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1046 1046
 		} else return array();
1047 1047
 		if ($globalDBdriver == 'mysql') {
1048 1048
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()';
@@ -1054,19 +1054,19 @@  discard block
 block discarded – undo
1054 1054
 		try {
1055 1055
 			$sth = $this->db->prepare($query);
1056 1056
 			$sth->execute($query_values);
1057
-		} catch(PDOException $e) {
1057
+		} catch (PDOException $e) {
1058 1058
 			echo "error : ".$e->getMessage();
1059 1059
 		}
1060 1060
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1061 1061
 		return $all;
1062 1062
 	}
1063
-	public function getAllNOTAMbyCoordScope($coord,$scope) {
1063
+	public function getAllNOTAMbyCoordScope($coord, $scope) {
1064 1064
 		global $globalDBdriver;
1065 1065
 		if (is_array($coord)) {
1066
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1067
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1068
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1069
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1066
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1067
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1068
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1069
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1070 1070
 		} else return array();
1071 1071
 		if ($globalDBdriver == 'mysql') {
1072 1072
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope';
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 		try {
1079 1079
 			$sth = $this->db->prepare($query);
1080 1080
 			$sth->execute($query_values);
1081
-		} catch(PDOException $e) {
1081
+		} catch (PDOException $e) {
1082 1082
 			echo "error : ".$e->getMessage();
1083 1083
 		}
1084 1084
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 		try {
1091 1091
 			$sth = $this->db->prepare($query);
1092 1092
 			$sth->execute($query_values);
1093
-		} catch(PDOException $e) {
1093
+		} catch (PDOException $e) {
1094 1094
 			return "error : ".$e->getMessage();
1095 1095
 		}
1096 1096
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1098,13 +1098,13 @@  discard block
 block discarded – undo
1098 1098
 		else return array();
1099 1099
 	}
1100 1100
 
1101
-	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
1101
+	public function addNOTAM($ref, $title, $type, $fir, $code, $rules, $scope, $lower_limit, $upper_limit, $center_latitude, $center_longitude, $radius, $date_begin, $date_end, $permanent, $text, $full_notam) {
1102 1102
 		$query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)";
1103
-		$query_values = array(':ref' => $ref,':title' => $title,':type' => $type,':fir' => $fir,':code' => $code,':rules' => $rules,':scope' => $scope,':lower_limit' => $lower_limit,':upper_limit' => $upper_limit,':center_latitude' => $center_latitude,':center_longitude' => $center_longitude,':radius' => $radius,':date_begin' => $date_begin,':date_end' => $date_end,':permanent' => $permanent,':text' => $text,':full_notam' => $full_notam);
1103
+		$query_values = array(':ref' => $ref, ':title' => $title, ':type' => $type, ':fir' => $fir, ':code' => $code, ':rules' => $rules, ':scope' => $scope, ':lower_limit' => $lower_limit, ':upper_limit' => $upper_limit, ':center_latitude' => $center_latitude, ':center_longitude' => $center_longitude, ':radius' => $radius, ':date_begin' => $date_begin, ':date_end' => $date_end, ':permanent' => $permanent, ':text' => $text, ':full_notam' => $full_notam);
1104 1104
 		try {
1105 1105
 			$sth = $this->db->prepare($query);
1106 1106
 			$sth->execute($query_values);
1107
-		} catch(PDOException $e) {
1107
+		} catch (PDOException $e) {
1108 1108
 			return "error : ".$e->getMessage();
1109 1109
 		}
1110 1110
 	}
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 		try {
1116 1116
 			$sth = $this->db->prepare($query);
1117 1117
 			$sth->execute($query_values);
1118
-		} catch(PDOException $e) {
1118
+		} catch (PDOException $e) {
1119 1119
 			return "error : ".$e->getMessage();
1120 1120
 		}
1121 1121
 	}
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 		try {
1131 1131
 			$sth = $this->db->prepare($query);
1132 1132
 			$sth->execute($query_values);
1133
-		} catch(PDOException $e) {
1133
+		} catch (PDOException $e) {
1134 1134
 			return "error : ".$e->getMessage();
1135 1135
 		}
1136 1136
 	}
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 		try {
1141 1141
 			$sth = $this->db->prepare($query);
1142 1142
 			$sth->execute($query_values);
1143
-		} catch(PDOException $e) {
1143
+		} catch (PDOException $e) {
1144 1144
 			return "error : ".$e->getMessage();
1145 1145
 		}
1146 1146
 	}
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 		try {
1150 1150
 			$sth = $this->db->prepare($query);
1151 1151
 			$sth->execute();
1152
-		} catch(PDOException $e) {
1152
+		} catch (PDOException $e) {
1153 1153
 			return "error : ".$e->getMessage();
1154 1154
 		}
1155 1155
 	}
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 		try {
1159 1159
 			$sth = $this->db->prepare($query);
1160 1160
 			$sth->execute();
1161
-		} catch(PDOException $e) {
1161
+		} catch (PDOException $e) {
1162 1162
 			return "error : ".$e->getMessage();
1163 1163
 		}
1164 1164
 	}
@@ -1166,14 +1166,14 @@  discard block
 block discarded – undo
1166 1166
 	public function updateNOTAM() {
1167 1167
 		global $globalNOTAMAirports;
1168 1168
 		if (isset($globalNOTAMAirports) && is_array($globalNOTAMAirports) && count($globalNOTAMAirports) > 0) {
1169
-			foreach (array_chunk($globalNOTAMAirports,10) as $airport) {
1170
-				$airport_icao = implode(',',$airport);
1169
+			foreach (array_chunk($globalNOTAMAirports, 10) as $airport) {
1170
+				$airport_icao = implode(',', $airport);
1171 1171
 				$alldata = $this->downloadNOTAM($airport_icao);
1172 1172
 				if (count($alldata) > 0) {
1173 1173
 					foreach ($alldata as $initial_data) {
1174 1174
 						$data = $this->parse($initial_data);
1175 1175
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1176
-						if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1176
+						if (count($notamref) == 0) $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1177 1177
 					}
1178 1178
 				}
1179 1179
 			}
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 			foreach ($alldata as $initial_data) {
1187 1187
 				$data = $this->parse($initial_data);
1188 1188
 				$notamref = $this->getNOTAMbyRef($data['ref']);
1189
-				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1189
+				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1190 1190
 			}
1191 1191
 		}
1192 1192
 	}
@@ -1195,12 +1195,12 @@  discard block
 block discarded – undo
1195 1195
 		global $globalTransaction;
1196 1196
 		$Spotter = new Spotter();
1197 1197
 		$allairports = $Spotter->getAllAirportInfo();
1198
-		foreach (array_chunk($allairports,20) as $airport) {
1198
+		foreach (array_chunk($allairports, 20) as $airport) {
1199 1199
 			$airports_icao = array();
1200
-			foreach($airport as $icao) {
1200
+			foreach ($airport as $icao) {
1201 1201
 				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1202 1202
 			}
1203
-			$airport_icao = implode(',',$airports_icao);
1203
+			$airport_icao = implode(',', $airports_icao);
1204 1204
 			$alldata = $this->downloadNOTAM($airport_icao);
1205 1205
 			if ($globalTransaction) $this->db->beginTransaction();
1206 1206
 			if (count($alldata) > 0) {
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 						if (count($notamref) == 0) {
1214 1214
 							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1215 1215
 							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1216
-							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1216
+							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'], '', '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1217 1217
 						}
1218 1218
 					}
1219 1219
 				}
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 		date_default_timezone_set("UTC");
1228 1228
 		$Common = new Common();
1229 1229
 		//$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=DOMESTIC&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1230
-		$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1230
+		$url = str_replace('{icao}', $icao, 'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1231 1231
 		$data = $Common->getData($url);
1232 1232
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1233 1233
 		//print_r($matches);
@@ -1239,14 +1239,14 @@  discard block
 block discarded – undo
1239 1239
 		$Common = new Common();
1240 1240
 		$result = array();
1241 1241
 		$result['full_notam'] = $data;
1242
-		$data = str_ireplace(array("\r","\n",'\r','\n'),' ',$data);
1243
-		$data = preg_split('#(?=([A-Z]\)\s))#',$data);
1242
+		$data = str_ireplace(array("\r", "\n", '\r', '\n'), ' ', $data);
1243
+		$data = preg_split('#(?=([A-Z]\)\s))#', $data);
1244 1244
 		//print_r($data);
1245 1245
 		foreach ($data as $line) {
1246 1246
 			$line = trim($line);
1247
-			if (preg_match('#Q\) (.*)#',$line,$matches)) {
1248
-				$line = str_replace(' ','',$line);
1249
-				if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#',$line,$matches)) {
1247
+			if (preg_match('#Q\) (.*)#', $line, $matches)) {
1248
+				$line = str_replace(' ', '', $line);
1249
+				if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#', $line, $matches)) {
1250 1250
 				//if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#',$line,$matches)) {
1251 1251
 					//print_r($matches);
1252 1252
 					$result['fir'] = $matches[1];
@@ -1292,30 +1292,30 @@  discard block
 block discarded – undo
1292 1292
 					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1293 1293
 					$result['lower_limit'] = $matches[6];
1294 1294
 					$result['upper_limit'] = $matches[7];
1295
-					$latitude = $Common->convertDec($matches[8],'latitude');
1295
+					$latitude = $Common->convertDec($matches[8], 'latitude');
1296 1296
 					if ($matches[9] == 'S') $latitude = -$latitude;
1297
-					$longitude = $Common->convertDec($matches[10],'longitude');
1297
+					$longitude = $Common->convertDec($matches[10], 'longitude');
1298 1298
 					if ($matches[11] == 'W') $longitude = -$longitude;
1299 1299
 					$result['latitude'] = $latitude;
1300 1300
 					$result['longitude'] = $longitude;
1301 1301
 					$result['radius'] = intval($matches[12]);
1302 1302
 				} else echo 'ERROR : '.$line."\n";
1303 1303
 			}
1304
-			elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1304
+			elseif (preg_match('#A\) (.*)#', $line, $matches)) {
1305 1305
 				$result['icao'] = $matches[1];
1306 1306
 			}
1307
-			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1307
+			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#', $line, $matches)) {
1308 1308
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1309 1309
 				else $year = '20'.$matches[1];
1310 1310
 				$result['date_begin'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1311 1311
 			}
1312
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1312
+			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#', $line, $matches)) {
1313 1313
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1314 1314
 				else $year = '20'.$matches[1];
1315 1315
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1316 1316
 				$result['permanent'] = 0;
1317 1317
 			}
1318
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1318
+			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#', $line, $matches)) {
1319 1319
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1320 1320
 				else $year = '20'.$matches[1];
1321 1321
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
@@ -1324,26 +1324,26 @@  discard block
 block discarded – undo
1324 1324
 				if ($matches[6] == 'PERM') $result['permanent'] = 1;
1325 1325
 				else $result['permanent'] = 0;
1326 1326
 			}
1327
-			elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1327
+			elseif (preg_match('#C\) (EST|PERM)$#', $line, $matches)) {
1328 1328
 				$result['date_end'] = '2030/12/20 12:00';
1329 1329
 				if ($matches[1] == 'EST') $result['estimated'] = 1;
1330 1330
 				else $result['estimated'] = 0;
1331 1331
 				if ($matches[1] == 'PERM') $result['permanent'] = 1;
1332 1332
 				else $result['permanent'] = 0;
1333 1333
 			}
1334
-			elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1334
+			elseif (preg_match('#E\) (.*)#', $line, $matches)) {
1335 1335
 				$rtext = array();
1336
-				$text = explode(' ',$matches[1]);
1336
+				$text = explode(' ', $matches[1]);
1337 1337
 				foreach ($text as $word) {
1338 1338
 					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1339
-					elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1339
+					elseif (ctype_digit(strval(substr($word, 3))) && isset($this->abbr[substr($word, 0, 3)])) $rtext[] = strtoupper($this->abbr[substr($word, 0, 3)]).' '.substr($word, 3);
1340 1340
 					else $rtext[] = $word;
1341 1341
 				}
1342
-				$result['text'] = implode(' ',$rtext);
1342
+				$result['text'] = implode(' ', $rtext);
1343 1343
 			//} elseif (preg_match('#F\) (.*)#',$line,$matches)) {
1344 1344
 			//} elseif (preg_match('#G\) (.*)#',$line,$matches)) {
1345
-			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1346
-				$text = explode(' ',$line);
1345
+			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#', $line, $matches)) {
1346
+				$text = explode(' ', $line);
1347 1347
 				$result['ref'] = $text[0];
1348 1348
 				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1349 1349
 				if ($matches[1] == 'NOTAMC') {
Please login to merge, or discard this patch.
Braces   +208 added lines, -88 removed lines patch added patch discarded remove patch
@@ -1015,8 +1015,11 @@  discard block
 block discarded – undo
1015 1015
 		$data = file_get_contents($filename);
1016 1016
 		preg_match_all("/%%(.+?)%%/is", $data, $matches);
1017 1017
 		//print_r($matches);
1018
-		if (isset($matches[1])) return $matches[1];
1019
-		else return array();
1018
+		if (isset($matches[1])) {
1019
+			return $matches[1];
1020
+		} else {
1021
+			return array();
1022
+		}
1020 1023
 	}
1021 1024
 	public function getAllNOTAMbyScope($scope) {
1022 1025
 		global $globalDBdriver;
@@ -1043,7 +1046,9 @@  discard block
 block discarded – undo
1043 1046
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1044 1047
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1045 1048
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1046
-		} else return array();
1049
+		} else {
1050
+			return array();
1051
+		}
1047 1052
 		if ($globalDBdriver == 'mysql') {
1048 1053
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()';
1049 1054
 		} else {
@@ -1067,7 +1072,9 @@  discard block
 block discarded – undo
1067 1072
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1068 1073
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1069 1074
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1070
-		} else return array();
1075
+		} else {
1076
+			return array();
1077
+		}
1071 1078
 		if ($globalDBdriver == 'mysql') {
1072 1079
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope';
1073 1080
 		} else {
@@ -1094,8 +1101,11 @@  discard block
 block discarded – undo
1094 1101
 			return "error : ".$e->getMessage();
1095 1102
 		}
1096 1103
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1097
-		if (isset($all[0])) return $all[0];
1098
-		else return array();
1104
+		if (isset($all[0])) {
1105
+			return $all[0];
1106
+		} else {
1107
+			return array();
1108
+		}
1099 1109
 	}
1100 1110
 
1101 1111
 	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
@@ -1173,7 +1183,9 @@  discard block
 block discarded – undo
1173 1183
 					foreach ($alldata as $initial_data) {
1174 1184
 						$data = $this->parse($initial_data);
1175 1185
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1176
-						if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1186
+						if (count($notamref) == 0) {
1187
+							$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1188
+						}
1177 1189
 					}
1178 1190
 				}
1179 1191
 			}
@@ -1186,7 +1198,9 @@  discard block
 block discarded – undo
1186 1198
 			foreach ($alldata as $initial_data) {
1187 1199
 				$data = $this->parse($initial_data);
1188 1200
 				$notamref = $this->getNOTAMbyRef($data['ref']);
1189
-				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1201
+				if (!isset($notamref['notam_id'])) {
1202
+					$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1203
+				}
1190 1204
 			}
1191 1205
 		}
1192 1206
 	}
@@ -1198,11 +1212,15 @@  discard block
 block discarded – undo
1198 1212
 		foreach (array_chunk($allairports,20) as $airport) {
1199 1213
 			$airports_icao = array();
1200 1214
 			foreach($airport as $icao) {
1201
-				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1215
+				if (isset($icao['icao'])) {
1216
+					$airports_icao[] = $icao['icao'];
1217
+				}
1202 1218
 			}
1203 1219
 			$airport_icao = implode(',',$airports_icao);
1204 1220
 			$alldata = $this->downloadNOTAM($airport_icao);
1205
-			if ($globalTransaction) $this->db->beginTransaction();
1221
+			if ($globalTransaction) {
1222
+				$this->db->beginTransaction();
1223
+			}
1206 1224
 			if (count($alldata) > 0) {
1207 1225
 				foreach ($alldata as $initial_data) {
1208 1226
 					//print_r($initial_data);
@@ -1211,14 +1229,23 @@  discard block
 block discarded – undo
1211 1229
 					if (isset($data['ref'])) {
1212 1230
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1213 1231
 						if (count($notamref) == 0) {
1214
-							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1215
-							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1216
-							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1232
+							if (isset($data['ref_replaced'])) {
1233
+								$this->deleteNOTAMbyRef($data['ref_replaced']);
1234
+							}
1235
+							if (isset($data['ref_cancelled'])) {
1236
+								$this->deleteNOTAMbyRef($data['ref_cancelled']);
1237
+							} elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) {
1238
+								echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1239
+							}
1217 1240
 						}
1218 1241
 					}
1219 1242
 				}
1220
-			} else echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1221
-			if ($globalTransaction) $this->db->commit();
1243
+			} else {
1244
+				echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1245
+			}
1246
+			if ($globalTransaction) {
1247
+				$this->db->commit();
1248
+			}
1222 1249
 			sleep(5);
1223 1250
 		}
1224 1251
 	}
@@ -1231,8 +1258,11 @@  discard block
 block discarded – undo
1231 1258
 		$data = $Common->getData($url);
1232 1259
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1233 1260
 		//print_r($matches);
1234
-		if (isset($matches[1])) return $matches[1];
1235
-		else return array();
1261
+		if (isset($matches[1])) {
1262
+			return $matches[1];
1263
+		} else {
1264
+			return array();
1265
+		}
1236 1266
 	}
1237 1267
 
1238 1268
 	public function parse($data) {
@@ -1255,89 +1285,145 @@  discard block
 block discarded – undo
1255 1285
 					$rules = str_split($matches[3]);
1256 1286
 					foreach ($rules as $rule) {
1257 1287
 						if ($rule == 'I') {
1258
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/IFR';
1259
-							else $result['rules'] = 'IFR';
1288
+							if (isset($result['rules'])) {
1289
+								$result['rules'] = $result['rules'].'/IFR';
1290
+							} else {
1291
+								$result['rules'] = 'IFR';
1292
+							}
1260 1293
 						} elseif ($rule == 'V') {
1261
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/VFR';
1262
-							else $result['rules'] = 'VFR';
1294
+							if (isset($result['rules'])) {
1295
+								$result['rules'] = $result['rules'].'/VFR';
1296
+							} else {
1297
+								$result['rules'] = 'VFR';
1298
+							}
1263 1299
 						} elseif ($rule == 'K') {
1264
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/Checklist';
1265
-							else $result['rules'] = 'Checklist';
1300
+							if (isset($result['rules'])) {
1301
+								$result['rules'] = $result['rules'].'/Checklist';
1302
+							} else {
1303
+								$result['rules'] = 'Checklist';
1304
+							}
1266 1305
 						}
1267 1306
 					}
1268 1307
 					$attentions = str_split($matches[4]);
1269 1308
 					foreach ($attentions as $attention) {
1270 1309
 						if ($attention == 'N') {
1271
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Immediate attention';
1272
-							else $result['rules'] = 'Immediate attention';
1310
+							if (isset($result['attention'])) {
1311
+								$result['attention'] = $result['attention'].' / Immediate attention';
1312
+							} else {
1313
+								$result['rules'] = 'Immediate attention';
1314
+							}
1273 1315
 						} elseif ($attention == 'B') {
1274
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Operational significance';
1275
-							else $result['rules'] = 'Operational significance';
1316
+							if (isset($result['attention'])) {
1317
+								$result['attention'] = $result['attention'].' / Operational significance';
1318
+							} else {
1319
+								$result['rules'] = 'Operational significance';
1320
+							}
1276 1321
 						} elseif ($attention == 'O') {
1277
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Flight operations';
1278
-							else $result['rules'] = 'Flight operations';
1322
+							if (isset($result['attention'])) {
1323
+								$result['attention'] = $result['attention'].' / Flight operations';
1324
+							} else {
1325
+								$result['rules'] = 'Flight operations';
1326
+							}
1279 1327
 						} elseif ($attention == 'M') {
1280
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Misc';
1281
-							else $result['rules'] = 'Misc';
1328
+							if (isset($result['attention'])) {
1329
+								$result['attention'] = $result['attention'].' / Misc';
1330
+							} else {
1331
+								$result['rules'] = 'Misc';
1332
+							}
1282 1333
 						} elseif ($attention == 'K') {
1283
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Checklist';
1284
-							else $result['rules'] = 'Checklist';
1334
+							if (isset($result['attention'])) {
1335
+								$result['attention'] = $result['attention'].' / Checklist';
1336
+							} else {
1337
+								$result['rules'] = 'Checklist';
1338
+							}
1285 1339
 						}
1286 1340
 					}
1287
-					if ($matches[5] == 'A') $result['scope'] = 'Airport warning';
1288
-					elseif ($matches[5] == 'E') $result['scope'] = 'Enroute warning';
1289
-					elseif ($matches[5] == 'W') $result['scope'] = 'Navigation warning';
1290
-					elseif ($matches[5] == 'K') $result['scope'] = 'Checklist';
1291
-					elseif ($matches[5] == 'AE') $result['scope'] = 'Airport/Enroute warning';
1292
-					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1341
+					if ($matches[5] == 'A') {
1342
+						$result['scope'] = 'Airport warning';
1343
+					} elseif ($matches[5] == 'E') {
1344
+						$result['scope'] = 'Enroute warning';
1345
+					} elseif ($matches[5] == 'W') {
1346
+						$result['scope'] = 'Navigation warning';
1347
+					} elseif ($matches[5] == 'K') {
1348
+						$result['scope'] = 'Checklist';
1349
+					} elseif ($matches[5] == 'AE') {
1350
+						$result['scope'] = 'Airport/Enroute warning';
1351
+					} elseif ($matches[5] == 'AW') {
1352
+						$result['scope'] = 'Airport/Navigation warning';
1353
+					}
1293 1354
 					$result['lower_limit'] = $matches[6];
1294 1355
 					$result['upper_limit'] = $matches[7];
1295 1356
 					$latitude = $Common->convertDec($matches[8],'latitude');
1296
-					if ($matches[9] == 'S') $latitude = -$latitude;
1357
+					if ($matches[9] == 'S') {
1358
+						$latitude = -$latitude;
1359
+					}
1297 1360
 					$longitude = $Common->convertDec($matches[10],'longitude');
1298
-					if ($matches[11] == 'W') $longitude = -$longitude;
1361
+					if ($matches[11] == 'W') {
1362
+						$longitude = -$longitude;
1363
+					}
1299 1364
 					$result['latitude'] = $latitude;
1300 1365
 					$result['longitude'] = $longitude;
1301 1366
 					$result['radius'] = intval($matches[12]);
1302
-				} else echo 'ERROR : '.$line."\n";
1303
-			}
1304
-			elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1367
+				} else {
1368
+					echo 'ERROR : '.$line."\n";
1369
+				}
1370
+			} elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1305 1371
 				$result['icao'] = $matches[1];
1306
-			}
1307
-			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1308
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1309
-				else $year = '20'.$matches[1];
1372
+			} elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1373
+				if ($matches[1] > 50) {
1374
+					$year = '19'.$matches[1];
1375
+				} else {
1376
+					$year = '20'.$matches[1];
1377
+				}
1310 1378
 				$result['date_begin'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1311
-			}
1312
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1313
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1314
-				else $year = '20'.$matches[1];
1379
+			} elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1380
+				if ($matches[1] > 50) {
1381
+					$year = '19'.$matches[1];
1382
+				} else {
1383
+					$year = '20'.$matches[1];
1384
+				}
1315 1385
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1316 1386
 				$result['permanent'] = 0;
1317
-			}
1318
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1319
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1320
-				else $year = '20'.$matches[1];
1387
+			} elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1388
+				if ($matches[1] > 50) {
1389
+					$year = '19'.$matches[1];
1390
+				} else {
1391
+					$year = '20'.$matches[1];
1392
+				}
1321 1393
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1322
-				if ($matches[6] == 'EST') $result['estimated'] = 1;
1323
-				else $result['estimated'] = 0;
1324
-				if ($matches[6] == 'PERM') $result['permanent'] = 1;
1325
-				else $result['permanent'] = 0;
1326
-			}
1327
-			elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1394
+				if ($matches[6] == 'EST') {
1395
+					$result['estimated'] = 1;
1396
+				} else {
1397
+					$result['estimated'] = 0;
1398
+				}
1399
+				if ($matches[6] == 'PERM') {
1400
+					$result['permanent'] = 1;
1401
+				} else {
1402
+					$result['permanent'] = 0;
1403
+				}
1404
+			} elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1328 1405
 				$result['date_end'] = '2030/12/20 12:00';
1329
-				if ($matches[1] == 'EST') $result['estimated'] = 1;
1330
-				else $result['estimated'] = 0;
1331
-				if ($matches[1] == 'PERM') $result['permanent'] = 1;
1332
-				else $result['permanent'] = 0;
1333
-			}
1334
-			elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1406
+				if ($matches[1] == 'EST') {
1407
+					$result['estimated'] = 1;
1408
+				} else {
1409
+					$result['estimated'] = 0;
1410
+				}
1411
+				if ($matches[1] == 'PERM') {
1412
+					$result['permanent'] = 1;
1413
+				} else {
1414
+					$result['permanent'] = 0;
1415
+				}
1416
+			} elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1335 1417
 				$rtext = array();
1336 1418
 				$text = explode(' ',$matches[1]);
1337 1419
 				foreach ($text as $word) {
1338
-					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1339
-					elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1340
-					else $rtext[] = $word;
1420
+					if (isset($this->abbr[$word])) {
1421
+						$rtext[] = strtoupper($this->abbr[$word]);
1422
+					} elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) {
1423
+						$rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1424
+					} else {
1425
+						$rtext[] = $word;
1426
+					}
1341 1427
 				}
1342 1428
 				$result['text'] = implode(' ',$rtext);
1343 1429
 			//} elseif (preg_match('#F\) (.*)#',$line,$matches)) {
@@ -1345,7 +1431,9 @@  discard block
 block discarded – undo
1345 1431
 			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1346 1432
 				$text = explode(' ',$line);
1347 1433
 				$result['ref'] = $text[0];
1348
-				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1434
+				if ($matches[1] == 'NOTAMN') {
1435
+					$result['type'] = 'new';
1436
+				}
1349 1437
 				if ($matches[1] == 'NOTAMC') {
1350 1438
 					$result['type'] = 'cancel';
1351 1439
 					$result['ref_cancelled'] = $text[2];
@@ -1367,69 +1455,101 @@  discard block
 block discarded – undo
1367 1455
 		switch ($code[1]) {
1368 1456
 			case 'A':
1369 1457
 				$result = 'Airspace organization ';
1370
-				if (isset($this->code_airspace[$code_fp])) $result .= $this->code_airspace[$code_fp];
1458
+				if (isset($this->code_airspace[$code_fp])) {
1459
+					$result .= $this->code_airspace[$code_fp];
1460
+				}
1371 1461
 				break;
1372 1462
 			case 'C':
1373 1463
 				$result = 'Communications and radar facilities ';
1374
-				if (isset($this->code_comradar[$code_fp])) $result .= $this->code_comradar[$code_fp];
1464
+				if (isset($this->code_comradar[$code_fp])) {
1465
+					$result .= $this->code_comradar[$code_fp];
1466
+				}
1375 1467
 				break;
1376 1468
 			case 'F':
1377 1469
 				$result = 'Facilities and services ';
1378
-				if (isset($this->code_facilities[$code_fp])) $result .= $this->code_facilities[$code_fp];
1470
+				if (isset($this->code_facilities[$code_fp])) {
1471
+					$result .= $this->code_facilities[$code_fp];
1472
+				}
1379 1473
 				break;
1380 1474
 			case 'I':
1381 1475
 				$result = 'Instrument and Microwave Landing System ';
1382
-				if (isset($this->code_instrumentlanding[$code_fp])) $result .= $this->code_instrumentlanding[$code_fp];
1476
+				if (isset($this->code_instrumentlanding[$code_fp])) {
1477
+					$result .= $this->code_instrumentlanding[$code_fp];
1478
+				}
1383 1479
 				break;
1384 1480
 			case 'L':
1385 1481
 				$result = 'Lighting facilities ';
1386
-				if (isset($this->code_lightingfacilities[$code_fp])) $result .= $this->code_lightingfacilities[$code_fp];
1482
+				if (isset($this->code_lightingfacilities[$code_fp])) {
1483
+					$result .= $this->code_lightingfacilities[$code_fp];
1484
+				}
1387 1485
 				break;
1388 1486
 			case 'M':
1389 1487
 				$result = 'Movement and landing areas ';
1390
-				if (isset($this->code_movementareas[$code_fp])) $result .= $this->code_movementareas[$code_fp];
1488
+				if (isset($this->code_movementareas[$code_fp])) {
1489
+					$result .= $this->code_movementareas[$code_fp];
1490
+				}
1391 1491
 				break;
1392 1492
 			case 'N':
1393 1493
 				$result = 'Terminal and En Route Navigation Facilities ';
1394
-				if (isset($this->code_terminalfacilities[$code_fp])) $result .= $this->code_terminalfacilities[$code_fp];
1494
+				if (isset($this->code_terminalfacilities[$code_fp])) {
1495
+					$result .= $this->code_terminalfacilities[$code_fp];
1496
+				}
1395 1497
 				break;
1396 1498
 			case 'O':
1397 1499
 				$result = 'Other information ';
1398
-				if (isset($this->code_information[$code_fp])) $result .= $this->code_information[$code_fp];
1500
+				if (isset($this->code_information[$code_fp])) {
1501
+					$result .= $this->code_information[$code_fp];
1502
+				}
1399 1503
 				break;
1400 1504
 			case 'P':
1401 1505
 				$result = 'Air Traffic procedures ';
1402
-				if (isset($this->code_airtraffic[$code_fp])) $result .= $this->code_airtraffic[$code_fp];
1506
+				if (isset($this->code_airtraffic[$code_fp])) {
1507
+					$result .= $this->code_airtraffic[$code_fp];
1508
+				}
1403 1509
 				break;
1404 1510
 			case 'R':
1405 1511
 				$result = 'Navigation Warnings: Airspace Restrictions ';
1406
-				if (isset($this->code_navigationw[$code_fp])) $result .= $this->code_navigationw[$code_fp];
1512
+				if (isset($this->code_navigationw[$code_fp])) {
1513
+					$result .= $this->code_navigationw[$code_fp];
1514
+				}
1407 1515
 				break;
1408 1516
 			case 'S':
1409 1517
 				$result = 'Air Traffic and VOLMET Services ';
1410
-				if (isset($this->code_volmet[$code_fp])) $result .= $this->code_volmet[$code_fp];
1518
+				if (isset($this->code_volmet[$code_fp])) {
1519
+					$result .= $this->code_volmet[$code_fp];
1520
+				}
1411 1521
 				break;
1412 1522
 			case 'W':
1413 1523
 				$result = 'Navigation Warnings: Warnings ';
1414
-				if (isset($this->code_warnings[$code_fp])) $result .= $this->code_warnings[$code_fp];
1524
+				if (isset($this->code_warnings[$code_fp])) {
1525
+					$result .= $this->code_warnings[$code_fp];
1526
+				}
1415 1527
 				break;
1416 1528
 		}
1417 1529
 		switch ($code[3]) {
1418 1530
 			case 'A':
1419 1531
 				// Availability
1420
-				if (isset($this->code_sp_availabity[$code_sp])) $result .= ' '.$this->code_sp_availabity[$code_sp];
1532
+				if (isset($this->code_sp_availabity[$code_sp])) {
1533
+					$result .= ' '.$this->code_sp_availabity[$code_sp];
1534
+				}
1421 1535
 				break;
1422 1536
 			case 'C':
1423 1537
 				// Changes
1424
-				if (isset($this->code_sp_changes[$code_sp])) $result .= ' '.$this->code_sp_changes[$code_sp];
1538
+				if (isset($this->code_sp_changes[$code_sp])) {
1539
+					$result .= ' '.$this->code_sp_changes[$code_sp];
1540
+				}
1425 1541
 				break;
1426 1542
 			case 'H':
1427 1543
 				// Hazardous conditions
1428
-				if (isset($this->code_sp_hazardous[$code_sp])) $result .= ' '.$this->code_sp_hazardous[$code_sp];
1544
+				if (isset($this->code_sp_hazardous[$code_sp])) {
1545
+					$result .= ' '.$this->code_sp_hazardous[$code_sp];
1546
+				}
1429 1547
 				break;
1430 1548
 			case 'L':
1431 1549
 				// Limitations
1432
-				if (isset($this->code_sp_limitations[$code_sp])) $result .= ' '.$this->code_sp_limitations[$code_sp];
1550
+				if (isset($this->code_sp_limitations[$code_sp])) {
1551
+					$result .= ' '.$this->code_sp_limitations[$code_sp];
1552
+				}
1433 1553
 				break;
1434 1554
 			case 'X':
1435 1555
 				// Other Information
Please login to merge, or discard this patch.
waypoints-geojson.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		date_default_timezone_set('UTC');
27 27
 		//waypoint plotting
28 28
 		$output .= '{"type": "Feature",';
29
-		    $output .= '"properties": {';
29
+			$output .= '"properties": {';
30 30
 			$output .= '"segment_name": "'.$spotter_item['segment_name'].'",';
31 31
 			$output .= '"base": "'.$spotter_item['base'].'",';
32 32
 			$output .= '"top": "'.$spotter_item['top'].'",';
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
 				$output .= '"stroke": "#f0f0f0",';
50 50
 				$output .= '"stroke-width": 2';
51 51
 //			}
52
-		    $output .= '},';
53
-		    $output .= '"geometry": {';
52
+			$output .= '},';
53
+			$output .= '"geometry": {';
54 54
 			$output .= '"type": "LineString",';
55 55
 			$output .= '"coordinates": [';
56
-			    //$output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].'], ['.$spotter_item['longitude_end_seg2'].', '.$spotter_item['latitude_end_seg2'].']';
57
-			    $output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].','.round($spotter_item['base']*100*0.3048).'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].','.round($spotter_item['base']*100*0.3048).']';
56
+				//$output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].'], ['.$spotter_item['longitude_end_seg2'].', '.$spotter_item['latitude_end_seg2'].']';
57
+				$output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].','.round($spotter_item['base']*100*0.3048).'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].','.round($spotter_item['base']*100*0.3048).']';
58 58
 			//    $output .= '['.$spotter_item['latitude_begin'].', '.$spotter_item['longitude_begin'].'], ['.$spotter_item['latitude_end'].', '.$spotter_item['longitude_end'].']';
59 59
 			$output .= ']';
60
-		    $output .= '}';
60
+			$output .= '}';
61 61
 /*		    $output .= '"geometry": {';
62 62
 			$output .= '"type": "Point",';
63 63
 			$output .= '"coordinates": [';
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		$output .= '},';
69 69
 		//waypoint plotting
70 70
 		$output .= '{"type": "Feature",';
71
-		    $output .= '"properties": {';
71
+			$output .= '"properties": {';
72 72
 			$output .= '"ident": "'.$spotter_item['name_begin'].'",';
73 73
 			$output .= '"high": "'.$spotter_item['high'].'",';
74 74
 			$output .= '"alt": "'.$spotter_item['base'].'",';
@@ -98,17 +98,17 @@  discard block
 block discarded – undo
98 98
 				$output .= '"marker-size": "small",';
99 99
 				$output .= '"marker-color": "#0000ff"';
100 100
 			}
101
-		    $output .= '},';
102
-		    $output .= '"geometry": {';
101
+			$output .= '},';
102
+			$output .= '"geometry": {';
103 103
 			$output .= '"type": "Point",';
104 104
 			$output .= '"coordinates": [';
105
-			    $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);;
105
+				$output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);;
106 106
 			$output .= ']';
107
-		    $output .= '}';
107
+			$output .= '}';
108 108
 
109 109
 		$output .= '},';
110 110
 		$output .= '{"type": "Feature",';
111
-		    $output .= '"properties": {';
111
+			$output .= '"properties": {';
112 112
 			$output .= '"ident": "'.$spotter_item['name_end'].'",';
113 113
 			$output .= '"high": "'.$spotter_item['high'].'",';
114 114
 			$output .= '"alt": "'.$spotter_item['top'].'",';
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 				$output .= '"marker-size": "small",';
146 146
 				$output .= '"marker-color": "#0000ff"';
147 147
 			}
148
-		    $output .= '},';
149
-		    $output .= '"geometry": {';
148
+			$output .= '},';
149
+			$output .= '"geometry": {';
150 150
 			$output .= '"type": "Point",';
151 151
 			$output .= '"coordinates": [';
152
-			    $output .= $spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].', '.round($spotter_item['base']*100*0.3048);
152
+				$output .= $spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].', '.round($spotter_item['base']*100*0.3048);
153 153
 			$output .= ']';
154
-		    $output .= '}';
154
+			$output .= '}';
155 155
 
156 156
 		$output .= '},';
157 157
 	}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 if (isset($_GET['coord'])) 
12 12
 {
13
-	$coords = explode(',',$_GET['coord']);
13
+	$coords = explode(',', $_GET['coord']);
14 14
 	$spotter_array = $Spotter->getAllWaypointsInfobyCoord($coords);
15 15
 } else {
16 16
 	die;
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 if (!empty($spotter_array))
22 22
 {	  
23 23
 //	print_r($spotter_array);
24
-	foreach($spotter_array as $spotter_item)
24
+	foreach ($spotter_array as $spotter_item)
25 25
 	{
26 26
 		date_default_timezone_set('UTC');
27 27
 		//waypoint plotting
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		    $output .= '"geometry": {';
103 103
 			$output .= '"type": "Point",';
104 104
 			$output .= '"coordinates": [';
105
-			    $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);;
105
+			    $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048); ;
106 106
 			$output .= ']';
107 107
 		    $output .= '}';
108 108
 
Please login to merge, or discard this patch.
airspace-data.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 <button type="button" class="close">&times;</button>
8 8
 <?php
9 9
 
10
-$airspaceid = filter_input(INPUT_GET,'airspace',FILTER_SANITIZE_NUMBER_INT);
10
+$airspaceid = filter_input(INPUT_GET, 'airspace', FILTER_SANITIZE_NUMBER_INT);
11 11
 //$notamref = urldecode($notamref);
12 12
 if ($globalDBdriver == 'mysql') {
13 13
 	$query = "SELECT * FROM airspace WHERE ogr_fid = :id";
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 try {
19 19
 	$sth = $Connection->db->prepare($query);
20 20
 	$sth->execute(array(':id' => $airspaceid));
21
-} catch(PDOException $e) {
21
+} catch (PDOException $e) {
22 22
 	echo "error";
23 23
 }
24
-$result=$sth->fetchAll(PDO::FETCH_ASSOC);
24
+$result = $sth->fetchAll(PDO::FETCH_ASSOC);
25 25
 $airspace = $result[0];
26 26
 date_default_timezone_set('UTC');
27 27
 print '<div class="top">';
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 $airspace = $result[0];
26 26
 date_default_timezone_set('UTC');
27 27
 print '<div class="top">';
28
-if (isset($airspace['name'])) $airspace['title'] = $airspace['name']; 
28
+if (isset($airspace['name'])) {
29
+	$airspace['title'] = $airspace['name'];
30
+}
29 31
 print '<div class="right"><div class="callsign-details"><div class="callsign">'.$airspace['title'].'</a></div>';
30 32
 print '</div>';
31 33
 print '<div class="details">';
@@ -44,13 +46,17 @@  discard block
 block discarded – undo
44 46
 	print '</div>';
45 47
 }
46 48
 
47
-if (isset($airspace['ceiling'])) $airspace['tops'] = $airspace['ceiling'];
49
+if (isset($airspace['ceiling'])) {
50
+	$airspace['tops'] = $airspace['ceiling'];
51
+}
48 52
 print '<div>';
49 53
 print '<span>'._("Tops").'</span>';
50 54
 print $airspace['tops'];
51 55
 print '</div>';
52 56
 
53
-if (isset($airspace['floor'])) $airspace['base'] = $airspace['floor'];
57
+if (isset($airspace['floor'])) {
58
+	$airspace['base'] = $airspace['floor'];
59
+}
54 60
 print '<div>';
55 61
 print '<span>'._("Base").'</span>';
56 62
 print $airspace['base'];
Please login to merge, or discard this patch.
scripts/daemon-spotter.php 3 patches
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 	    die;
38 38
 	}
39 39
 	//$hosts = array($globalSBS1Host.':'.$globalSBS1Port);
40
-	$globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port);
40
+	$globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port);
41 41
     }
42 42
 }
43 43
 
44
-$options = getopt('s::',array('source::','server','idsource::'));
44
+$options = getopt('s::', array('source::', 'server', 'idsource::'));
45 45
 //if (isset($options['s'])) $hosts = array($options['s']);
46 46
 //elseif (isset($options['source'])) $hosts = array($options['source']);
47 47
 if (isset($options['s'])) {
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
 else $id_source = 1;
57 57
 if (isset($globalServer) && $globalServer) {
58 58
     if ($globalDebug) echo "Using Server Mode\n";
59
-    $SI=new SpotterServer();
60
-} else $SI=new SpotterImport($Connection->db);
59
+    $SI = new SpotterServer();
60
+} else $SI = new SpotterImport($Connection->db);
61 61
 //$APRS=new APRS($Connection->db);
62
-$SBS=new SBS();
63
-$ACARS=new ACARS($Connection->db);
64
-$Common=new Common();
62
+$SBS = new SBS();
63
+$ACARS = new ACARS($Connection->db);
64
+$Common = new Common();
65 65
 date_default_timezone_set('UTC');
66 66
 //$servertz = system('date +%Z');
67 67
 // signal handler - playing nice with sockets and dump1090
68 68
 if (function_exists('pcntl_fork')) {
69
-    pcntl_signal(SIGINT,  function() {
69
+    pcntl_signal(SIGINT, function() {
70 70
         global $sockets;
71 71
         echo "\n\nctrl-c or kill signal received. Tidying up ... ";
72 72
         die("Bye!\n");
@@ -109,34 +109,34 @@  discard block
 block discarded – undo
109 109
 
110 110
 function connect_all($hosts) {
111 111
     //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
112
-    global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
112
+    global $sockets, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs;
113 113
     if ($globalDebug) echo 'Connect to all...'."\n";
114 114
     foreach ($hosts as $id => $value) {
115 115
 	$host = $value['host'];
116 116
 	$globalSources[$id]['last_exec'] = 0;
117 117
 	// Here we check type of source(s)
118
-	if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) {
119
-            if (preg_match('/deltadb.txt$/i',$host)) {
118
+	if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) {
119
+            if (preg_match('/deltadb.txt$/i', $host)) {
120 120
         	//$formats[$id] = 'deltadbtxt';
121 121
         	$globalSources[$id]['format'] = 'deltadbtxt';
122 122
         	//$last_exec['deltadbtxt'] = 0;
123 123
         	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
124
-            } else if (preg_match('/vatsim-data.txt$/i',$host)) {
124
+            } else if (preg_match('/vatsim-data.txt$/i', $host)) {
125 125
         	//$formats[$id] = 'vatsimtxt';
126 126
         	$globalSources[$id]['format'] = 'vatsimtxt';
127 127
         	//$last_exec['vatsimtxt'] = 0;
128 128
         	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
129
-    	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
129
+    	    } else if (preg_match('/aircraftlist.json$/i', $host)) {
130 130
         	//$formats[$id] = 'aircraftlistjson';
131 131
         	$globalSources[$id]['format'] = 'aircraftlistjson';
132 132
         	//$last_exec['aircraftlistjson'] = 0;
133 133
         	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
134
-    	    } else if (preg_match('/opensky/i',$host)) {
134
+    	    } else if (preg_match('/opensky/i', $host)) {
135 135
         	//$formats[$id] = 'aircraftlistjson';
136 136
         	$globalSources[$id]['format'] = 'opensky';
137 137
         	//$last_exec['aircraftlistjson'] = 0;
138 138
         	if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
139
-    	    } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) {
139
+    	    } else if (preg_match('/radarvirtuel.com\/file.json$/i', $host)) {
140 140
         	//$formats[$id] = 'radarvirtueljson';
141 141
         	$globalSources[$id]['format'] = 'radarvirtueljson';
142 142
         	//$last_exec['radarvirtueljson'] = 0;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
146 146
         	    exit(0);
147 147
         	}
148
-    	    } else if (preg_match('/planeUpdateFAA.php$/i',$host)) {
148
+    	    } else if (preg_match('/planeUpdateFAA.php$/i', $host)) {
149 149
         	//$formats[$id] = 'planeupdatefaa';
150 150
         	$globalSources[$id]['format'] = 'planeupdatefaa';
151 151
         	//$last_exec['planeupdatefaa'] = 0;
@@ -154,22 +154,22 @@  discard block
 block discarded – undo
154 154
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
155 155
         	    exit(0);
156 156
         	}
157
-            } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) {
157
+            } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) {
158 158
         	//$formats[$id] = 'phpvmacars';
159 159
         	$globalSources[$id]['format'] = 'phpvmacars';
160 160
         	//$last_exec['phpvmacars'] = 0;
161 161
         	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
162
-            } else if (preg_match('/whazzup/i',$host)) {
162
+            } else if (preg_match('/whazzup/i', $host)) {
163 163
         	//$formats[$id] = 'whazzup';
164 164
         	$globalSources[$id]['format'] = 'whazzup';
165 165
         	//$last_exec['whazzup'] = 0;
166 166
         	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
167
-            } else if (preg_match('/recentpireps/i',$host)) {
167
+            } else if (preg_match('/recentpireps/i', $host)) {
168 168
         	//$formats[$id] = 'pirepsjson';
169 169
         	$globalSources[$id]['format'] = 'pirepsjson';
170 170
         	//$last_exec['pirepsjson'] = 0;
171 171
         	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
172
-            } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
172
+            } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) {
173 173
         	//$formats[$id] = 'fr24json';
174 174
         	$globalSources[$id]['format'] = 'fr24json';
175 175
         	//$last_exec['fr24json'] = 0;
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
         	    exit(0);
180 180
         	}
181 181
             //} else if (preg_match('/10001/',$host)) {
182
-            } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
182
+            } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
183 183
         	//$formats[$id] = 'tsv';
184 184
         	$globalSources[$id]['format'] = 'tsv';
185 185
         	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
186 186
             }
187
-        } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
187
+        } elseif (filter_var($host, FILTER_VALIDATE_URL)) {
188 188
         	if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
189
-        } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
190
-	    $hostport = explode(':',$host);
189
+        } elseif (!filter_var($host, FILTER_VALIDATE_URL)) {
190
+	    $hostport = explode(':', $host);
191 191
 	    if (isset($hostport[1])) {
192 192
 		$port = $hostport[1];
193 193
 		$hostn = $hostport[0];
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
 		$hostn = $globalSources[$id]['host'];
197 197
 	    }
198 198
 	    if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) {
199
-        	$s = create_socket($hostn,$port, $errno, $errstr);
199
+        	$s = create_socket($hostn, $port, $errno, $errstr);
200 200
     	    } else {
201
-        	$s = create_socket_udp($hostn,$port, $errno, $errstr);
201
+        	$s = create_socket_udp($hostn, $port, $errno, $errstr);
202 202
 	    }
203 203
 	    if ($s) {
204 204
     	        $sockets[$id] = $s;
205 205
     	        if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') {
206
-		    if (preg_match('/aprs/',$hostn)) {
206
+		    if (preg_match('/aprs/', $hostn)) {
207 207
 			//$formats[$id] = 'aprs';
208 208
 			$globalSources[$id]['format'] = 'aprs';
209 209
 			//$aprs_connect = 0;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut;
245 245
 else $timeout = 20;
246 246
 $errno = '';
247
-$errstr='';
247
+$errstr = '';
248 248
 
249 249
 if (!isset($globalDaemon)) $globalDaemon = TRUE;
250 250
 /* Initiate connections to all the hosts simultaneously */
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
 if ($use_aprs) {
272 272
 	require_once(dirname(__FILE__).'/../require/class.APRS.php');
273
-	$APRS=new APRS();
273
+	$APRS = new APRS();
274 274
 	$aprs_connect = 0;
275 275
 	$aprs_keep = 120;
276 276
 	$aprs_last_tx = time();
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	else $aprs_ssid = 'FAM';
282 282
 	//else $aprs_ssid = 'PerlEx';
283 283
 	if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter;
284
-	else $aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
284
+	else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
285 285
 	if ($aprs_full) $aprs_filter = '';
286 286
 	if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} appid {$aprs_version} filter {$aprs_filter}\n";
287 287
 	else $aprs_login = "user {$aprs_ssid} appid {$aprs_version}\n";
@@ -292,12 +292,12 @@  discard block
 block discarded – undo
292 292
 sleep(1);
293 293
 if ($globalDebug) echo "SCAN MODE \n\n";
294 294
 if (!isset($globalCronEnd)) $globalCronEnd = 60;
295
-$endtime = time()+$globalCronEnd;
295
+$endtime = time() + $globalCronEnd;
296 296
 $i = 1;
297 297
 $tt = array();
298 298
 // Delete all ATC
299 299
 if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
300
-	$ATC=new ATC($Connection->db);
300
+	$ATC = new ATC($Connection->db);
301 301
 }
302 302
 if (!$globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
303 303
 	$ATC->deleteAll();
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 
306 306
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
307 307
 while ($i > 0) {
308
-    if (!$globalDaemon) $i = $endtime-time();
308
+    if (!$globalDaemon) $i = $endtime - time();
309 309
     // Delete old ATC
310 310
     if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
311 311
 	if ($globalDebug) echo 'Delete old ATC...'."\n";
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	}
320 320
 	if ($max != $globalMinFetch) {
321 321
 	    if ($globalDebug) echo 'Sleeping...'."\n";
322
-	    sleep($globalMinFetch-$max+2);
322
+	    sleep($globalMinFetch - $max + 2);
323 323
 	}
324 324
     }
325 325
 
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 	if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
331 331
 	    //$buffer = $Common->getData($hosts[$id]);
332 332
 	    $buffer = $Common->getData($value['host']);
333
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
334
-	    $buffer = explode('\n',$buffer);
333
+    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
334
+	    $buffer = explode('\n', $buffer);
335 335
 	    foreach ($buffer as $line) {
336 336
     		if ($line != '') {
337 337
     		    $line = explode(',', $line);
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 	} elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $value[' last_exec'] > $globalMinFetch))) {
361 361
 	    //$buffer = $Common->getData($hosts[$id]);
362 362
 	    $buffer = $Common->getData($value['host']);
363
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
364
-	    $buffer = explode('\n',$buffer);
363
+    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
364
+	    $buffer = explode('\n', $buffer);
365 365
 	    foreach ($buffer as $line) {
366 366
     		if ($line != '') {
367 367
     		    $line = explode(':', $line);
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			$data['id'] = $line[1].'-'.$line[0];
371 371
 			$data['pilot_id'] = $line[1];
372 372
 			$data['pilot_name'] = $line[2];
373
-			$data['hex'] = str_pad(dechex($line[1]),6,'000000',STR_PAD_LEFT);
373
+			$data['hex'] = str_pad(dechex($line[1]), 6, '000000', STR_PAD_LEFT);
374 374
 			$data['ident'] = $line[0]; // ident
375 375
 			if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude
376 376
 			$data['speed'] = $line[8]; // speed
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 			$data['datetime'] = date('Y-m-d H:i:s');
386 386
 			//$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37]));
387 387
 		        $data['departure_airport_icao'] = $line[11];
388
-		        $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':');
388
+		        $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':');
389 389
 		        $data['arrival_airport_icao'] = $line[13];
390 390
 			$data['frequency'] = $line[4];
391 391
 			$data['type'] = $line[18];
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
     			$data['id_source'] = $id_source;
395 395
 	    		//$data['arrival_airport_time'] = ;
396 396
 	    		if ($line[9] != '') {
397
-	    		    $aircraft_data = explode('/',$line[9]);
397
+	    		    $aircraft_data = explode('/', $line[9]);
398 398
 	    		    if (isset($aircraft_data[1])) {
399 399
 	    			$data['aircraft_icao'] = $aircraft_data[1];
400 400
 	    		    }
@@ -408,9 +408,9 @@  discard block
 block discarded – undo
408 408
     			if ($line[3] == 'PILOT') $SI->add($data);
409 409
 			elseif ($line[3] == 'ATC') {
410 410
 				//print_r($data);
411
-				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
412
-				$data['info'] = str_replace('&amp;sect;','',$data['info']);
413
-				$typec = substr($data['ident'],-3);
411
+				$data['info'] = str_replace('^&sect;', '<br />', $data['info']);
412
+				$data['info'] = str_replace('&amp;sect;', '', $data['info']);
413
+				$typec = substr($data['ident'], -3);
414 414
 				if ($typec == 'APP') $data['type'] = 'Approach';
415 415
 				elseif ($typec == 'TWR') $data['type'] = 'Tower';
416 416
 				elseif ($typec == 'OBS') $data['type'] = 'Observer';
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 				elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
422 422
 				elseif ($data['type'] == '') $data['type'] = 'Observer';
423 423
 				
424
-				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']);
424
+				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']);
425 425
 			}
426 426
     			unset($data);
427 427
     		    }
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
     	    $last_exec[$id]['last'] = time();
433 433
     	//} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) {
434 434
     	} elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
435
-	    $buffer = $Common->getData($value['host'],'get','','','','','20');
435
+	    $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20');
436 436
 	    if ($buffer != '') {
437
-	    $all_data = json_decode($buffer,true);
437
+	    $all_data = json_decode($buffer, true);
438 438
 	    if (isset($all_data['acList'])) {
439 439
 		foreach ($all_data['acList'] as $line) {
440 440
 		    $data = array();
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
     	//} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) {
489 489
     	} elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
490 490
 	    $buffer = $Common->getData($value['host']);
491
-	    $all_data = json_decode($buffer,true);
491
+	    $all_data = json_decode($buffer, true);
492 492
 	    if (isset($all_data['planes'])) {
493 493
 		foreach ($all_data['planes'] as $key => $line) {
494 494
 		    $data = array();
@@ -504,12 +504,12 @@  discard block
 block discarded – undo
504 504
 		    $data['emergency'] = ''; // emergency
505 505
 		    $data['registration'] = $line[2];
506 506
 		    $data['aircraft_icao'] = $line[0];
507
-		    $deparr = explode('-',$line[1]);
507
+		    $deparr = explode('-', $line[1]);
508 508
 		    if (count($deparr) == 2) {
509 509
 			$data['departure_airport_icao'] = $deparr[0];
510 510
 			$data['arrival_airport_icao'] = $deparr[1];
511 511
 		    }
512
-		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
512
+		    $data['datetime'] = date('Y-m-d H:i:s', $line[9]);
513 513
 	    	    $data['format_source'] = 'planeupdatefaa';
514 514
     		    $data['id_source'] = $id_source;
515 515
 		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
     	    $last_exec[$id]['last'] = time();
522 522
     	} elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
523 523
 	    $buffer = $Common->getData($value['host']);
524
-	    $all_data = json_decode($buffer,true);
524
+	    $all_data = json_decode($buffer, true);
525 525
 	    if (isset($all_data['states'])) {
526 526
 		foreach ($all_data['states'] as $key => $line) {
527 527
 		    $data = array();
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 		    //$data['emergency'] = ''; // emergency
538 538
 		    //$data['registration'] = $line[2];
539 539
 		    //$data['aircraft_icao'] = $line[0];
540
-		    $data['datetime'] = date('Y-m-d H:i:s',$line[3]);
540
+		    $data['datetime'] = date('Y-m-d H:i:s', $line[3]);
541 541
 	    	    $data['format_source'] = 'opensky';
542 542
     		    $data['id_source'] = $id_source;
543 543
 		    $SI->add($data);
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
     	} elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
551 551
 	    //$buffer = $Common->getData($hosts[$id]);
552 552
 	    $buffer = $Common->getData($value['host']);
553
-	    $all_data = json_decode($buffer,true);
553
+	    $all_data = json_decode($buffer, true);
554 554
 	    foreach ($all_data as $key => $line) {
555 555
 		if ($key != 'full_count' && $key != 'version' && $key != 'stats') {
556 556
 		    $data = array();
@@ -581,11 +581,11 @@  discard block
 block discarded – undo
581 581
     	//} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) {
582 582
     	} elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
583 583
 	    //$buffer = $Common->getData($hosts[$id],'get','','','','','150');
584
-	    $buffer = $Common->getData($value['host'],'get','','','','','150');
584
+	    $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150');
585 585
 	    //echo $buffer;
586
-	    $buffer = str_replace(array("\n","\r"),"",$buffer);
587
-	    $buffer = preg_replace('/,"num":(.+)/','}',$buffer);
588
-	    $all_data = json_decode($buffer,true);
586
+	    $buffer = str_replace(array("\n", "\r"), "", $buffer);
587
+	    $buffer = preg_replace('/,"num":(.+)/', '}', $buffer);
588
+	    $all_data = json_decode($buffer, true);
589 589
 	    if (json_last_error() != JSON_ERROR_NONE) {
590 590
 		die(json_last_error_msg());
591 591
 	    }
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 			//$data['departure_airport_iata'] = $line[11];
608 608
 			//$data['arrival_airport_iata'] = $line[12];
609 609
 	    		//$data['emergency'] = ''; // emergency
610
-			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
610
+			$data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10]
611 611
 	    		$data['format_source'] = 'radarvirtueljson';
612 612
     			$data['id_source'] = $id_source;
613 613
 			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
@@ -622,13 +622,13 @@  discard block
 block discarded – undo
622 622
     	} elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
623 623
 	    //$buffer = $Common->getData($hosts[$id]);
624 624
 	    $buffer = $Common->getData($value['host'].'?'.time());
625
-	    $all_data = json_decode(utf8_encode($buffer),true);
625
+	    $all_data = json_decode(utf8_encode($buffer), true);
626 626
 	    
627 627
 	    if (isset($all_data['pireps'])) {
628 628
 	        foreach ($all_data['pireps'] as $line) {
629 629
 		    $data = array();
630 630
 		    $data['id'] = $line['id'];
631
-		    $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
631
+		    $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6);
632 632
 		    $data['ident'] = $line['callsign']; // ident
633 633
 		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
634 634
 		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
@@ -657,9 +657,9 @@  discard block
 block discarded – undo
657 657
 			$SI->add($data);
658 658
 		    //    print_r($data);
659 659
     		    } elseif ($line['icon'] == 'ct') {
660
-			$data['info'] = str_replace('^&sect;','<br />',$data['info']);
661
-			$data['info'] = str_replace('&amp;sect;','',$data['info']);
662
-			$typec = substr($data['ident'],-3);
660
+			$data['info'] = str_replace('^&sect;', '<br />', $data['info']);
661
+			$data['info'] = str_replace('&amp;sect;', '', $data['info']);
662
+			$typec = substr($data['ident'], -3);
663 663
 			$data['type'] = '';
664 664
 			if ($typec == 'APP') $data['type'] = 'Approach';
665 665
 			elseif ($typec == 'TWR') $data['type'] = 'Tower';
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 			elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
671 671
 			elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
672 672
 			else $data['type'] = 'Observer';
673
-			echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name']);
673
+			echo $ATC->add($data['ident'], '', $data['latitude'], $data['longitude'], '0', $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name']);
674 674
 		    }
675 675
 		    unset($data);
676 676
 		}
@@ -682,13 +682,13 @@  discard block
 block discarded – undo
682 682
 	    //$buffer = $Common->getData($hosts[$id]);
683 683
 	    if ($globalDebug) echo 'Get Data...'."\n";
684 684
 	    $buffer = $Common->getData($value['host']);
685
-	    $all_data = json_decode($buffer,true);
685
+	    $all_data = json_decode($buffer, true);
686 686
 	    if ($buffer != '' && is_array($all_data)) {
687 687
 		foreach ($all_data as $line) {
688 688
 	    	    $data = array();
689 689
 	    	    //$data['id'] = $line['id']; // id not usable
690 690
 	    	    if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
691
-	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
691
+	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex
692 692
 	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
693 693
 	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
694 694
 	    	    $data['ident'] = $line['flightnum']; // ident
@@ -710,12 +710,12 @@  discard block
 block discarded – undo
710 710
 		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
711 711
 		    if (isset($line['aircraftname'])) {
712 712
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
713
-			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
714
-	    		$aircraft_data = explode('-',$line['aircraftname']);
713
+			$line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']);
714
+	    		$aircraft_data = explode('-', $line['aircraftname']);
715 715
 	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0];
716 716
 	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1];
717 717
 	    		else {
718
-	    		    $aircraft_data = explode(' ',$line['aircraftname']);
718
+	    		    $aircraft_data = explode(' ', $line['aircraftname']);
719 719
 	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1];
720 720
 	    		    else $data['aircraft_icao'] = $line['aircraftname'];
721 721
 	    		}
@@ -749,9 +749,9 @@  discard block
 block discarded – undo
749 749
 		    //$value = $formats[$nb];
750 750
 		    $format = $globalSources[$nb]['format'];
751 751
         	    if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv') {
752
-        		$buffer = socket_read($r, 6000,PHP_NORMAL_READ);
752
+        		$buffer = socket_read($r, 6000, PHP_NORMAL_READ);
753 753
         	    } else {
754
-	    	        $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port);
754
+	    	        $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port);
755 755
 	    	    }
756 756
         	    //$buffer = socket_read($r, 60000,PHP_NORMAL_READ);
757 757
         	    //echo $buffer."\n";
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 		    //if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
760 760
 		    $error = false;
761 761
 		    //$SI::del();
762
-		    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
762
+		    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer));
763 763
 		    // SBS format is CSV format
764 764
 		    if ($buffer != '') {
765 765
 			$tt[$format] = 0;
@@ -778,10 +778,10 @@  discard block
 block discarded – undo
778 778
                         } elseif ($format == 'flightgearsp') {
779 779
                     	    //echo $buffer."\n";
780 780
                     	    if (strlen($buffer) > 5) {
781
-				$line = explode(',',$buffer);
781
+				$line = explode(',', $buffer);
782 782
 				$data = array();
783 783
 				//XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p
784
-				$data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6);
784
+				$data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6);
785 785
 				$data['ident'] = $line[6];
786 786
 				$data['aircraft_name'] = $line[7];
787 787
 				$data['longitude'] = $line[1];
@@ -792,21 +792,21 @@  discard block
 block discarded – undo
792 792
 				$data['datetime'] = date('Y-m-d H:i:s');
793 793
 				$data['format_source'] = 'flightgearsp';
794 794
 				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
795
-				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
795
+				$send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0);
796 796
 			    }
797 797
                         } elseif ($format == 'acars') {
798 798
                     	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
799 799
 			    $ACARS->add(trim($buffer));
800
-			    socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
800
+			    socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port);
801 801
 			    $ACARS->deleteLiveAcarsData();
802 802
 			} elseif ($format == 'flightgearmp') {
803
-			    if (substr($buffer,0,1) != '#') {
803
+			    if (substr($buffer, 0, 1) != '#') {
804 804
 				$data = array();
805 805
 				//echo $buffer."\n";
806
-				$line = explode(' ',$buffer);
806
+				$line = explode(' ', $buffer);
807 807
 				if (count($line) == 11) {
808
-				    $userserver = explode('@',$line[0]);
809
-				    $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex
808
+				    $userserver = explode('@', $line[0]);
809
+				    $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex
810 810
 				    $data['ident'] = $userserver[0];
811 811
 				    $data['registration'] = $userserver[0];
812 812
 				    $data['latitude'] = $line[4];
@@ -814,24 +814,24 @@  discard block
 block discarded – undo
814 814
 				    $data['altitude'] = $line[6];
815 815
 				    $data['datetime'] = date('Y-m-d H:i:s');
816 816
 				    $aircraft_type = $line[10];
817
-				    $aircraft_type = preg_split(':/:',$aircraft_type);
818
-				    $data['aircraft_name'] = substr(end($aircraft_type),0,-4);
817
+				    $aircraft_type = preg_split(':/:', $aircraft_type);
818
+				    $data['aircraft_name'] = substr(end($aircraft_type), 0, -4);
819 819
 				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
820 820
 				}
821 821
 			    }
822 822
 			} elseif ($format == 'beast') {
823 823
 			    echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n";
824 824
 			    die;
825
-			} elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') {
825
+			} elseif ($format == 'tsv' || substr($buffer, 0, 4) == 'clock') {
826 826
 			    $line = explode("\t", $buffer);
827
-			    for($k = 0; $k < count($line); $k=$k+2) {
827
+			    for ($k = 0; $k < count($line); $k = $k + 2) {
828 828
 				$key = $line[$k];
829
-			        $lined[$key] = $line[$k+1];
829
+			        $lined[$key] = $line[$k + 1];
830 830
 			    }
831 831
     			    if (count($lined) > 3) {
832 832
     				$data['hex'] = $lined['hexid'];
833 833
     				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
834
-    				$data['datetime'] = date('Y-m-d H:i:s');;
834
+    				$data['datetime'] = date('Y-m-d H:i:s'); ;
835 835
     				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
836 836
     				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
837 837
     				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
@@ -849,24 +849,24 @@  discard block
 block discarded – undo
849 849
     			    } else $error = true;
850 850
 			} elseif ($format == 'aprs' && $use_aprs) {
851 851
 			    if ($aprs_connect == 0) {
852
-				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
852
+				$send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0);
853 853
 				$aprs_connect = 1;
854 854
 			    }
855
-			    if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) {
855
+			    if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) {
856 856
 				$aprs_last_tx = time();
857 857
 				$data_aprs = "# Keep alive";
858
-				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
858
+				$send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0);
859 859
 			    }
860 860
 			    //echo 'Connect : '.$aprs_connect.' '.$buffer."\n";
861
-			    $buffer = str_replace('APRS <- ','',$buffer);
862
-			    $buffer = str_replace('APRS -> ','',$buffer);
863
-			    if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') {
861
+			    $buffer = str_replace('APRS <- ', '', $buffer);
862
+			    $buffer = str_replace('APRS -> ', '', $buffer);
863
+			    if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') {
864 864
 				$line = $APRS->parse($buffer);
865 865
 				if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) {
866 866
 				    $data = array();
867 867
 				    //print_r($line);
868 868
 				    $data['hex'] = $line['address'];
869
-				    $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
869
+				    $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']);
870 870
 				    //$data['datetime'] = date('Y-m-d H:i:s');
871 871
 				    $data['ident'] = $line['ident'];
872 872
 				    $data['latitude'] = $line['latitude'];
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 				    $currentdate = date('Y-m-d H:i:s');
887 887
 				    $aprsdate = strtotime($data['datetime']);
888 888
 				    // Accept data if time <= system time + 20s
889
-				    if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data);
889
+				    if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate) + 20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data);
890 890
 				    else {
891 891
 					if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
892 892
 					else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
 				connect_all($sourceee);
972 972
 				$sourceee = array();
973 973
 				//connect_all($globalSources);
974
-				$tt[$format]=0;
974
+				$tt[$format] = 0;
975 975
 				break;
976 976
 			    }
977 977
 			}
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
 		}
980 980
 	    } else {
981 981
 		$error = socket_strerror(socket_last_error());
982
-		if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
982
+		if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n";
983 983
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY) || time() - $time >= $timeout) {
984 984
 			if (isset($globalDebug)) echo "Restarting...\n";
985 985
 			// Restart the script if possible
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 			    if ($globalDebug) echo "Shutdown all sockets...";
988 988
 			    
989 989
 			    foreach ($sockets as $sock) {
990
-				@socket_shutdown($sock,2);
990
+				@socket_shutdown($sock, 2);
991 991
 				@socket_close($sock);
992 992
 			    }
993 993
 			    
Please login to merge, or discard this patch.
Indentation   +648 added lines, -648 removed lines patch added patch discarded remove patch
@@ -19,44 +19,44 @@  discard block
 block discarded – undo
19 19
 // Check if schema is at latest version
20 20
 $Connection = new Connection();
21 21
 if ($Connection->latest() === false) {
22
-    echo "You MUST update to latest schema. Run install/index.php";
23
-    exit();
22
+	echo "You MUST update to latest schema. Run install/index.php";
23
+	exit();
24 24
 }
25 25
 
26 26
 
27 27
 // This is to be compatible with old version of settings.php
28 28
 if (!isset($globalSources)) {
29
-    if (isset($globalSBS1Hosts)) {
30
-        //$hosts = $globalSBS1Hosts;
31
-        foreach ($globalSBS1Hosts as $host) {
32
-	    $globalSources[] = array('host' => $host);
33
-    	}
34
-    } else {
35
-        if (!isset($globalSBS1Host)) {
36
-	    echo '$globalSources MUST be defined !';
37
-	    die;
29
+	if (isset($globalSBS1Hosts)) {
30
+		//$hosts = $globalSBS1Hosts;
31
+		foreach ($globalSBS1Hosts as $host) {
32
+		$globalSources[] = array('host' => $host);
33
+		}
34
+	} else {
35
+		if (!isset($globalSBS1Host)) {
36
+		echo '$globalSources MUST be defined !';
37
+		die;
38 38
 	}
39 39
 	//$hosts = array($globalSBS1Host.':'.$globalSBS1Port);
40 40
 	$globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port);
41
-    }
41
+	}
42 42
 }
43 43
 
44 44
 $options = getopt('s::',array('source::','server','idsource::'));
45 45
 //if (isset($options['s'])) $hosts = array($options['s']);
46 46
 //elseif (isset($options['source'])) $hosts = array($options['source']);
47 47
 if (isset($options['s'])) {
48
-    $globalSources = array();
49
-    $globalSources[] = array('host' => $options['s']);
48
+	$globalSources = array();
49
+	$globalSources[] = array('host' => $options['s']);
50 50
 } elseif (isset($options['source'])) {
51
-    $globalSources = array();
52
-    $globalSources[] = array('host' => $options['source']);
51
+	$globalSources = array();
52
+	$globalSources[] = array('host' => $options['source']);
53 53
 }
54 54
 if (isset($options['server'])) $globalServer = TRUE;
55 55
 if (isset($options['idsource'])) $id_source = $options['idsource'];
56 56
 else $id_source = 1;
57 57
 if (isset($globalServer) && $globalServer) {
58
-    if ($globalDebug) echo "Using Server Mode\n";
59
-    $SI=new SpotterServer();
58
+	if ($globalDebug) echo "Using Server Mode\n";
59
+	$SI=new SpotterServer();
60 60
 } else $SI=new SpotterImport($Connection->db);
61 61
 //$APRS=new APRS($Connection->db);
62 62
 $SBS=new SBS();
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 //$servertz = system('date +%Z');
67 67
 // signal handler - playing nice with sockets and dump1090
68 68
 if (function_exists('pcntl_fork')) {
69
-    pcntl_signal(SIGINT,  function() {
70
-        global $sockets;
71
-        echo "\n\nctrl-c or kill signal received. Tidying up ... ";
72
-        die("Bye!\n");
73
-    });
74
-    pcntl_signal_dispatch();
69
+	pcntl_signal(SIGINT,  function() {
70
+		global $sockets;
71
+		echo "\n\nctrl-c or kill signal received. Tidying up ... ";
72
+		die("Bye!\n");
73
+	});
74
+	pcntl_signal_dispatch();
75 75
 }
76 76
 
77 77
 // let's try and connect
@@ -80,157 +80,157 @@  discard block
 block discarded – undo
80 80
 $aprs_full = false;
81 81
 
82 82
 function create_socket($host, $port, &$errno, &$errstr) {
83
-    $ip = gethostbyname($host);
84
-    $s = socket_create(AF_INET, SOCK_STREAM, 0);
85
-    $r = @socket_connect($s, $ip, $port);
86
-    if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
87
-    if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
88
-        return $s;
89
-    }
90
-    $errno = socket_last_error($s);
91
-    $errstr = socket_strerror($errno);
92
-    socket_close($s);
93
-    return false;
83
+	$ip = gethostbyname($host);
84
+	$s = socket_create(AF_INET, SOCK_STREAM, 0);
85
+	$r = @socket_connect($s, $ip, $port);
86
+	if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
87
+	if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
88
+		return $s;
89
+	}
90
+	$errno = socket_last_error($s);
91
+	$errstr = socket_strerror($errno);
92
+	socket_close($s);
93
+	return false;
94 94
 }
95 95
 
96 96
 function create_socket_udp($host, $port, &$errno, &$errstr) {
97
-    echo "UDP !!";
98
-    $ip = gethostbyname($host);
99
-    $s = socket_create(AF_INET, SOCK_DGRAM, 0);
100
-    $r = @socket_bind($s, $ip, $port);
101
-    if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
102
-        return $s;
103
-    }
104
-    $errno = socket_last_error($s);
105
-    $errstr = socket_strerror($errno);
106
-    socket_close($s);
107
-    return false;
97
+	echo "UDP !!";
98
+	$ip = gethostbyname($host);
99
+	$s = socket_create(AF_INET, SOCK_DGRAM, 0);
100
+	$r = @socket_bind($s, $ip, $port);
101
+	if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
102
+		return $s;
103
+	}
104
+	$errno = socket_last_error($s);
105
+	$errstr = socket_strerror($errno);
106
+	socket_close($s);
107
+	return false;
108 108
 }
109 109
 
110 110
 function connect_all($hosts) {
111
-    //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
112
-    global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
113
-    if ($globalDebug) echo 'Connect to all...'."\n";
114
-    foreach ($hosts as $id => $value) {
111
+	//global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
112
+	global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
113
+	if ($globalDebug) echo 'Connect to all...'."\n";
114
+	foreach ($hosts as $id => $value) {
115 115
 	$host = $value['host'];
116 116
 	$globalSources[$id]['last_exec'] = 0;
117 117
 	// Here we check type of source(s)
118 118
 	if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) {
119
-            if (preg_match('/deltadb.txt$/i',$host)) {
120
-        	//$formats[$id] = 'deltadbtxt';
121
-        	$globalSources[$id]['format'] = 'deltadbtxt';
122
-        	//$last_exec['deltadbtxt'] = 0;
123
-        	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
124
-            } else if (preg_match('/vatsim-data.txt$/i',$host)) {
125
-        	//$formats[$id] = 'vatsimtxt';
126
-        	$globalSources[$id]['format'] = 'vatsimtxt';
127
-        	//$last_exec['vatsimtxt'] = 0;
128
-        	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
129
-    	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
130
-        	//$formats[$id] = 'aircraftlistjson';
131
-        	$globalSources[$id]['format'] = 'aircraftlistjson';
132
-        	//$last_exec['aircraftlistjson'] = 0;
133
-        	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
134
-    	    } else if (preg_match('/opensky/i',$host)) {
135
-        	//$formats[$id] = 'aircraftlistjson';
136
-        	$globalSources[$id]['format'] = 'opensky';
137
-        	//$last_exec['aircraftlistjson'] = 0;
138
-        	if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
139
-    	    } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) {
140
-        	//$formats[$id] = 'radarvirtueljson';
141
-        	$globalSources[$id]['format'] = 'radarvirtueljson';
142
-        	//$last_exec['radarvirtueljson'] = 0;
143
-        	if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n";
144
-        	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
145
-        	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
146
-        	    exit(0);
147
-        	}
148
-    	    } else if (preg_match('/planeUpdateFAA.php$/i',$host)) {
149
-        	//$formats[$id] = 'planeupdatefaa';
150
-        	$globalSources[$id]['format'] = 'planeupdatefaa';
151
-        	//$last_exec['planeupdatefaa'] = 0;
152
-        	if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
153
-        	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
154
-        	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
155
-        	    exit(0);
156
-        	}
157
-            } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) {
158
-        	//$formats[$id] = 'phpvmacars';
159
-        	$globalSources[$id]['format'] = 'phpvmacars';
160
-        	//$last_exec['phpvmacars'] = 0;
161
-        	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
162
-            } else if (preg_match('/whazzup/i',$host)) {
163
-        	//$formats[$id] = 'whazzup';
164
-        	$globalSources[$id]['format'] = 'whazzup';
165
-        	//$last_exec['whazzup'] = 0;
166
-        	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
167
-            } else if (preg_match('/recentpireps/i',$host)) {
168
-        	//$formats[$id] = 'pirepsjson';
169
-        	$globalSources[$id]['format'] = 'pirepsjson';
170
-        	//$last_exec['pirepsjson'] = 0;
171
-        	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
172
-            } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
173
-        	//$formats[$id] = 'fr24json';
174
-        	$globalSources[$id]['format'] = 'fr24json';
175
-        	//$last_exec['fr24json'] = 0;
176
-        	if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
177
-        	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
178
-        	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
179
-        	    exit(0);
180
-        	}
181
-            //} else if (preg_match('/10001/',$host)) {
182
-            } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
183
-        	//$formats[$id] = 'tsv';
184
-        	$globalSources[$id]['format'] = 'tsv';
185
-        	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
186
-            }
187
-        } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
188
-        	if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
189
-        } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
190
-	    $hostport = explode(':',$host);
191
-	    if (isset($hostport[1])) {
119
+			if (preg_match('/deltadb.txt$/i',$host)) {
120
+			//$formats[$id] = 'deltadbtxt';
121
+			$globalSources[$id]['format'] = 'deltadbtxt';
122
+			//$last_exec['deltadbtxt'] = 0;
123
+			if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
124
+			} else if (preg_match('/vatsim-data.txt$/i',$host)) {
125
+			//$formats[$id] = 'vatsimtxt';
126
+			$globalSources[$id]['format'] = 'vatsimtxt';
127
+			//$last_exec['vatsimtxt'] = 0;
128
+			if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
129
+			} else if (preg_match('/aircraftlist.json$/i',$host)) {
130
+			//$formats[$id] = 'aircraftlistjson';
131
+			$globalSources[$id]['format'] = 'aircraftlistjson';
132
+			//$last_exec['aircraftlistjson'] = 0;
133
+			if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
134
+			} else if (preg_match('/opensky/i',$host)) {
135
+			//$formats[$id] = 'aircraftlistjson';
136
+			$globalSources[$id]['format'] = 'opensky';
137
+			//$last_exec['aircraftlistjson'] = 0;
138
+			if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
139
+			} else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) {
140
+			//$formats[$id] = 'radarvirtueljson';
141
+			$globalSources[$id]['format'] = 'radarvirtueljson';
142
+			//$last_exec['radarvirtueljson'] = 0;
143
+			if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n";
144
+			if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
145
+				echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
146
+				exit(0);
147
+			}
148
+			} else if (preg_match('/planeUpdateFAA.php$/i',$host)) {
149
+			//$formats[$id] = 'planeupdatefaa';
150
+			$globalSources[$id]['format'] = 'planeupdatefaa';
151
+			//$last_exec['planeupdatefaa'] = 0;
152
+			if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
153
+			if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
154
+				echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
155
+				exit(0);
156
+			}
157
+			} else if (preg_match('/\/action.php\/acars\/data$/i',$host)) {
158
+			//$formats[$id] = 'phpvmacars';
159
+			$globalSources[$id]['format'] = 'phpvmacars';
160
+			//$last_exec['phpvmacars'] = 0;
161
+			if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
162
+			} else if (preg_match('/whazzup/i',$host)) {
163
+			//$formats[$id] = 'whazzup';
164
+			$globalSources[$id]['format'] = 'whazzup';
165
+			//$last_exec['whazzup'] = 0;
166
+			if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
167
+			} else if (preg_match('/recentpireps/i',$host)) {
168
+			//$formats[$id] = 'pirepsjson';
169
+			$globalSources[$id]['format'] = 'pirepsjson';
170
+			//$last_exec['pirepsjson'] = 0;
171
+			if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
172
+			} else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
173
+			//$formats[$id] = 'fr24json';
174
+			$globalSources[$id]['format'] = 'fr24json';
175
+			//$last_exec['fr24json'] = 0;
176
+			if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
177
+			if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
178
+				echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
179
+				exit(0);
180
+			}
181
+			//} else if (preg_match('/10001/',$host)) {
182
+			} else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
183
+			//$formats[$id] = 'tsv';
184
+			$globalSources[$id]['format'] = 'tsv';
185
+			if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
186
+			}
187
+		} elseif (filter_var($host,FILTER_VALIDATE_URL)) {
188
+			if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
189
+		} elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
190
+		$hostport = explode(':',$host);
191
+		if (isset($hostport[1])) {
192 192
 		$port = $hostport[1];
193 193
 		$hostn = $hostport[0];
194
-	    } else {
194
+		} else {
195 195
 		$port = $globalSources[$id]['port'];
196 196
 		$hostn = $globalSources[$id]['host'];
197
-	    }
198
-	    if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) {
199
-        	$s = create_socket($hostn,$port, $errno, $errstr);
200
-    	    } else {
201
-        	$s = create_socket_udp($hostn,$port, $errno, $errstr);
202
-	    }
203
-	    if ($s) {
204
-    	        $sockets[$id] = $s;
205
-    	        if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') {
206
-		    if (preg_match('/aprs/',$hostn)) {
197
+		}
198
+		if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) {
199
+			$s = create_socket($hostn,$port, $errno, $errstr);
200
+			} else {
201
+			$s = create_socket_udp($hostn,$port, $errno, $errstr);
202
+		}
203
+		if ($s) {
204
+				$sockets[$id] = $s;
205
+				if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') {
206
+			if (preg_match('/aprs/',$hostn)) {
207 207
 			//$formats[$id] = 'aprs';
208 208
 			$globalSources[$id]['format'] = 'aprs';
209 209
 			//$aprs_connect = 0;
210 210
 			//$use_aprs = true;
211
-    		    } elseif ($port == '10001') {
212
-        		//$formats[$id] = 'tsv';
213
-        		$globalSources[$id]['format'] = 'tsv';
214
-		    } elseif ($port == '30002') {
215
-        		//$formats[$id] = 'raw';
216
-        		$globalSources[$id]['format'] = 'raw';
217
-		    } elseif ($port == '5001') {
218
-        		//$formats[$id] = 'raw';
219
-        		$globalSources[$id]['format'] = 'flightgearmp';
220
-		    } elseif ($port == '30005') {
211
+				} elseif ($port == '10001') {
212
+				//$formats[$id] = 'tsv';
213
+				$globalSources[$id]['format'] = 'tsv';
214
+			} elseif ($port == '30002') {
215
+				//$formats[$id] = 'raw';
216
+				$globalSources[$id]['format'] = 'raw';
217
+			} elseif ($port == '5001') {
218
+				//$formats[$id] = 'raw';
219
+				$globalSources[$id]['format'] = 'flightgearmp';
220
+			} elseif ($port == '30005') {
221 221
 			// Not yet supported
222
-        		//$formats[$id] = 'beast';
223
-        		$globalSources[$id]['format'] = 'beast';
224
-		    //} else $formats[$id] = 'sbs';
225
-		    } else $globalSources[$id]['format'] = 'sbs';
226
-		    //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
222
+				//$formats[$id] = 'beast';
223
+				$globalSources[$id]['format'] = 'beast';
224
+			//} else $formats[$id] = 'sbs';
225
+			} else $globalSources[$id]['format'] = 'sbs';
226
+			//if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
227 227
 		}
228 228
 		if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
229
-            } else {
229
+			} else {
230 230
 		if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
231
-    	    }
232
-        }
233
-    }
231
+			}
232
+		}
233
+	}
234 234
 }
235 235
 if (!isset($globalMinFetch)) $globalMinFetch = 15;
236 236
 
@@ -257,18 +257,18 @@  discard block
 block discarded – undo
257 257
 	die;
258 258
 }
259 259
 foreach ($globalSources as $key => $source) {
260
-    if (!isset($source['format'])) {
261
-        $globalSources[$key]['format'] = 'auto';
262
-    }
260
+	if (!isset($source['format'])) {
261
+		$globalSources[$key]['format'] = 'auto';
262
+	}
263 263
 }
264 264
 connect_all($globalSources);
265 265
 foreach ($globalSources as $key => $source) {
266
-    if (isset($source['format']) && $source['format'] == 'aprs') {
266
+	if (isset($source['format']) && $source['format'] == 'aprs') {
267 267
 	$aprs_connect = 0;
268 268
 	$use_aprs = true;
269 269
 	if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true;
270 270
 	break;
271
-    }
271
+	}
272 272
 }
273 273
 
274 274
 if ($use_aprs) {
@@ -308,67 +308,67 @@  discard block
 block discarded – undo
308 308
 
309 309
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
310 310
 while ($i > 0) {
311
-    if (!$globalDaemon) $i = $endtime-time();
312
-    // Delete old ATC
313
-    if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
311
+	if (!$globalDaemon) $i = $endtime-time();
312
+	// Delete old ATC
313
+	if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
314 314
 	if ($globalDebug) echo 'Delete old ATC...'."\n";
315
-        $ATC->deleteOldATC();
316
-    }
315
+		$ATC->deleteOldATC();
316
+	}
317 317
     
318
-    if (count($last_exec) > 0) {
318
+	if (count($last_exec) > 0) {
319 319
 	$max = $globalMinFetch;
320 320
 	foreach ($last_exec as $last) {
321
-	    if ((time() - $last['last']) < $max) $max = time() - $last['last'];
321
+		if ((time() - $last['last']) < $max) $max = time() - $last['last'];
322 322
 	}
323 323
 	if ($max != $globalMinFetch) {
324
-	    if ($globalDebug) echo 'Sleeping...'."\n";
325
-	    sleep($globalMinFetch-$max+2);
324
+		if ($globalDebug) echo 'Sleeping...'."\n";
325
+		sleep($globalMinFetch-$max+2);
326
+	}
326 327
 	}
327
-    }
328 328
 
329 329
     
330
-    //foreach ($formats as $id => $value) {
331
-    foreach ($globalSources as $id => $value) {
330
+	//foreach ($formats as $id => $value) {
331
+	foreach ($globalSources as $id => $value) {
332 332
 	if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0;
333 333
 	if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
334
-	    //$buffer = $Common->getData($hosts[$id]);
335
-	    $buffer = $Common->getData($value['host']);
336
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
337
-	    $buffer = explode('\n',$buffer);
338
-	    foreach ($buffer as $line) {
339
-    		if ($line != '') {
340
-    		    $line = explode(',', $line);
341
-	            $data = array();
342
-	            $data['hex'] = $line[1]; // hex
343
-	            $data['ident'] = $line[2]; // ident
344
-	            $data['altitude'] = $line[3]; // altitude
345
-	            $data['speed'] = $line[4]; // speed
346
-	            $data['heading'] = $line[5]; // heading
347
-	            $data['latitude'] = $line[6]; // lat
348
-	            $data['longitude'] = $line[7]; // long
349
-	            $data['verticalrate'] = ''; // vertical rate
350
-	            $data['squawk'] = ''; // squawk
351
-	            $data['emergency'] = ''; // emergency
352
-		    $data['datetime'] = date('Y-m-d H:i:s');
353
-		    $data['format_source'] = 'deltadbtxt';
354
-    		    $data['id_source'] = $id_source;
355
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
356
-		    if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
357
-    		    $SI->add($data);
358
-		    unset($data);
359
-    		}
360
-    	    }
361
-    	    $last_exec[$id]['last'] = time();
334
+		//$buffer = $Common->getData($hosts[$id]);
335
+		$buffer = $Common->getData($value['host']);
336
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
337
+		$buffer = explode('\n',$buffer);
338
+		foreach ($buffer as $line) {
339
+			if ($line != '') {
340
+				$line = explode(',', $line);
341
+				$data = array();
342
+				$data['hex'] = $line[1]; // hex
343
+				$data['ident'] = $line[2]; // ident
344
+				$data['altitude'] = $line[3]; // altitude
345
+				$data['speed'] = $line[4]; // speed
346
+				$data['heading'] = $line[5]; // heading
347
+				$data['latitude'] = $line[6]; // lat
348
+				$data['longitude'] = $line[7]; // long
349
+				$data['verticalrate'] = ''; // vertical rate
350
+				$data['squawk'] = ''; // squawk
351
+				$data['emergency'] = ''; // emergency
352
+			$data['datetime'] = date('Y-m-d H:i:s');
353
+			$data['format_source'] = 'deltadbtxt';
354
+				$data['id_source'] = $id_source;
355
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
356
+			if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
357
+				$SI->add($data);
358
+			unset($data);
359
+			}
360
+			}
361
+			$last_exec[$id]['last'] = time();
362 362
 	//} elseif (($value == 'whazzup' && (time() - $last_exec['whazzup'] > $globalMinFetch)) || ($value == 'vatsimtxt' && (time() - $last_exec['vatsimtxt'] > $globalMinFetch))) {
363 363
 	} elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $value[' last_exec'] > $globalMinFetch))) {
364
-	    //$buffer = $Common->getData($hosts[$id]);
365
-	    $buffer = $Common->getData($value['host']);
366
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
367
-	    $buffer = explode('\n',$buffer);
368
-	    foreach ($buffer as $line) {
369
-    		if ($line != '') {
370
-    		    $line = explode(':', $line);
371
-    		    if (count($line) > 30 && $line[0] != 'callsign') {
364
+		//$buffer = $Common->getData($hosts[$id]);
365
+		$buffer = $Common->getData($value['host']);
366
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
367
+		$buffer = explode('\n',$buffer);
368
+		foreach ($buffer as $line) {
369
+			if ($line != '') {
370
+				$line = explode(':', $line);
371
+				if (count($line) > 30 && $line[0] != 'callsign') {
372 372
 			$data = array();
373 373
 			$data['id'] = $line[1].'-'.$line[0];
374 374
 			$data['pilot_id'] = $line[1];
@@ -380,35 +380,35 @@  discard block
 block discarded – undo
380 380
 			if (isset($line[45])) $data['heading'] = $line[45]; // heading
381 381
 			elseif (isset($line[38])) $data['heading'] = $line[38]; // heading
382 382
 			$data['latitude'] = $line[5]; // lat
383
-	        	$data['longitude'] = $line[6]; // long
384
-	        	$data['verticalrate'] = ''; // vertical rate
385
-	        	$data['squawk'] = ''; // squawk
386
-	        	$data['emergency'] = ''; // emergency
387
-	        	$data['waypoints'] = $line[30];
383
+				$data['longitude'] = $line[6]; // long
384
+				$data['verticalrate'] = ''; // vertical rate
385
+				$data['squawk'] = ''; // squawk
386
+				$data['emergency'] = ''; // emergency
387
+				$data['waypoints'] = $line[30];
388 388
 			$data['datetime'] = date('Y-m-d H:i:s');
389 389
 			//$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37]));
390
-		        $data['departure_airport_icao'] = $line[11];
391
-		        $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':');
392
-		        $data['arrival_airport_icao'] = $line[13];
390
+				$data['departure_airport_icao'] = $line[11];
391
+				$data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':');
392
+				$data['arrival_airport_icao'] = $line[13];
393 393
 			$data['frequency'] = $line[4];
394 394
 			$data['type'] = $line[18];
395 395
 			$data['range'] = $line[19];
396 396
 			if (isset($line[35])) $data['info'] = $line[35];
397
-    			$data['id_source'] = $id_source;
398
-	    		//$data['arrival_airport_time'] = ;
399
-	    		if ($line[9] != '') {
400
-	    		    $aircraft_data = explode('/',$line[9]);
401
-	    		    if (isset($aircraft_data[1])) {
402
-	    			$data['aircraft_icao'] = $aircraft_data[1];
403
-	    		    }
404
-        		}
405
-	    		/*
397
+				$data['id_source'] = $id_source;
398
+				//$data['arrival_airport_time'] = ;
399
+				if ($line[9] != '') {
400
+					$aircraft_data = explode('/',$line[9]);
401
+					if (isset($aircraft_data[1])) {
402
+					$data['aircraft_icao'] = $aircraft_data[1];
403
+					}
404
+				}
405
+				/*
406 406
 	    		if ($value == 'whazzup') $data['format_source'] = 'whazzup';
407 407
 	    		elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt';
408 408
 	    		*/
409
-	    		$data['format_source'] = $value['format'];
409
+				$data['format_source'] = $value['format'];
410 410
 			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
411
-    			if ($line[3] == 'PILOT') $SI->add($data);
411
+				if ($line[3] == 'PILOT') $SI->add($data);
412 412
 			elseif ($line[3] == 'ATC') {
413 413
 				//print_r($data);
414 414
 				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
@@ -426,240 +426,240 @@  discard block
 block discarded – undo
426 426
 				
427 427
 				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']);
428 428
 			}
429
-    			unset($data);
430
-    		    }
431
-    		}
432
-    	    }
433
-    	    //if ($value == 'whazzup') $last_exec['whazzup'] = time();
434
-    	    //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time();
435
-    	    $last_exec[$id]['last'] = time();
436
-    	//} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) {
437
-    	} elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
438
-	    $buffer = $Common->getData($value['host'],'get','','','','','20');
439
-	    if ($buffer != '') {
440
-	    $all_data = json_decode($buffer,true);
441
-	    if (isset($all_data['acList'])) {
429
+				unset($data);
430
+				}
431
+			}
432
+			}
433
+			//if ($value == 'whazzup') $last_exec['whazzup'] = time();
434
+			//elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time();
435
+			$last_exec[$id]['last'] = time();
436
+		//} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) {
437
+		} elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
438
+		$buffer = $Common->getData($value['host'],'get','','','','','20');
439
+		if ($buffer != '') {
440
+		$all_data = json_decode($buffer,true);
441
+		if (isset($all_data['acList'])) {
442 442
 		foreach ($all_data['acList'] as $line) {
443
-		    $data = array();
444
-		    $data['hex'] = $line['Icao']; // hex
445
-		    if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
446
-		    if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
447
-		    if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
448
-		    if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
449
-		    if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
450
-		    if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
451
-		    //$data['verticalrate'] = $line['']; // verticale rate
452
-		    if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
453
-		    $data['emergency'] = ''; // emergency
454
-		    if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
455
-		    /*
443
+			$data = array();
444
+			$data['hex'] = $line['Icao']; // hex
445
+			if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
446
+			if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
447
+			if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
448
+			if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
449
+			if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
450
+			if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
451
+			//$data['verticalrate'] = $line['']; // verticale rate
452
+			if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
453
+			$data['emergency'] = ''; // emergency
454
+			if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
455
+			/*
456 456
 		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000);
457 457
 		    else $data['datetime'] = date('Y-m-d H:i:s');
458 458
 		    */
459
-		    $data['datetime'] = date('Y-m-d H:i:s');
460
-		    if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
461
-	    	    $data['format_source'] = 'aircraftlistjson';
462
-		    $data['id_source'] = $id_source;
463
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
464
-		    if (isset($data['datetime'])) $SI->add($data);
465
-		    unset($data);
459
+			$data['datetime'] = date('Y-m-d H:i:s');
460
+			if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
461
+				$data['format_source'] = 'aircraftlistjson';
462
+			$data['id_source'] = $id_source;
463
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
464
+			if (isset($data['datetime'])) $SI->add($data);
465
+			unset($data);
466 466
 		}
467
-	    } else {
467
+		} else {
468 468
 		foreach ($all_data as $line) {
469
-		    $data = array();
470
-		    $data['hex'] = $line['hex']; // hex
471
-		    $data['ident'] = $line['flight']; // ident
472
-		    $data['altitude'] = $line['altitude']; // altitude
473
-		    $data['speed'] = $line['speed']; // speed
474
-		    $data['heading'] = $line['track']; // heading
475
-		    $data['latitude'] = $line['lat']; // lat
476
-		    $data['longitude'] = $line['lon']; // long
477
-		    $data['verticalrate'] = $line['vrt']; // verticale rate
478
-		    $data['squawk'] = $line['squawk']; // squawk
479
-		    $data['emergency'] = ''; // emergency
480
-		    $data['datetime'] = date('Y-m-d H:i:s');
481
-	    	    $data['format_source'] = 'aircraftlistjson';
482
-    		    $data['id_source'] = $id_source;
483
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
484
-		    $SI->add($data);
485
-		    unset($data);
469
+			$data = array();
470
+			$data['hex'] = $line['hex']; // hex
471
+			$data['ident'] = $line['flight']; // ident
472
+			$data['altitude'] = $line['altitude']; // altitude
473
+			$data['speed'] = $line['speed']; // speed
474
+			$data['heading'] = $line['track']; // heading
475
+			$data['latitude'] = $line['lat']; // lat
476
+			$data['longitude'] = $line['lon']; // long
477
+			$data['verticalrate'] = $line['vrt']; // verticale rate
478
+			$data['squawk'] = $line['squawk']; // squawk
479
+			$data['emergency'] = ''; // emergency
480
+			$data['datetime'] = date('Y-m-d H:i:s');
481
+				$data['format_source'] = 'aircraftlistjson';
482
+				$data['id_source'] = $id_source;
483
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
484
+			$SI->add($data);
485
+			unset($data);
486 486
 		}
487
-	    }
488
-	    }
489
-    	    //$last_exec['aircraftlistjson'] = time();
490
-    	    $last_exec[$id]['last'] = time();
491
-    	//} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) {
492
-    	} elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
493
-	    $buffer = $Common->getData($value['host']);
494
-	    $all_data = json_decode($buffer,true);
495
-	    if (isset($all_data['planes'])) {
487
+		}
488
+		}
489
+			//$last_exec['aircraftlistjson'] = time();
490
+			$last_exec[$id]['last'] = time();
491
+		//} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) {
492
+		} elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
493
+		$buffer = $Common->getData($value['host']);
494
+		$all_data = json_decode($buffer,true);
495
+		if (isset($all_data['planes'])) {
496 496
 		foreach ($all_data['planes'] as $key => $line) {
497
-		    $data = array();
498
-		    $data['hex'] = $key; // hex
499
-		    $data['ident'] = $line[3]; // ident
500
-		    $data['altitude'] = $line[6]; // altitude
501
-		    $data['speed'] = $line[8]; // speed
502
-		    $data['heading'] = $line[7]; // heading
503
-		    $data['latitude'] = $line[4]; // lat
504
-		    $data['longitude'] = $line[5]; // long
505
-		    //$data['verticalrate'] = $line[]; // verticale rate
506
-		    $data['squawk'] = $line[10]; // squawk
507
-		    $data['emergency'] = ''; // emergency
508
-		    $data['registration'] = $line[2];
509
-		    $data['aircraft_icao'] = $line[0];
510
-		    $deparr = explode('-',$line[1]);
511
-		    if (count($deparr) == 2) {
497
+			$data = array();
498
+			$data['hex'] = $key; // hex
499
+			$data['ident'] = $line[3]; // ident
500
+			$data['altitude'] = $line[6]; // altitude
501
+			$data['speed'] = $line[8]; // speed
502
+			$data['heading'] = $line[7]; // heading
503
+			$data['latitude'] = $line[4]; // lat
504
+			$data['longitude'] = $line[5]; // long
505
+			//$data['verticalrate'] = $line[]; // verticale rate
506
+			$data['squawk'] = $line[10]; // squawk
507
+			$data['emergency'] = ''; // emergency
508
+			$data['registration'] = $line[2];
509
+			$data['aircraft_icao'] = $line[0];
510
+			$deparr = explode('-',$line[1]);
511
+			if (count($deparr) == 2) {
512 512
 			$data['departure_airport_icao'] = $deparr[0];
513 513
 			$data['arrival_airport_icao'] = $deparr[1];
514
-		    }
515
-		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
516
-	    	    $data['format_source'] = 'planeupdatefaa';
517
-    		    $data['id_source'] = $id_source;
518
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
519
-		    $SI->add($data);
520
-		    unset($data);
514
+			}
515
+			$data['datetime'] = date('Y-m-d H:i:s',$line[9]);
516
+				$data['format_source'] = 'planeupdatefaa';
517
+				$data['id_source'] = $id_source;
518
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
519
+			$SI->add($data);
520
+			unset($data);
521 521
 		}
522
-	    }
523
-    	    //$last_exec['planeupdatefaa'] = time();
524
-    	    $last_exec[$id]['last'] = time();
525
-    	} elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
526
-	    $buffer = $Common->getData($value['host']);
527
-	    $all_data = json_decode($buffer,true);
528
-	    if (isset($all_data['states'])) {
522
+		}
523
+			//$last_exec['planeupdatefaa'] = time();
524
+			$last_exec[$id]['last'] = time();
525
+		} elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
526
+		$buffer = $Common->getData($value['host']);
527
+		$all_data = json_decode($buffer,true);
528
+		if (isset($all_data['states'])) {
529 529
 		foreach ($all_data['states'] as $key => $line) {
530
-		    $data = array();
531
-		    $data['hex'] = $line[0]; // hex
532
-		    $data['ident'] = trim($line[1]); // ident
533
-		    $data['altitude'] = round($line[7]*3.28084); // altitude
534
-		    $data['speed'] = round($line[9]*1.94384); // speed
535
-		    $data['heading'] = round($line[10]); // heading
536
-		    $data['latitude'] = $line[5]; // lat
537
-		    $data['longitude'] = $line[6]; // long
538
-		    $data['verticalrate'] = $line[11]; // verticale rate
539
-		    //$data['squawk'] = $line[10]; // squawk
540
-		    //$data['emergency'] = ''; // emergency
541
-		    //$data['registration'] = $line[2];
542
-		    //$data['aircraft_icao'] = $line[0];
543
-		    $data['datetime'] = date('Y-m-d H:i:s',$line[3]);
544
-	    	    $data['format_source'] = 'opensky';
545
-    		    $data['id_source'] = $id_source;
546
-		    $SI->add($data);
547
-		    unset($data);
530
+			$data = array();
531
+			$data['hex'] = $line[0]; // hex
532
+			$data['ident'] = trim($line[1]); // ident
533
+			$data['altitude'] = round($line[7]*3.28084); // altitude
534
+			$data['speed'] = round($line[9]*1.94384); // speed
535
+			$data['heading'] = round($line[10]); // heading
536
+			$data['latitude'] = $line[5]; // lat
537
+			$data['longitude'] = $line[6]; // long
538
+			$data['verticalrate'] = $line[11]; // verticale rate
539
+			//$data['squawk'] = $line[10]; // squawk
540
+			//$data['emergency'] = ''; // emergency
541
+			//$data['registration'] = $line[2];
542
+			//$data['aircraft_icao'] = $line[0];
543
+			$data['datetime'] = date('Y-m-d H:i:s',$line[3]);
544
+				$data['format_source'] = 'opensky';
545
+				$data['id_source'] = $id_source;
546
+			$SI->add($data);
547
+			unset($data);
548
+		}
548 549
 		}
549
-	    }
550
-    	    //$last_exec['planeupdatefaa'] = time();
551
-    	    $last_exec[$id]['last'] = time();
552
-    	//} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) {
553
-    	} elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
554
-	    //$buffer = $Common->getData($hosts[$id]);
555
-	    $buffer = $Common->getData($value['host']);
556
-	    $all_data = json_decode($buffer,true);
557
-	    foreach ($all_data as $key => $line) {
550
+			//$last_exec['planeupdatefaa'] = time();
551
+			$last_exec[$id]['last'] = time();
552
+		//} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) {
553
+		} elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
554
+		//$buffer = $Common->getData($hosts[$id]);
555
+		$buffer = $Common->getData($value['host']);
556
+		$all_data = json_decode($buffer,true);
557
+		foreach ($all_data as $key => $line) {
558 558
 		if ($key != 'full_count' && $key != 'version' && $key != 'stats') {
559
-		    $data = array();
560
-		    $data['hex'] = $line[0];
561
-		    $data['ident'] = $line[16]; //$line[13]
562
-	    	    $data['altitude'] = $line[4]; // altitude
563
-	    	    $data['speed'] = $line[5]; // speed
564
-	    	    $data['heading'] = $line[3]; // heading
565
-	    	    $data['latitude'] = $line[1]; // lat
566
-	    	    $data['longitude'] = $line[2]; // long
567
-	    	    $data['verticalrate'] = $line[15]; // verticale rate
568
-	    	    $data['squawk'] = $line[6]; // squawk
569
-	    	    $data['aircraft_icao'] = $line[8];
570
-	    	    $data['registration'] = $line[9];
571
-		    $data['departure_airport_iata'] = $line[11];
572
-		    $data['arrival_airport_iata'] = $line[12];
573
-	    	    $data['emergency'] = ''; // emergency
574
-		    $data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
575
-	    	    $data['format_source'] = 'fr24json';
576
-    		    $data['id_source'] = $id_source;
577
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
578
-		    $SI->add($data);
579
-		    unset($data);
559
+			$data = array();
560
+			$data['hex'] = $line[0];
561
+			$data['ident'] = $line[16]; //$line[13]
562
+				$data['altitude'] = $line[4]; // altitude
563
+				$data['speed'] = $line[5]; // speed
564
+				$data['heading'] = $line[3]; // heading
565
+				$data['latitude'] = $line[1]; // lat
566
+				$data['longitude'] = $line[2]; // long
567
+				$data['verticalrate'] = $line[15]; // verticale rate
568
+				$data['squawk'] = $line[6]; // squawk
569
+				$data['aircraft_icao'] = $line[8];
570
+				$data['registration'] = $line[9];
571
+			$data['departure_airport_iata'] = $line[11];
572
+			$data['arrival_airport_iata'] = $line[12];
573
+				$data['emergency'] = ''; // emergency
574
+			$data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
575
+				$data['format_source'] = 'fr24json';
576
+				$data['id_source'] = $id_source;
577
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
578
+			$SI->add($data);
579
+			unset($data);
580
+		}
580 581
 		}
581
-	    }
582
-    	    //$last_exec['fr24json'] = time();
583
-    	    $last_exec[$id]['last'] = time();
584
-    	//} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) {
585
-    	} elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
586
-	    //$buffer = $Common->getData($hosts[$id],'get','','','','','150');
587
-	    $buffer = $Common->getData($value['host'],'get','','','','','150');
588
-	    //echo $buffer;
589
-	    $buffer = str_replace(array("\n","\r"),"",$buffer);
590
-	    $buffer = preg_replace('/,"num":(.+)/','}',$buffer);
591
-	    $all_data = json_decode($buffer,true);
592
-	    if (json_last_error() != JSON_ERROR_NONE) {
582
+			//$last_exec['fr24json'] = time();
583
+			$last_exec[$id]['last'] = time();
584
+		//} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) {
585
+		} elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
586
+		//$buffer = $Common->getData($hosts[$id],'get','','','','','150');
587
+		$buffer = $Common->getData($value['host'],'get','','','','','150');
588
+		//echo $buffer;
589
+		$buffer = str_replace(array("\n","\r"),"",$buffer);
590
+		$buffer = preg_replace('/,"num":(.+)/','}',$buffer);
591
+		$all_data = json_decode($buffer,true);
592
+		if (json_last_error() != JSON_ERROR_NONE) {
593 593
 		die(json_last_error_msg());
594
-	    }
595
-	    if (isset($all_data['mrkrs'])) {
594
+		}
595
+		if (isset($all_data['mrkrs'])) {
596 596
 		foreach ($all_data['mrkrs'] as $key => $line) {
597
-		    if (isset($line['inf'])) {
597
+			if (isset($line['inf'])) {
598 598
 			$data = array();
599 599
 			$data['hex'] = $line['inf']['ia'];
600 600
 			if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13]
601
-	    		$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
602
-	    		if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
603
-	    		if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
604
-	    		$data['latitude'] = $line['pt'][0]; // lat
605
-	    		$data['longitude'] = $line['pt'][1]; // long
606
-	    		//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
607
-	    		if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
608
-	    		//$data['aircraft_icao'] = $line[8];
609
-	    		if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
601
+				$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
602
+				if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
603
+				if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
604
+				$data['latitude'] = $line['pt'][0]; // lat
605
+				$data['longitude'] = $line['pt'][1]; // long
606
+				//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
607
+				if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
608
+				//$data['aircraft_icao'] = $line[8];
609
+				if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
610 610
 			//$data['departure_airport_iata'] = $line[11];
611 611
 			//$data['arrival_airport_iata'] = $line[12];
612
-	    		//$data['emergency'] = ''; // emergency
612
+				//$data['emergency'] = ''; // emergency
613 613
 			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
614
-	    		$data['format_source'] = 'radarvirtueljson';
615
-    			$data['id_source'] = $id_source;
614
+				$data['format_source'] = 'radarvirtueljson';
615
+				$data['id_source'] = $id_source;
616 616
 			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
617 617
 			$SI->add($data);
618 618
 			unset($data);
619
-		    }
619
+			}
620
+		}
620 621
 		}
621
-	    }
622
-    	    //$last_exec['radarvirtueljson'] = time();
623
-    	    $last_exec[$id]['last'] = time();
624
-    	//} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) {
625
-    	} elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
626
-	    //$buffer = $Common->getData($hosts[$id]);
627
-	    $buffer = $Common->getData($value['host'].'?'.time());
628
-	    $all_data = json_decode(utf8_encode($buffer),true);
622
+			//$last_exec['radarvirtueljson'] = time();
623
+			$last_exec[$id]['last'] = time();
624
+		//} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) {
625
+		} elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
626
+		//$buffer = $Common->getData($hosts[$id]);
627
+		$buffer = $Common->getData($value['host'].'?'.time());
628
+		$all_data = json_decode(utf8_encode($buffer),true);
629 629
 	    
630
-	    if (isset($all_data['pireps'])) {
631
-	        foreach ($all_data['pireps'] as $line) {
632
-		    $data = array();
633
-		    $data['id'] = $line['id'];
634
-		    $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
635
-		    $data['ident'] = $line['callsign']; // ident
636
-		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
637
-		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
638
-		    if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
639
-		    if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
640
-		    if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
641
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
642
-		    $data['latitude'] = $line['lat']; // lat
643
-		    $data['longitude'] = $line['lon']; // long
644
-		    //$data['verticalrate'] = $line['vrt']; // verticale rate
645
-		    //$data['squawk'] = $line['squawk']; // squawk
646
-		    //$data['emergency'] = ''; // emergency
647
-		    if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
648
-		    if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
649
-		    if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
650
-		    //$data['arrival_airport_time'] = $line['arrtime'];
651
-		    if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
652
-		    if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
653
-		    if (isset($line['atis'])) $data['info'] = $line['atis'];
654
-		    else $data['info'] = '';
655
-		    $data['format_source'] = 'pireps';
656
-    		    $data['id_source'] = $id_source;
657
-		    $data['datetime'] = date('Y-m-d H:i:s');
658
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
659
-		    if ($line['icon'] == 'plane') {
630
+		if (isset($all_data['pireps'])) {
631
+			foreach ($all_data['pireps'] as $line) {
632
+			$data = array();
633
+			$data['id'] = $line['id'];
634
+			$data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
635
+			$data['ident'] = $line['callsign']; // ident
636
+			if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
637
+			if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
638
+			if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
639
+			if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
640
+			if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
641
+			if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
642
+			$data['latitude'] = $line['lat']; // lat
643
+			$data['longitude'] = $line['lon']; // long
644
+			//$data['verticalrate'] = $line['vrt']; // verticale rate
645
+			//$data['squawk'] = $line['squawk']; // squawk
646
+			//$data['emergency'] = ''; // emergency
647
+			if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
648
+			if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
649
+			if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
650
+			//$data['arrival_airport_time'] = $line['arrtime'];
651
+			if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
652
+			if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
653
+			if (isset($line['atis'])) $data['info'] = $line['atis'];
654
+			else $data['info'] = '';
655
+			$data['format_source'] = 'pireps';
656
+				$data['id_source'] = $id_source;
657
+			$data['datetime'] = date('Y-m-d H:i:s');
658
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
659
+			if ($line['icon'] == 'plane') {
660 660
 			$SI->add($data);
661
-		    //    print_r($data);
662
-    		    } elseif ($line['icon'] == 'ct') {
661
+			//    print_r($data);
662
+				} elseif ($line['icon'] == 'ct') {
663 663
 			$data['info'] = str_replace('^&sect;','<br />',$data['info']);
664 664
 			$data['info'] = str_replace('&amp;sect;','',$data['info']);
665 665
 			$typec = substr($data['ident'],-3);
@@ -674,114 +674,114 @@  discard block
 block discarded – undo
674 674
 			elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
675 675
 			else $data['type'] = 'Observer';
676 676
 			echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name']);
677
-		    }
678
-		    unset($data);
677
+			}
678
+			unset($data);
679
+		}
679 680
 		}
680
-	    }
681
-    	    //$last_exec['pirepsjson'] = time();
682
-    	    $last_exec[$id]['last'] = time();
683
-    	//} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) {
684
-    	} elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
685
-	    //$buffer = $Common->getData($hosts[$id]);
686
-	    if ($globalDebug) echo 'Get Data...'."\n";
687
-	    $buffer = $Common->getData($value['host']);
688
-	    $all_data = json_decode($buffer,true);
689
-	    if ($buffer != '' && is_array($all_data)) {
681
+			//$last_exec['pirepsjson'] = time();
682
+			$last_exec[$id]['last'] = time();
683
+		//} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) {
684
+		} elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
685
+		//$buffer = $Common->getData($hosts[$id]);
686
+		if ($globalDebug) echo 'Get Data...'."\n";
687
+		$buffer = $Common->getData($value['host']);
688
+		$all_data = json_decode($buffer,true);
689
+		if ($buffer != '' && is_array($all_data)) {
690 690
 		foreach ($all_data as $line) {
691
-	    	    $data = array();
692
-	    	    //$data['id'] = $line['id']; // id not usable
693
-	    	    if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
694
-	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
695
-	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
696
-	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
697
-	    	    $data['ident'] = $line['flightnum']; // ident
698
-	    	    $data['altitude'] = $line['alt']; // altitude
699
-	    	    $data['speed'] = $line['gs']; // speed
700
-	    	    $data['heading'] = $line['heading']; // heading
701
-	    	    $data['latitude'] = $line['lat']; // lat
702
-	    	    $data['longitude'] = $line['lng']; // long
703
-	    	    $data['verticalrate'] = ''; // verticale rate
704
-	    	    $data['squawk'] = ''; // squawk
705
-	    	    $data['emergency'] = ''; // emergency
706
-	    	    //$data['datetime'] = $line['lastupdate'];
707
-	    	    $data['last_update'] = $line['lastupdate'];
708
-		    $data['datetime'] = date('Y-m-d H:i:s');
709
-	    	    $data['departure_airport_icao'] = $line['depicao'];
710
-	    	    $data['departure_airport_time'] = $line['deptime'];
711
-	    	    $data['arrival_airport_icao'] = $line['arricao'];
712
-    		    $data['arrival_airport_time'] = $line['arrtime'];
713
-    		    $data['registration'] = $line['aircraft'];
714
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
715
-		    if (isset($line['aircraftname'])) {
691
+				$data = array();
692
+				//$data['id'] = $line['id']; // id not usable
693
+				if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
694
+				$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
695
+				if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
696
+				if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
697
+				$data['ident'] = $line['flightnum']; // ident
698
+				$data['altitude'] = $line['alt']; // altitude
699
+				$data['speed'] = $line['gs']; // speed
700
+				$data['heading'] = $line['heading']; // heading
701
+				$data['latitude'] = $line['lat']; // lat
702
+				$data['longitude'] = $line['lng']; // long
703
+				$data['verticalrate'] = ''; // verticale rate
704
+				$data['squawk'] = ''; // squawk
705
+				$data['emergency'] = ''; // emergency
706
+				//$data['datetime'] = $line['lastupdate'];
707
+				$data['last_update'] = $line['lastupdate'];
708
+			$data['datetime'] = date('Y-m-d H:i:s');
709
+				$data['departure_airport_icao'] = $line['depicao'];
710
+				$data['departure_airport_time'] = $line['deptime'];
711
+				$data['arrival_airport_icao'] = $line['arricao'];
712
+				$data['arrival_airport_time'] = $line['arrtime'];
713
+				$data['registration'] = $line['aircraft'];
714
+			if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
715
+			if (isset($line['aircraftname'])) {
716 716
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
717 717
 			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
718
-	    		$aircraft_data = explode('-',$line['aircraftname']);
719
-	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0];
720
-	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1];
721
-	    		else {
722
-	    		    $aircraft_data = explode(' ',$line['aircraftname']);
723
-	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1];
724
-	    		    else $data['aircraft_icao'] = $line['aircraftname'];
725
-	    		}
726
-	    	    }
727
-    		    if (isset($line['route'])) $data['waypoints'] = $line['route'];
728
-    		    $data['id_source'] = $id_source;
729
-	    	    $data['format_source'] = 'phpvmacars';
730
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
731
-		    $SI->add($data);
732
-		    unset($data);
718
+				$aircraft_data = explode('-',$line['aircraftname']);
719
+				if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0];
720
+				elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1];
721
+				else {
722
+					$aircraft_data = explode(' ',$line['aircraftname']);
723
+					if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1];
724
+					else $data['aircraft_icao'] = $line['aircraftname'];
725
+				}
726
+				}
727
+				if (isset($line['route'])) $data['waypoints'] = $line['route'];
728
+				$data['id_source'] = $id_source;
729
+				$data['format_source'] = 'phpvmacars';
730
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
731
+			$SI->add($data);
732
+			unset($data);
733 733
 		}
734 734
 		if ($globalDebug) echo 'No more data...'."\n";
735 735
 		unset($buffer);
736 736
 		unset($all_data);
737
-	    }
738
-    	    //$last_exec['phpvmacars'] = time();
739
-    	    $last_exec[$id]['last'] = time();
737
+		}
738
+			//$last_exec['phpvmacars'] = time();
739
+			$last_exec[$id]['last'] = time();
740 740
 	//} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') {
741 741
 	} elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars') {
742
-	    if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
743
-    	    //$last_exec[$id]['last'] = time();
742
+		if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
743
+			//$last_exec[$id]['last'] = time();
744 744
 
745
-	    //$read = array( $sockets[$id] );
746
-	    $read = $sockets;
747
-	    $write = NULL;
748
-	    $e = NULL;
749
-	    $n = socket_select($read, $write, $e, $timeout);
750
-	    if ($e != NULL) var_dump($e);
751
-	    if ($n > 0) {
745
+		//$read = array( $sockets[$id] );
746
+		$read = $sockets;
747
+		$write = NULL;
748
+		$e = NULL;
749
+		$n = socket_select($read, $write, $e, $timeout);
750
+		if ($e != NULL) var_dump($e);
751
+		if ($n > 0) {
752 752
 		foreach ($read as $nb => $r) {
753
-		    //$value = $formats[$nb];
754
-		    $format = $globalSources[$nb]['format'];
755
-        	    if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv') {
756
-        		$buffer = socket_read($r, 6000,PHP_NORMAL_READ);
757
-        	    } else {
758
-	    	        $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port);
759
-	    	    }
760
-        	    //$buffer = socket_read($r, 60000,PHP_NORMAL_READ);
761
-        	    //echo $buffer."\n";
762
-		    // lets play nice and handle signals such as ctrl-c/kill properly
763
-		    //if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
764
-		    $error = false;
765
-		    //$SI::del();
766
-		    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
767
-		    // SBS format is CSV format
768
-		    if ($buffer != '') {
753
+			//$value = $formats[$nb];
754
+			$format = $globalSources[$nb]['format'];
755
+				if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv') {
756
+				$buffer = socket_read($r, 6000,PHP_NORMAL_READ);
757
+				} else {
758
+					$az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port);
759
+				}
760
+				//$buffer = socket_read($r, 60000,PHP_NORMAL_READ);
761
+				//echo $buffer."\n";
762
+			// lets play nice and handle signals such as ctrl-c/kill properly
763
+			//if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
764
+			$error = false;
765
+			//$SI::del();
766
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
767
+			// SBS format is CSV format
768
+			if ($buffer != '') {
769 769
 			$tt[$format] = 0;
770 770
 			if ($format == 'acarssbs3') {
771
-			    echo $buffer."\n";
771
+				echo $buffer."\n";
772 772
 			} elseif ($format == 'raw') {
773
-			    // AVR format
774
-			    $data = $SBS->parse($buffer);
775
-			    if (is_array($data)) {
773
+				// AVR format
774
+				$data = $SBS->parse($buffer);
775
+				if (is_array($data)) {
776 776
 				$data['datetime'] = date('Y-m-d H:i:s');
777 777
 				$data['format_source'] = 'raw';
778 778
 				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
779
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
780
-                                if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
781
-                            }
782
-                        } elseif ($format == 'flightgearsp') {
783
-                    	    //echo $buffer."\n";
784
-                    	    if (strlen($buffer) > 5) {
779
+					if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
780
+								if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
781
+							}
782
+						} elseif ($format == 'flightgearsp') {
783
+							//echo $buffer."\n";
784
+							if (strlen($buffer) > 5) {
785 785
 				$line = explode(',',$buffer);
786 786
 				$data = array();
787 787
 				//XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p
@@ -797,114 +797,114 @@  discard block
 block discarded – undo
797 797
 				$data['format_source'] = 'flightgearsp';
798 798
 				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
799 799
 				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
800
-			    }
801
-                        } elseif ($format == 'acars') {
802
-                    	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
803
-			    $ACARS->add(trim($buffer));
804
-			    socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
805
-			    $ACARS->deleteLiveAcarsData();
800
+				}
801
+						} elseif ($format == 'acars') {
802
+							if ($globalDebug) echo 'ACARS : '.$buffer."\n";
803
+				$ACARS->add(trim($buffer));
804
+				socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
805
+				$ACARS->deleteLiveAcarsData();
806 806
 			} elseif ($format == 'flightgearmp') {
807
-			    if (substr($buffer,0,1) != '#') {
807
+				if (substr($buffer,0,1) != '#') {
808 808
 				$data = array();
809 809
 				//echo $buffer."\n";
810 810
 				$line = explode(' ',$buffer);
811 811
 				if (count($line) == 11) {
812
-				    $userserver = explode('@',$line[0]);
813
-				    $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex
814
-				    $data['ident'] = $userserver[0];
815
-				    $data['registration'] = $userserver[0];
816
-				    $data['latitude'] = $line[4];
817
-				    $data['longitude'] = $line[5];
818
-				    $data['altitude'] = $line[6];
819
-				    $data['datetime'] = date('Y-m-d H:i:s');
820
-				    $aircraft_type = $line[10];
821
-				    $aircraft_type = preg_split(':/:',$aircraft_type);
822
-				    $data['aircraft_name'] = substr(end($aircraft_type),0,-4);
823
-				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
812
+					$userserver = explode('@',$line[0]);
813
+					$data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex
814
+					$data['ident'] = $userserver[0];
815
+					$data['registration'] = $userserver[0];
816
+					$data['latitude'] = $line[4];
817
+					$data['longitude'] = $line[5];
818
+					$data['altitude'] = $line[6];
819
+					$data['datetime'] = date('Y-m-d H:i:s');
820
+					$aircraft_type = $line[10];
821
+					$aircraft_type = preg_split(':/:',$aircraft_type);
822
+					$data['aircraft_name'] = substr(end($aircraft_type),0,-4);
823
+					if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
824
+				}
824 825
 				}
825
-			    }
826 826
 			} elseif ($format == 'beast') {
827
-			    echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n";
828
-			    die;
827
+				echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n";
828
+				die;
829 829
 			} elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') {
830
-			    $line = explode("\t", $buffer);
831
-			    for($k = 0; $k < count($line); $k=$k+2) {
830
+				$line = explode("\t", $buffer);
831
+				for($k = 0; $k < count($line); $k=$k+2) {
832 832
 				$key = $line[$k];
833
-			        $lined[$key] = $line[$k+1];
834
-			    }
835
-    			    if (count($lined) > 3) {
836
-    				$data['hex'] = $lined['hexid'];
837
-    				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
838
-    				$data['datetime'] = date('Y-m-d H:i:s');;
839
-    				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
840
-    				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
841
-    				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
842
-    				if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
843
-    				if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
844
-    				if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
845
-    				if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
846
-    				$data['id_source'] = $id_source;
847
-    				$data['format_source'] = 'tsv';
848
-    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
849
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
850
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
851
-    				unset($lined);
852
-    				unset($data);
853
-    			    } else $error = true;
833
+					$lined[$key] = $line[$k+1];
834
+				}
835
+					if (count($lined) > 3) {
836
+					$data['hex'] = $lined['hexid'];
837
+					//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
838
+					$data['datetime'] = date('Y-m-d H:i:s');;
839
+					if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
840
+					if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
841
+					if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
842
+					if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
843
+					if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
844
+					if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
845
+					if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
846
+					$data['id_source'] = $id_source;
847
+					$data['format_source'] = 'tsv';
848
+					if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
849
+					if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
850
+					if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
851
+					unset($lined);
852
+					unset($data);
853
+					} else $error = true;
854 854
 			} elseif ($format == 'aprs' && $use_aprs) {
855
-			    if ($aprs_connect == 0) {
855
+				if ($aprs_connect == 0) {
856 856
 				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
857 857
 				$aprs_connect = 1;
858
-			    }
859
-			    if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) {
858
+				}
859
+				if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) {
860 860
 				$aprs_last_tx = time();
861 861
 				$data_aprs = "# Keep alive";
862 862
 				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
863
-			    }
864
-			    //echo 'Connect : '.$aprs_connect.' '.$buffer."\n";
865
-			    $buffer = str_replace('APRS <- ','',$buffer);
866
-			    $buffer = str_replace('APRS -> ','',$buffer);
867
-			    if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') {
863
+				}
864
+				//echo 'Connect : '.$aprs_connect.' '.$buffer."\n";
865
+				$buffer = str_replace('APRS <- ','',$buffer);
866
+				$buffer = str_replace('APRS -> ','',$buffer);
867
+				if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') {
868 868
 				$line = $APRS->parse($buffer);
869 869
 				if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) {
870
-				    $data = array();
871
-				    //print_r($line);
872
-				    $data['hex'] = $line['address'];
873
-				    $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
874
-				    //$data['datetime'] = date('Y-m-d H:i:s');
875
-				    $data['ident'] = $line['ident'];
876
-				    $data['latitude'] = $line['latitude'];
877
-				    $data['longitude'] = $line['longitude'];
878
-				    //$data['verticalrate'] = $line[16];
879
-				    if (isset($line['speed'])) $data['speed'] = $line['speed'];
880
-				    else $data['speed'] = 0;
881
-				    $data['altitude'] = $line['altitude'];
882
-				    if (isset($line['course'])) $data['heading'] = $line['course'];
883
-				    //else $data['heading'] = 0;
884
-				    $data['aircraft_type'] = $line['stealth'];
885
-				    if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true;
886
-    				    $data['id_source'] = $id_source;
887
-				    $data['format_source'] = 'aprs';
888
-				    $data['source_name'] = $line['source'];
889
-    				    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
890
-				    $currentdate = date('Y-m-d H:i:s');
891
-				    $aprsdate = strtotime($data['datetime']);
892
-				    // Accept data if time <= system time + 20s
893
-				    if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data);
894
-				    else {
870
+					$data = array();
871
+					//print_r($line);
872
+					$data['hex'] = $line['address'];
873
+					$data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
874
+					//$data['datetime'] = date('Y-m-d H:i:s');
875
+					$data['ident'] = $line['ident'];
876
+					$data['latitude'] = $line['latitude'];
877
+					$data['longitude'] = $line['longitude'];
878
+					//$data['verticalrate'] = $line[16];
879
+					if (isset($line['speed'])) $data['speed'] = $line['speed'];
880
+					else $data['speed'] = 0;
881
+					$data['altitude'] = $line['altitude'];
882
+					if (isset($line['course'])) $data['heading'] = $line['course'];
883
+					//else $data['heading'] = 0;
884
+					$data['aircraft_type'] = $line['stealth'];
885
+					if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true;
886
+						$data['id_source'] = $id_source;
887
+					$data['format_source'] = 'aprs';
888
+					$data['source_name'] = $line['source'];
889
+						if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
890
+					$currentdate = date('Y-m-d H:i:s');
891
+					$aprsdate = strtotime($data['datetime']);
892
+					// Accept data if time <= system time + 20s
893
+					if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data);
894
+					else {
895 895
 					if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
896 896
 					else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
897
-				    }
898
-				    unset($data);
897
+					}
898
+					unset($data);
899 899
 				} 
900 900
 				//elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n";
901 901
 				elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n";
902
-			    }
902
+				}
903 903
 			} else {
904
-			    $line = explode(',', $buffer);
905
-    			    if (count($line) > 20) {
906
-    			    	$data['hex'] = $line[4];
907
-    				/*
904
+				$line = explode(',', $buffer);
905
+					if (count($line) > 20) {
906
+						$data['hex'] = $line[4];
907
+					/*
908 908
     				$data['datetime'] = $line[6].' '.$line[7];
909 909
     					date_default_timezone_set($globalTimezone);
910 910
     					$datetime = new DateTime($data['datetime']);
@@ -912,28 +912,28 @@  discard block
 block discarded – undo
912 912
     					$data['datetime'] = $datetime->format('Y-m-d H:i:s');
913 913
     					date_default_timezone_set('UTC');
914 914
     				*/
915
-    				// Force datetime to current UTC datetime
916
-    				$data['datetime'] = date('Y-m-d H:i:s');
917
-    				$data['ident'] = trim($line[10]);
918
-    				$data['latitude'] = $line[14];
919
-    				$data['longitude'] = $line[15];
920
-    				$data['verticalrate'] = $line[16];
921
-    				$data['emergency'] = $line[20];
922
-    				$data['speed'] = $line[12];
923
-    				$data['squawk'] = $line[17];
924
-    				$data['altitude'] = $line[11];
925
-    				$data['heading'] = $line[13];
926
-    				$data['ground'] = $line[21];
927
-    				$data['emergency'] = $line[19];
928
-    				$data['format_source'] = 'sbs';
915
+					// Force datetime to current UTC datetime
916
+					$data['datetime'] = date('Y-m-d H:i:s');
917
+					$data['ident'] = trim($line[10]);
918
+					$data['latitude'] = $line[14];
919
+					$data['longitude'] = $line[15];
920
+					$data['verticalrate'] = $line[16];
921
+					$data['emergency'] = $line[20];
922
+					$data['speed'] = $line[12];
923
+					$data['squawk'] = $line[17];
924
+					$data['altitude'] = $line[11];
925
+					$data['heading'] = $line[13];
926
+					$data['ground'] = $line[21];
927
+					$data['emergency'] = $line[19];
928
+					$data['format_source'] = 'sbs';
929 929
 				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
930
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
931
-    				$data['id_source'] = $id_source;
932
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data);
933
-    				else $error = true;
934
-    				unset($data);
935
-    			    } else $error = true;
936
-			    if ($error) {
930
+					if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
931
+					$data['id_source'] = $id_source;
932
+					if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data);
933
+					else $error = true;
934
+					unset($data);
935
+					} else $error = true;
936
+				if ($error) {
937 937
 				if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { 
938 938
 					if ($globalDebug) echo "Not a message. Ignoring... \n";
939 939
 				} else {
@@ -949,13 +949,13 @@  discard block
 block discarded – undo
949 949
 					connect_all($sourceer);
950 950
 					$sourceer = array();
951 951
 				}
952
-			    }
952
+				}
953 953
 			}
954 954
 			// Sleep for xxx microseconds
955 955
 			if (isset($globalSBSSleep)) usleep($globalSBSSleep);
956
-		    } else {
956
+			} else {
957 957
 			if ($format == 'flightgearmp') {
958
-			    	if ($globalDebug) echo "Reconnect FlightGear MP...";
958
+					if ($globalDebug) echo "Reconnect FlightGear MP...";
959 959
 				//@socket_close($r);
960 960
 				sleep($globalMinFetch);
961 961
 				$sourcefg[$nb] = $globalSources[$nb];
@@ -964,9 +964,9 @@  discard block
 block discarded – undo
964 964
 				break;
965 965
 				
966 966
 			} elseif ($format != 'acars' && $format != 'flightgearsp') {
967
-			    if (isset($tt[$format])) $tt[$format]++;
968
-			    else $tt[$format] = 0;
969
-			    if ($tt[$format] > 30) {
967
+				if (isset($tt[$format])) $tt[$format]++;
968
+				else $tt[$format] = 0;
969
+				if ($tt[$format] > 30) {
970 970
 				if ($globalDebug) echo "ERROR : Reconnect ".$format."...";
971 971
 				//@socket_close($r);
972 972
 				sleep(2);
@@ -977,40 +977,40 @@  discard block
 block discarded – undo
977 977
 				//connect_all($globalSources);
978 978
 				$tt[$format]=0;
979 979
 				break;
980
-			    }
980
+				}
981
+			}
981 982
 			}
982
-		    }
983 983
 		}
984
-	    } else {
984
+		} else {
985 985
 		$error = socket_strerror(socket_last_error());
986 986
 		if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
987 987
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY) || time() - $time >= $timeout) {
988 988
 			if (isset($globalDebug)) echo "Restarting...\n";
989 989
 			// Restart the script if possible
990 990
 			if (is_array($sockets)) {
991
-			    if ($globalDebug) echo "Shutdown all sockets...";
991
+				if ($globalDebug) echo "Shutdown all sockets...";
992 992
 			    
993
-			    foreach ($sockets as $sock) {
993
+				foreach ($sockets as $sock) {
994 994
 				@socket_shutdown($sock,2);
995 995
 				@socket_close($sock);
996
-			    }
996
+				}
997 997
 			    
998 998
 			}
999
-			    if ($globalDebug) echo "Restart all connections...";
1000
-			    sleep(2);
1001
-			    $time = time();
1002
-			    //connect_all($hosts);
1003
-			    $aprs_connect = 0;
1004
-			    connect_all($globalSources);
999
+				if ($globalDebug) echo "Restart all connections...";
1000
+				sleep(2);
1001
+				$time = time();
1002
+				//connect_all($hosts);
1003
+				$aprs_connect = 0;
1004
+				connect_all($globalSources);
1005 1005
 
1006 1006
 		}
1007
-	    }
1007
+		}
1008 1008
 	}
1009 1009
 	if ($globalDaemon === false) {
1010
-	    if ($globalDebug) echo 'Check all...'."\n";
1011
-	    $SI->checkAll();
1010
+		if ($globalDebug) echo 'Check all...'."\n";
1011
+		$SI->checkAll();
1012
+	}
1012 1013
 	}
1013
-    }
1014 1014
 }
1015 1015
 
1016 1016
 ?>
Please login to merge, or discard this patch.
Braces   +493 added lines, -171 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 require_once(dirname(__FILE__).'/../require/class.Connection.php');
15 15
 require_once(dirname(__FILE__).'/../require/class.Common.php');
16 16
 
17
-if (!isset($globalDebug)) $globalDebug = FALSE;
17
+if (!isset($globalDebug)) {
18
+	$globalDebug = FALSE;
19
+}
18 20
 
19 21
 // Check if schema is at latest version
20 22
 $Connection = new Connection();
@@ -51,13 +53,22 @@  discard block
 block discarded – undo
51 53
     $globalSources = array();
52 54
     $globalSources[] = array('host' => $options['source']);
53 55
 }
54
-if (isset($options['server'])) $globalServer = TRUE;
55
-if (isset($options['idsource'])) $id_source = $options['idsource'];
56
-else $id_source = 1;
56
+if (isset($options['server'])) {
57
+	$globalServer = TRUE;
58
+}
59
+if (isset($options['idsource'])) {
60
+	$id_source = $options['idsource'];
61
+} else {
62
+	$id_source = 1;
63
+}
57 64
 if (isset($globalServer) && $globalServer) {
58
-    if ($globalDebug) echo "Using Server Mode\n";
65
+    if ($globalDebug) {
66
+    	echo "Using Server Mode\n";
67
+    }
59 68
     $SI=new SpotterServer();
60
-} else $SI=new SpotterImport($Connection->db);
69
+} else {
70
+	$SI=new SpotterImport($Connection->db);
71
+}
61 72
 //$APRS=new APRS($Connection->db);
62 73
 $SBS=new SBS();
63 74
 $ACARS=new ACARS($Connection->db);
@@ -75,7 +86,9 @@  discard block
 block discarded – undo
75 86
 }
76 87
 
77 88
 // let's try and connect
78
-if ($globalDebug) echo "Connecting...\n";
89
+if ($globalDebug) {
90
+	echo "Connecting...\n";
91
+}
79 92
 $use_aprs = false;
80 93
 $aprs_full = false;
81 94
 
@@ -83,7 +96,9 @@  discard block
 block discarded – undo
83 96
     $ip = gethostbyname($host);
84 97
     $s = socket_create(AF_INET, SOCK_STREAM, 0);
85 98
     $r = @socket_connect($s, $ip, $port);
86
-    if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
99
+    if (!socket_set_nonblock($s)) {
100
+    	echo "Unable to set nonblock on socket\n";
101
+    }
87 102
     if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
88 103
         return $s;
89 104
     }
@@ -110,7 +125,9 @@  discard block
 block discarded – undo
110 125
 function connect_all($hosts) {
111 126
     //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
112 127
     global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
113
-    if ($globalDebug) echo 'Connect to all...'."\n";
128
+    if ($globalDebug) {
129
+    	echo 'Connect to all...'."\n";
130
+    }
114 131
     foreach ($hosts as $id => $value) {
115 132
 	$host = $value['host'];
116 133
 	$globalSources[$id]['last_exec'] = 0;
@@ -120,27 +137,37 @@  discard block
 block discarded – undo
120 137
         	//$formats[$id] = 'deltadbtxt';
121 138
         	$globalSources[$id]['format'] = 'deltadbtxt';
122 139
         	//$last_exec['deltadbtxt'] = 0;
123
-        	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
140
+        	if ($globalDebug) {
141
+        		echo "Connect to deltadb source (".$host.")...\n";
142
+        	}
124 143
             } else if (preg_match('/vatsim-data.txt$/i',$host)) {
125 144
         	//$formats[$id] = 'vatsimtxt';
126 145
         	$globalSources[$id]['format'] = 'vatsimtxt';
127 146
         	//$last_exec['vatsimtxt'] = 0;
128
-        	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
147
+        	if ($globalDebug) {
148
+        		echo "Connect to vatsim source (".$host.")...\n";
149
+        	}
129 150
     	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
130 151
         	//$formats[$id] = 'aircraftlistjson';
131 152
         	$globalSources[$id]['format'] = 'aircraftlistjson';
132 153
         	//$last_exec['aircraftlistjson'] = 0;
133
-        	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
154
+        	if ($globalDebug) {
155
+        		echo "Connect to aircraftlist.json source (".$host.")...\n";
156
+        	}
134 157
     	    } else if (preg_match('/opensky/i',$host)) {
135 158
         	//$formats[$id] = 'aircraftlistjson';
136 159
         	$globalSources[$id]['format'] = 'opensky';
137 160
         	//$last_exec['aircraftlistjson'] = 0;
138
-        	if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
161
+        	if ($globalDebug) {
162
+        		echo "Connect to opensky source (".$host.")...\n";
163
+        	}
139 164
     	    } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) {
140 165
         	//$formats[$id] = 'radarvirtueljson';
141 166
         	$globalSources[$id]['format'] = 'radarvirtueljson';
142 167
         	//$last_exec['radarvirtueljson'] = 0;
143
-        	if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n";
168
+        	if ($globalDebug) {
169
+        		echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n";
170
+        	}
144 171
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
145 172
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
146 173
         	    exit(0);
@@ -149,7 +176,9 @@  discard block
 block discarded – undo
149 176
         	//$formats[$id] = 'planeupdatefaa';
150 177
         	$globalSources[$id]['format'] = 'planeupdatefaa';
151 178
         	//$last_exec['planeupdatefaa'] = 0;
152
-        	if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
179
+        	if ($globalDebug) {
180
+        		echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
181
+        	}
153 182
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
154 183
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
155 184
         	    exit(0);
@@ -158,22 +187,30 @@  discard block
 block discarded – undo
158 187
         	//$formats[$id] = 'phpvmacars';
159 188
         	$globalSources[$id]['format'] = 'phpvmacars';
160 189
         	//$last_exec['phpvmacars'] = 0;
161
-        	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
190
+        	if ($globalDebug) {
191
+        		echo "Connect to phpvmacars source (".$host.")...\n";
192
+        	}
162 193
             } else if (preg_match('/whazzup/i',$host)) {
163 194
         	//$formats[$id] = 'whazzup';
164 195
         	$globalSources[$id]['format'] = 'whazzup';
165 196
         	//$last_exec['whazzup'] = 0;
166
-        	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
197
+        	if ($globalDebug) {
198
+        		echo "Connect to whazzup source (".$host.")...\n";
199
+        	}
167 200
             } else if (preg_match('/recentpireps/i',$host)) {
168 201
         	//$formats[$id] = 'pirepsjson';
169 202
         	$globalSources[$id]['format'] = 'pirepsjson';
170 203
         	//$last_exec['pirepsjson'] = 0;
171
-        	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
204
+        	if ($globalDebug) {
205
+        		echo "Connect to pirepsjson source (".$host.")...\n";
206
+        	}
172 207
             } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
173 208
         	//$formats[$id] = 'fr24json';
174 209
         	$globalSources[$id]['format'] = 'fr24json';
175 210
         	//$last_exec['fr24json'] = 0;
176
-        	if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
211
+        	if ($globalDebug) {
212
+        		echo "Connect to fr24 source (".$host.")...\n";
213
+        	}
177 214
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
178 215
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
179 216
         	    exit(0);
@@ -182,10 +219,14 @@  discard block
 block discarded – undo
182 219
             } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
183 220
         	//$formats[$id] = 'tsv';
184 221
         	$globalSources[$id]['format'] = 'tsv';
185
-        	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
222
+        	if ($globalDebug) {
223
+        		echo "Connect to tsv source (".$host.")...\n";
224
+        	}
186 225
             }
187 226
         } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
188
-        	if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
227
+        	if ($globalDebug) {
228
+        		echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
229
+        	}
189 230
         } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
190 231
 	    $hostport = explode(':',$host);
191 232
 	    if (isset($hostport[1])) {
@@ -222,17 +263,25 @@  discard block
 block discarded – undo
222 263
         		//$formats[$id] = 'beast';
223 264
         		$globalSources[$id]['format'] = 'beast';
224 265
 		    //} else $formats[$id] = 'sbs';
225
-		    } else $globalSources[$id]['format'] = 'sbs';
266
+		    } else {
267
+		    	$globalSources[$id]['format'] = 'sbs';
268
+		    }
226 269
 		    //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
227 270
 		}
228
-		if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
271
+		if ($globalDebug) {
272
+			echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
273
+		}
229 274
             } else {
230
-		if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
275
+		if ($globalDebug) {
276
+			echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
277
+		}
231 278
     	    }
232 279
         }
233 280
     }
234 281
 }
235
-if (!isset($globalMinFetch)) $globalMinFetch = 15;
282
+if (!isset($globalMinFetch)) {
283
+	$globalMinFetch = 15;
284
+}
236 285
 
237 286
 // Initialize all
238 287
 $status = array();
@@ -240,13 +289,19 @@  discard block
 block discarded – undo
240 289
 $formats = array();
241 290
 $last_exec = array();
242 291
 $time = time();
243
-if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut;
244
-else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut;
245
-else $timeout = 20;
292
+if (isset($globalSourcesTimeout)) {
293
+	$timeout = $globalSourcesTimeOut;
294
+} else if (isset($globalSBS1TimeOut)) {
295
+	$timeout = $globalSBS1TimeOut;
296
+} else {
297
+	$timeout = 20;
298
+}
246 299
 $errno = '';
247 300
 $errstr='';
248 301
 
249
-if (!isset($globalDaemon)) $globalDaemon = TRUE;
302
+if (!isset($globalDaemon)) {
303
+	$globalDaemon = TRUE;
304
+}
250 305
 /* Initiate connections to all the hosts simultaneously */
251 306
 //connect_all($hosts);
252 307
 //connect_all($globalSources);
@@ -266,7 +321,9 @@  discard block
 block discarded – undo
266 321
     if (isset($source['format']) && $source['format'] == 'aprs') {
267 322
 	$aprs_connect = 0;
268 323
 	$use_aprs = true;
269
-	if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true;
324
+	if (isset($source['port']) && $source['port'] == '10152') {
325
+		$aprs_full = true;
326
+	}
270 327
 	break;
271 328
     }
272 329
 }
@@ -277,24 +334,44 @@  discard block
 block discarded – undo
277 334
 	$aprs_connect = 0;
278 335
 	$aprs_keep = 120;
279 336
 	$aprs_last_tx = time();
280
-	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
281
-	else $aprs_version = $globalName.' using FlightAirMap';
337
+	if (isset($globalAPRSversion)) {
338
+		$aprs_version = $globalAPRSversion;
339
+	} else {
340
+		$aprs_version = $globalName.' using FlightAirMap';
341
+	}
282 342
 	//else $aprs_version = 'Perl Example App';
283
-	if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid;
284
-	else $aprs_ssid = 'FAM';
343
+	if (isset($globalAPRSssid)) {
344
+		$aprs_ssid = $globalAPRSssid;
345
+	} else {
346
+		$aprs_ssid = 'FAM';
347
+	}
285 348
 	//else $aprs_ssid = 'PerlEx';
286
-	if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter;
287
-	else $aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
288
-	if ($aprs_full) $aprs_filter = '';
289
-	if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} appid {$aprs_version} filter {$aprs_filter}\n";
290
-	else $aprs_login = "user {$aprs_ssid} appid {$aprs_version}\n";
291
-}
349
+	if (isset($globalAPRSfilter)) {
350
+		$aprs_filter = $globalAPRSfilter;
351
+	} else {
352
+		$aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
353
+	}
354
+	if ($aprs_full) {
355
+		$aprs_filter = '';
356
+	}
357
+	if ($aprs_filter != '') {
358
+		$aprs_login = "user {$aprs_ssid} appid {$aprs_version} filter {$aprs_filter}\n";
359
+	} else {
360
+		$aprs_login = "user {$aprs_ssid} appid {$aprs_version}\n";
361
+	}
362
+	}
292 363
 
293 364
 // connected - lets do some work
294
-if ($globalDebug) echo "Connected!\n";
365
+if ($globalDebug) {
366
+	echo "Connected!\n";
367
+}
295 368
 sleep(1);
296
-if ($globalDebug) echo "SCAN MODE \n\n";
297
-if (!isset($globalCronEnd)) $globalCronEnd = 60;
369
+if ($globalDebug) {
370
+	echo "SCAN MODE \n\n";
371
+}
372
+if (!isset($globalCronEnd)) {
373
+	$globalCronEnd = 60;
374
+}
298 375
 $endtime = time()+$globalCronEnd;
299 376
 $i = 1;
300 377
 $tt = array();
@@ -308,20 +385,28 @@  discard block
 block discarded – undo
308 385
 
309 386
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
310 387
 while ($i > 0) {
311
-    if (!$globalDaemon) $i = $endtime-time();
388
+    if (!$globalDaemon) {
389
+    	$i = $endtime-time();
390
+    }
312 391
     // Delete old ATC
313 392
     if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
314
-	if ($globalDebug) echo 'Delete old ATC...'."\n";
393
+	if ($globalDebug) {
394
+		echo 'Delete old ATC...'."\n";
395
+	}
315 396
         $ATC->deleteOldATC();
316 397
     }
317 398
     
318 399
     if (count($last_exec) > 0) {
319 400
 	$max = $globalMinFetch;
320 401
 	foreach ($last_exec as $last) {
321
-	    if ((time() - $last['last']) < $max) $max = time() - $last['last'];
402
+	    if ((time() - $last['last']) < $max) {
403
+	    	$max = time() - $last['last'];
404
+	    }
322 405
 	}
323 406
 	if ($max != $globalMinFetch) {
324
-	    if ($globalDebug) echo 'Sleeping...'."\n";
407
+	    if ($globalDebug) {
408
+	    	echo 'Sleeping...'."\n";
409
+	    }
325 410
 	    sleep($globalMinFetch-$max+2);
326 411
 	}
327 412
     }
@@ -329,7 +414,9 @@  discard block
 block discarded – undo
329 414
     
330 415
     //foreach ($formats as $id => $value) {
331 416
     foreach ($globalSources as $id => $value) {
332
-	if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0;
417
+	if (!isset($last_exec[$id]['last'])) {
418
+		$last_exec[$id]['last'] = 0;
419
+	}
333 420
 	if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
334 421
 	    //$buffer = $Common->getData($hosts[$id]);
335 422
 	    $buffer = $Common->getData($value['host']);
@@ -352,8 +439,12 @@  discard block
 block discarded – undo
352 439
 		    $data['datetime'] = date('Y-m-d H:i:s');
353 440
 		    $data['format_source'] = 'deltadbtxt';
354 441
     		    $data['id_source'] = $id_source;
355
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
356
-		    if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
442
+		    if (isset($value['name']) && $value['name'] != '') {
443
+		    	$data['source_name'] = $value['name'];
444
+		    }
445
+		    if (isset($value['sourcestats'])) {
446
+		    	$data['sourcestats'] = $value['sourcestats'];
447
+		    }
357 448
     		    $SI->add($data);
358 449
 		    unset($data);
359 450
     		}
@@ -375,10 +466,19 @@  discard block
 block discarded – undo
375 466
 			$data['pilot_name'] = $line[2];
376 467
 			$data['hex'] = str_pad(dechex($line[1]),6,'000000',STR_PAD_LEFT);
377 468
 			$data['ident'] = $line[0]; // ident
378
-			if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude
469
+			if ($line[7] != '' && $line[7] != 0) {
470
+				$data['altitude'] = $line[7];
471
+			}
472
+			// altitude
379 473
 			$data['speed'] = $line[8]; // speed
380
-			if (isset($line[45])) $data['heading'] = $line[45]; // heading
381
-			elseif (isset($line[38])) $data['heading'] = $line[38]; // heading
474
+			if (isset($line[45])) {
475
+				$data['heading'] = $line[45];
476
+			}
477
+			// heading
478
+			elseif (isset($line[38])) {
479
+				$data['heading'] = $line[38];
480
+			}
481
+			// heading
382 482
 			$data['latitude'] = $line[5]; // lat
383 483
 	        	$data['longitude'] = $line[6]; // long
384 484
 	        	$data['verticalrate'] = ''; // vertical rate
@@ -387,14 +487,18 @@  discard block
 block discarded – undo
387 487
 	        	$data['waypoints'] = $line[30];
388 488
 			$data['datetime'] = date('Y-m-d H:i:s');
389 489
 			//$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37]));
390
-			if (isset($line[37])) $data['last_update'] = $line[37]
490
+			if (isset($line[37])) {
491
+				$data['last_update'] = $line[37]
391 492
 		        $data['departure_airport_icao'] = $line[11];
493
+			}
392 494
 		        $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':');
393 495
 		        $data['arrival_airport_icao'] = $line[13];
394 496
 			$data['frequency'] = $line[4];
395 497
 			$data['type'] = $line[18];
396 498
 			$data['range'] = $line[19];
397
-			if (isset($line[35])) $data['info'] = $line[35];
499
+			if (isset($line[35])) {
500
+				$data['info'] = $line[35];
501
+			}
398 502
     			$data['id_source'] = $id_source;
399 503
 	    		//$data['arrival_airport_time'] = ;
400 504
 	    		if ($line[9] != '') {
@@ -408,22 +512,35 @@  discard block
 block discarded – undo
408 512
 	    		elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt';
409 513
 	    		*/
410 514
 	    		$data['format_source'] = $value['format'];
411
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
412
-    			if ($line[3] == 'PILOT') $SI->add($data);
413
-			elseif ($line[3] == 'ATC') {
515
+			if (isset($value['name']) && $value['name'] != '') {
516
+				$data['source_name'] = $value['name'];
517
+			}
518
+    			if ($line[3] == 'PILOT') {
519
+    				$SI->add($data);
520
+    			} elseif ($line[3] == 'ATC') {
414 521
 				//print_r($data);
415 522
 				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
416 523
 				$data['info'] = str_replace('&amp;sect;','',$data['info']);
417 524
 				$typec = substr($data['ident'],-3);
418
-				if ($typec == 'APP') $data['type'] = 'Approach';
419
-				elseif ($typec == 'TWR') $data['type'] = 'Tower';
420
-				elseif ($typec == 'OBS') $data['type'] = 'Observer';
421
-				elseif ($typec == 'GND') $data['type'] = 'Ground';
422
-				elseif ($typec == 'DEL') $data['type'] = 'Delivery';
423
-				elseif ($typec == 'DEP') $data['type'] = 'Departure';
424
-				elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
425
-				elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
426
-				elseif ($data['type'] == '') $data['type'] = 'Observer';
525
+				if ($typec == 'APP') {
526
+					$data['type'] = 'Approach';
527
+				} elseif ($typec == 'TWR') {
528
+					$data['type'] = 'Tower';
529
+				} elseif ($typec == 'OBS') {
530
+					$data['type'] = 'Observer';
531
+				} elseif ($typec == 'GND') {
532
+					$data['type'] = 'Ground';
533
+				} elseif ($typec == 'DEL') {
534
+					$data['type'] = 'Delivery';
535
+				} elseif ($typec == 'DEP') {
536
+					$data['type'] = 'Departure';
537
+				} elseif ($typec == 'FSS') {
538
+					$data['type'] = 'Flight Service Station';
539
+				} elseif ($typec == 'CTR') {
540
+					$data['type'] = 'Control Radar or Centre';
541
+				} elseif ($data['type'] == '') {
542
+					$data['type'] = 'Observer';
543
+				}
427 544
 				
428 545
 				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']);
429 546
 			}
@@ -443,26 +560,55 @@  discard block
 block discarded – undo
443 560
 		foreach ($all_data['acList'] as $line) {
444 561
 		    $data = array();
445 562
 		    $data['hex'] = $line['Icao']; // hex
446
-		    if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
447
-		    if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
448
-		    if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
449
-		    if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
450
-		    if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
451
-		    if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
563
+		    if (isset($line['Call'])) {
564
+		    	$data['ident'] = $line['Call'];
565
+		    }
566
+		    // ident
567
+		    if (isset($line['Alt'])) {
568
+		    	$data['altitude'] = $line['Alt'];
569
+		    }
570
+		    // altitude
571
+		    if (isset($line['Spd'])) {
572
+		    	$data['speed'] = $line['Spd'];
573
+		    }
574
+		    // speed
575
+		    if (isset($line['Trak'])) {
576
+		    	$data['heading'] = $line['Trak'];
577
+		    }
578
+		    // heading
579
+		    if (isset($line['Lat'])) {
580
+		    	$data['latitude'] = $line['Lat'];
581
+		    }
582
+		    // lat
583
+		    if (isset($line['Long'])) {
584
+		    	$data['longitude'] = $line['Long'];
585
+		    }
586
+		    // long
452 587
 		    //$data['verticalrate'] = $line['']; // verticale rate
453
-		    if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
588
+		    if (isset($line['Sqk'])) {
589
+		    	$data['squawk'] = $line['Sqk'];
590
+		    }
591
+		    // squawk
454 592
 		    $data['emergency'] = ''; // emergency
455
-		    if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
593
+		    if (isset($line['Reg'])) {
594
+		    	$data['registration'] = $line['Reg'];
595
+		    }
456 596
 		    /*
457 597
 		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000);
458 598
 		    else $data['datetime'] = date('Y-m-d H:i:s');
459 599
 		    */
460 600
 		    $data['datetime'] = date('Y-m-d H:i:s');
461
-		    if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
601
+		    if (isset($line['Type'])) {
602
+		    	$data['aircraft_icao'] = $line['Type'];
603
+		    }
462 604
 	    	    $data['format_source'] = 'aircraftlistjson';
463 605
 		    $data['id_source'] = $id_source;
464
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
465
-		    if (isset($data['datetime'])) $SI->add($data);
606
+		    if (isset($value['name']) && $value['name'] != '') {
607
+		    	$data['source_name'] = $value['name'];
608
+		    }
609
+		    if (isset($data['datetime'])) {
610
+		    	$SI->add($data);
611
+		    }
466 612
 		    unset($data);
467 613
 		}
468 614
 	    } else {
@@ -481,7 +627,9 @@  discard block
 block discarded – undo
481 627
 		    $data['datetime'] = date('Y-m-d H:i:s');
482 628
 	    	    $data['format_source'] = 'aircraftlistjson';
483 629
     		    $data['id_source'] = $id_source;
484
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
630
+		    if (isset($value['name']) && $value['name'] != '') {
631
+		    	$data['source_name'] = $value['name'];
632
+		    }
485 633
 		    $SI->add($data);
486 634
 		    unset($data);
487 635
 		}
@@ -516,7 +664,9 @@  discard block
 block discarded – undo
516 664
 		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
517 665
 	    	    $data['format_source'] = 'planeupdatefaa';
518 666
     		    $data['id_source'] = $id_source;
519
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
667
+		    if (isset($value['name']) && $value['name'] != '') {
668
+		    	$data['source_name'] = $value['name'];
669
+		    }
520 670
 		    $SI->add($data);
521 671
 		    unset($data);
522 672
 		}
@@ -575,7 +725,9 @@  discard block
 block discarded – undo
575 725
 		    $data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
576 726
 	    	    $data['format_source'] = 'fr24json';
577 727
     		    $data['id_source'] = $id_source;
578
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
728
+		    if (isset($value['name']) && $value['name'] != '') {
729
+		    	$data['source_name'] = $value['name'];
730
+		    }
579 731
 		    $SI->add($data);
580 732
 		    unset($data);
581 733
 		}
@@ -598,23 +750,39 @@  discard block
 block discarded – undo
598 750
 		    if (isset($line['inf'])) {
599 751
 			$data = array();
600 752
 			$data['hex'] = $line['inf']['ia'];
601
-			if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13]
753
+			if (isset($line['inf']['cs'])) {
754
+				$data['ident'] = $line['inf']['cs'];
755
+			}
756
+			//$line[13]
602 757
 	    		$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
603
-	    		if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
604
-	    		if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
758
+	    		if (isset($line['inf']['gs'])) {
759
+	    			$data['speed'] = round($line['inf']['gs']*0.539957);
760
+	    		}
761
+	    		// speed
762
+	    		if (isset($line['inf']['tr'])) {
763
+	    			$data['heading'] = $line['inf']['tr'];
764
+	    		}
765
+	    		// heading
605 766
 	    		$data['latitude'] = $line['pt'][0]; // lat
606 767
 	    		$data['longitude'] = $line['pt'][1]; // long
607 768
 	    		//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
608
-	    		if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
769
+	    		if (isset($line['inf']['sq'])) {
770
+	    			$data['squawk'] = $line['inf']['sq'];
771
+	    		}
772
+	    		// squawk
609 773
 	    		//$data['aircraft_icao'] = $line[8];
610
-	    		if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
774
+	    		if (isset($line['inf']['rc'])) {
775
+	    			$data['registration'] = $line['inf']['rc'];
776
+	    		}
611 777
 			//$data['departure_airport_iata'] = $line[11];
612 778
 			//$data['arrival_airport_iata'] = $line[12];
613 779
 	    		//$data['emergency'] = ''; // emergency
614 780
 			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
615 781
 	    		$data['format_source'] = 'radarvirtueljson';
616 782
     			$data['id_source'] = $id_source;
617
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
783
+			if (isset($value['name']) && $value['name'] != '') {
784
+				$data['source_name'] = $value['name'];
785
+			}
618 786
 			$SI->add($data);
619 787
 			unset($data);
620 788
 		    }
@@ -634,29 +802,62 @@  discard block
 block discarded – undo
634 802
 		    $data['id'] = $line['id'];
635 803
 		    $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
636 804
 		    $data['ident'] = $line['callsign']; // ident
637
-		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
638
-		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
639
-		    if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
640
-		    if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
641
-		    if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
642
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
805
+		    if (isset($line['pilotid'])) {
806
+		    	$data['pilot_id'] = $line['pilotid'];
807
+		    }
808
+		    // pilot id
809
+		    if (isset($line['name'])) {
810
+		    	$data['pilot_name'] = $line['name'];
811
+		    }
812
+		    // pilot name
813
+		    if (isset($line['alt'])) {
814
+		    	$data['altitude'] = $line['alt'];
815
+		    }
816
+		    // altitude
817
+		    if (isset($line['gs'])) {
818
+		    	$data['speed'] = $line['gs'];
819
+		    }
820
+		    // speed
821
+		    if (isset($line['heading'])) {
822
+		    	$data['heading'] = $line['heading'];
823
+		    }
824
+		    // heading
825
+		    if (isset($line['route'])) {
826
+		    	$data['waypoints'] = $line['route'];
827
+		    }
828
+		    // route
643 829
 		    $data['latitude'] = $line['lat']; // lat
644 830
 		    $data['longitude'] = $line['lon']; // long
645 831
 		    //$data['verticalrate'] = $line['vrt']; // verticale rate
646 832
 		    //$data['squawk'] = $line['squawk']; // squawk
647 833
 		    //$data['emergency'] = ''; // emergency
648
-		    if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
649
-		    if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
650
-		    if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
834
+		    if (isset($line['depicao'])) {
835
+		    	$data['departure_airport_icao'] = $line['depicao'];
836
+		    }
837
+		    if (isset($line['deptime'])) {
838
+		    	$data['departure_airport_time'] = $line['deptime'];
839
+		    }
840
+		    if (isset($line['arricao'])) {
841
+		    	$data['arrival_airport_icao'] = $line['arricao'];
842
+		    }
651 843
 		    //$data['arrival_airport_time'] = $line['arrtime'];
652
-		    if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
653
-		    if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
654
-		    if (isset($line['atis'])) $data['info'] = $line['atis'];
655
-		    else $data['info'] = '';
844
+		    if (isset($line['aircraft'])) {
845
+		    	$data['aircraft_icao'] = $line['aircraft'];
846
+		    }
847
+		    if (isset($line['transponder'])) {
848
+		    	$data['squawk'] = $line['transponder'];
849
+		    }
850
+		    if (isset($line['atis'])) {
851
+		    	$data['info'] = $line['atis'];
852
+		    } else {
853
+		    	$data['info'] = '';
854
+		    }
656 855
 		    $data['format_source'] = 'pireps';
657 856
     		    $data['id_source'] = $id_source;
658 857
 		    $data['datetime'] = date('Y-m-d H:i:s');
659
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
858
+		    if (isset($value['name']) && $value['name'] != '') {
859
+		    	$data['source_name'] = $value['name'];
860
+		    }
660 861
 		    if ($line['icon'] == 'plane') {
661 862
 			$SI->add($data);
662 863
 		    //    print_r($data);
@@ -665,15 +866,25 @@  discard block
 block discarded – undo
665 866
 			$data['info'] = str_replace('&amp;sect;','',$data['info']);
666 867
 			$typec = substr($data['ident'],-3);
667 868
 			$data['type'] = '';
668
-			if ($typec == 'APP') $data['type'] = 'Approach';
669
-			elseif ($typec == 'TWR') $data['type'] = 'Tower';
670
-			elseif ($typec == 'OBS') $data['type'] = 'Observer';
671
-			elseif ($typec == 'GND') $data['type'] = 'Ground';
672
-			elseif ($typec == 'DEL') $data['type'] = 'Delivery';
673
-			elseif ($typec == 'DEP') $data['type'] = 'Departure';
674
-			elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
675
-			elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
676
-			else $data['type'] = 'Observer';
869
+			if ($typec == 'APP') {
870
+				$data['type'] = 'Approach';
871
+			} elseif ($typec == 'TWR') {
872
+				$data['type'] = 'Tower';
873
+			} elseif ($typec == 'OBS') {
874
+				$data['type'] = 'Observer';
875
+			} elseif ($typec == 'GND') {
876
+				$data['type'] = 'Ground';
877
+			} elseif ($typec == 'DEL') {
878
+				$data['type'] = 'Delivery';
879
+			} elseif ($typec == 'DEP') {
880
+				$data['type'] = 'Departure';
881
+			} elseif ($typec == 'FSS') {
882
+				$data['type'] = 'Flight Service Station';
883
+			} elseif ($typec == 'CTR') {
884
+				$data['type'] = 'Control Radar or Centre';
885
+			} else {
886
+				$data['type'] = 'Observer';
887
+			}
677 888
 			echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name']);
678 889
 		    }
679 890
 		    unset($data);
@@ -684,17 +895,25 @@  discard block
 block discarded – undo
684 895
     	//} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) {
685 896
     	} elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
686 897
 	    //$buffer = $Common->getData($hosts[$id]);
687
-	    if ($globalDebug) echo 'Get Data...'."\n";
898
+	    if ($globalDebug) {
899
+	    	echo 'Get Data...'."\n";
900
+	    }
688 901
 	    $buffer = $Common->getData($value['host']);
689 902
 	    $all_data = json_decode($buffer,true);
690 903
 	    if ($buffer != '' && is_array($all_data)) {
691 904
 		foreach ($all_data as $line) {
692 905
 	    	    $data = array();
693 906
 	    	    //$data['id'] = $line['id']; // id not usable
694
-	    	    if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
907
+	    	    if (isset($line['pilotid'])) {
908
+	    	    	$data['id'] = $line['pilotid'].$line['flightnum'];
909
+	    	    }
695 910
 	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
696
-	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
697
-	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
911
+	    	    if (isset($line['pilotname'])) {
912
+	    	    	$data['pilot_name'] = $line['pilotname'];
913
+	    	    }
914
+	    	    if (isset($line['pilotid'])) {
915
+	    	    	$data['pilot_id'] = $line['pilotid'];
916
+	    	    }
698 917
 	    	    $data['ident'] = $line['flightnum']; // ident
699 918
 	    	    $data['altitude'] = $line['alt']; // altitude
700 919
 	    	    $data['speed'] = $line['gs']; // speed
@@ -712,27 +931,41 @@  discard block
 block discarded – undo
712 931
 	    	    $data['arrival_airport_icao'] = $line['arricao'];
713 932
     		    $data['arrival_airport_time'] = $line['arrtime'];
714 933
     		    $data['registration'] = $line['aircraft'];
715
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
934
+		    if (isset($line['route'])) {
935
+		    	$data['waypoints'] = $line['route'];
936
+		    }
937
+		    // route
716 938
 		    if (isset($line['aircraftname'])) {
717 939
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
718 940
 			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
719 941
 	    		$aircraft_data = explode('-',$line['aircraftname']);
720
-	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0];
721
-	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1];
722
-	    		else {
942
+	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) {
943
+	    			$data['aircraft_icao'] = $aircraft_data[0];
944
+	    		} elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) {
945
+	    			$data['aircraft_icao'] = $aircraft_data[1];
946
+	    		} else {
723 947
 	    		    $aircraft_data = explode(' ',$line['aircraftname']);
724
-	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1];
725
-	    		    else $data['aircraft_icao'] = $line['aircraftname'];
948
+	    		    if (isset($aircraft_data[1])) {
949
+	    		    	$data['aircraft_icao'] = $aircraft_data[1];
950
+	    		    } else {
951
+	    		    	$data['aircraft_icao'] = $line['aircraftname'];
952
+	    		    }
726 953
 	    		}
727 954
 	    	    }
728
-    		    if (isset($line['route'])) $data['waypoints'] = $line['route'];
955
+    		    if (isset($line['route'])) {
956
+    		    	$data['waypoints'] = $line['route'];
957
+    		    }
729 958
     		    $data['id_source'] = $id_source;
730 959
 	    	    $data['format_source'] = 'phpvmacars';
731
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
960
+		    if (isset($value['name']) && $value['name'] != '') {
961
+		    	$data['source_name'] = $value['name'];
962
+		    }
732 963
 		    $SI->add($data);
733 964
 		    unset($data);
734 965
 		}
735
-		if ($globalDebug) echo 'No more data...'."\n";
966
+		if ($globalDebug) {
967
+			echo 'No more data...'."\n";
968
+		}
736 969
 		unset($buffer);
737 970
 		unset($all_data);
738 971
 	    }
@@ -740,7 +973,9 @@  discard block
 block discarded – undo
740 973
     	    $last_exec[$id]['last'] = time();
741 974
 	//} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') {
742 975
 	} elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars') {
743
-	    if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
976
+	    if (function_exists('pcntl_fork')) {
977
+	    	pcntl_signal_dispatch();
978
+	    }
744 979
     	    //$last_exec[$id]['last'] = time();
745 980
 
746 981
 	    //$read = array( $sockets[$id] );
@@ -748,7 +983,9 @@  discard block
 block discarded – undo
748 983
 	    $write = NULL;
749 984
 	    $e = NULL;
750 985
 	    $n = socket_select($read, $write, $e, $timeout);
751
-	    if ($e != NULL) var_dump($e);
986
+	    if ($e != NULL) {
987
+	    	var_dump($e);
988
+	    }
752 989
 	    if ($n > 0) {
753 990
 		foreach ($read as $nb => $r) {
754 991
 		    //$value = $formats[$nb];
@@ -776,9 +1013,15 @@  discard block
 block discarded – undo
776 1013
 			    if (is_array($data)) {
777 1014
 				$data['datetime'] = date('Y-m-d H:i:s');
778 1015
 				$data['format_source'] = 'raw';
779
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
780
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
781
-                                if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1016
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1017
+					$data['source_name'] = $globalSources[$nb]['name'];
1018
+				}
1019
+    				if (isset($globalSources[$nb]['sourcestats'])) {
1020
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1021
+    				}
1022
+                                if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1023
+                                	$SI->add($data);
1024
+                                }
782 1025
                             }
783 1026
                         } elseif ($format == 'flightgearsp') {
784 1027
                     	    //echo $buffer."\n";
@@ -796,11 +1039,15 @@  discard block
 block discarded – undo
796 1039
 				$data['speed'] = round($line[5]*1.94384);
797 1040
 				$data['datetime'] = date('Y-m-d H:i:s');
798 1041
 				$data['format_source'] = 'flightgearsp';
799
-				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1042
+				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1043
+					$SI->add($data);
1044
+				}
800 1045
 				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
801 1046
 			    }
802 1047
                         } elseif ($format == 'acars') {
803
-                    	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1048
+                    	    if ($globalDebug) {
1049
+                    	    	echo 'ACARS : '.$buffer."\n";
1050
+                    	    }
804 1051
 			    $ACARS->add(trim($buffer));
805 1052
 			    socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
806 1053
 			    $ACARS->deleteLiveAcarsData();
@@ -821,7 +1068,9 @@  discard block
 block discarded – undo
821 1068
 				    $aircraft_type = $line[10];
822 1069
 				    $aircraft_type = preg_split(':/:',$aircraft_type);
823 1070
 				    $data['aircraft_name'] = substr(end($aircraft_type),0,-4);
824
-				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1071
+				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1072
+				    	$SI->add($data);
1073
+				    }
825 1074
 				}
826 1075
 			    }
827 1076
 			} elseif ($format == 'beast') {
@@ -837,21 +1086,43 @@  discard block
 block discarded – undo
837 1086
     				$data['hex'] = $lined['hexid'];
838 1087
     				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
839 1088
     				$data['datetime'] = date('Y-m-d H:i:s');;
840
-    				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
841
-    				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
842
-    				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
843
-    				if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
844
-    				if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
845
-    				if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
846
-    				if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
1089
+    				if (isset($lined['ident'])) {
1090
+    					$data['ident'] = $lined['ident'];
1091
+    				}
1092
+    				if (isset($lined['lat'])) {
1093
+    					$data['latitude'] = $lined['lat'];
1094
+    				}
1095
+    				if (isset($lined['lon'])) {
1096
+    					$data['longitude'] = $lined['lon'];
1097
+    				}
1098
+    				if (isset($lined['speed'])) {
1099
+    					$data['speed'] = $lined['speed'];
1100
+    				}
1101
+    				if (isset($lined['squawk'])) {
1102
+    					$data['squawk'] = $lined['squawk'];
1103
+    				}
1104
+    				if (isset($lined['alt'])) {
1105
+    					$data['altitude'] = $lined['alt'];
1106
+    				}
1107
+    				if (isset($lined['heading'])) {
1108
+    					$data['heading'] = $lined['heading'];
1109
+    				}
847 1110
     				$data['id_source'] = $id_source;
848 1111
     				$data['format_source'] = 'tsv';
849
-    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
850
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
851
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1112
+    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1113
+    					$data['source_name'] = $globalSources[$nb]['name'];
1114
+    				}
1115
+    				if (isset($globalSources[$nb]['sourcestats'])) {
1116
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1117
+    				}
1118
+    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1119
+    					$SI->add($data);
1120
+    				}
852 1121
     				unset($lined);
853 1122
     				unset($data);
854
-    			    } else $error = true;
1123
+    			    } else {
1124
+    			    	$error = true;
1125
+    			    }
855 1126
 			} elseif ($format == 'aprs' && $use_aprs) {
856 1127
 			    if ($aprs_connect == 0) {
857 1128
 				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
@@ -877,29 +1148,44 @@  discard block
 block discarded – undo
877 1148
 				    $data['latitude'] = $line['latitude'];
878 1149
 				    $data['longitude'] = $line['longitude'];
879 1150
 				    //$data['verticalrate'] = $line[16];
880
-				    if (isset($line['speed'])) $data['speed'] = $line['speed'];
881
-				    else $data['speed'] = 0;
1151
+				    if (isset($line['speed'])) {
1152
+				    	$data['speed'] = $line['speed'];
1153
+				    } else {
1154
+				    	$data['speed'] = 0;
1155
+				    }
882 1156
 				    $data['altitude'] = $line['altitude'];
883
-				    if (isset($line['course'])) $data['heading'] = $line['course'];
1157
+				    if (isset($line['course'])) {
1158
+				    	$data['heading'] = $line['course'];
1159
+				    }
884 1160
 				    //else $data['heading'] = 0;
885 1161
 				    $data['aircraft_type'] = $line['stealth'];
886
-				    if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true;
1162
+				    if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) {
1163
+				    	$data['noarchive'] = true;
1164
+				    }
887 1165
     				    $data['id_source'] = $id_source;
888 1166
 				    $data['format_source'] = 'aprs';
889 1167
 				    $data['source_name'] = $line['source'];
890
-    				    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1168
+    				    if (isset($globalSources[$nb]['sourcestats'])) {
1169
+    				    	$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1170
+    				    }
891 1171
 				    $currentdate = date('Y-m-d H:i:s');
892 1172
 				    $aprsdate = strtotime($data['datetime']);
893 1173
 				    // Accept data if time <= system time + 20s
894
-				    if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data);
895
-				    else {
896
-					if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
897
-					else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
1174
+				    if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1175
+				    	$send = $SI->add($data);
1176
+				    } else {
1177
+					if ($line['stealth'] != 0) {
1178
+						echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
1179
+					} else {
1180
+						echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
1181
+					}
898 1182
 				    }
899 1183
 				    unset($data);
900 1184
 				} 
901 1185
 				//elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n";
902
-				elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n";
1186
+				elseif ($line == true && $globalDebug) {
1187
+					echo '!! Failed : '.$buffer."!!\n";
1188
+				}
903 1189
 			    }
904 1190
 			} else {
905 1191
 			    $line = explode(',', $buffer);
@@ -927,25 +1213,42 @@  discard block
 block discarded – undo
927 1213
     				$data['ground'] = $line[21];
928 1214
     				$data['emergency'] = $line[19];
929 1215
     				$data['format_source'] = 'sbs';
930
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
931
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1216
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1217
+					$data['source_name'] = $globalSources[$nb]['name'];
1218
+				}
1219
+    				if (isset($globalSources[$nb]['sourcestats'])) {
1220
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1221
+    				}
932 1222
     				$data['id_source'] = $id_source;
933
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data);
934
-    				else $error = true;
1223
+    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1224
+    					$send = $SI->add($data);
1225
+    				} else {
1226
+    					$error = true;
1227
+    				}
935 1228
     				unset($data);
936
-    			    } else $error = true;
1229
+    			    } else {
1230
+    			    	$error = true;
1231
+    			    }
937 1232
 			    if ($error) {
938 1233
 				if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { 
939
-					if ($globalDebug) echo "Not a message. Ignoring... \n";
1234
+					if ($globalDebug) {
1235
+						echo "Not a message. Ignoring... \n";
1236
+					}
940 1237
 				} else {
941
-					if ($globalDebug) echo "Wrong line format. Ignoring... \n";
1238
+					if ($globalDebug) {
1239
+						echo "Wrong line format. Ignoring... \n";
1240
+					}
942 1241
 					if ($globalDebug) {
943 1242
 						echo $buffer;
944 1243
 						print_r($line);
945 1244
 					}
946 1245
 					//socket_close($r);
947
-					if ($globalDebug) echo "Reconnect after an error...\n";
948
-					if ($format == 'aprs') $aprs_connect = 0;
1246
+					if ($globalDebug) {
1247
+						echo "Reconnect after an error...\n";
1248
+					}
1249
+					if ($format == 'aprs') {
1250
+						$aprs_connect = 0;
1251
+					}
949 1252
 					$sourceer[$nb] = $globalSources[$nb];
950 1253
 					connect_all($sourceer);
951 1254
 					$sourceer = array();
@@ -953,10 +1256,14 @@  discard block
 block discarded – undo
953 1256
 			    }
954 1257
 			}
955 1258
 			// Sleep for xxx microseconds
956
-			if (isset($globalSBSSleep)) usleep($globalSBSSleep);
1259
+			if (isset($globalSBSSleep)) {
1260
+				usleep($globalSBSSleep);
1261
+			}
957 1262
 		    } else {
958 1263
 			if ($format == 'flightgearmp') {
959
-			    	if ($globalDebug) echo "Reconnect FlightGear MP...";
1264
+			    	if ($globalDebug) {
1265
+			    		echo "Reconnect FlightGear MP...";
1266
+			    	}
960 1267
 				//@socket_close($r);
961 1268
 				sleep($globalMinFetch);
962 1269
 				$sourcefg[$nb] = $globalSources[$nb];
@@ -965,10 +1272,15 @@  discard block
 block discarded – undo
965 1272
 				break;
966 1273
 				
967 1274
 			} elseif ($format != 'acars' && $format != 'flightgearsp') {
968
-			    if (isset($tt[$format])) $tt[$format]++;
969
-			    else $tt[$format] = 0;
1275
+			    if (isset($tt[$format])) {
1276
+			    	$tt[$format]++;
1277
+			    } else {
1278
+			    	$tt[$format] = 0;
1279
+			    }
970 1280
 			    if ($tt[$format] > 30) {
971
-				if ($globalDebug) echo "ERROR : Reconnect ".$format."...";
1281
+				if ($globalDebug) {
1282
+					echo "ERROR : Reconnect ".$format."...";
1283
+				}
972 1284
 				//@socket_close($r);
973 1285
 				sleep(2);
974 1286
 				$aprs_connect = 0;
@@ -984,12 +1296,18 @@  discard block
 block discarded – undo
984 1296
 		}
985 1297
 	    } else {
986 1298
 		$error = socket_strerror(socket_last_error());
987
-		if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
1299
+		if ($globalDebug) {
1300
+			echo "ERROR : socket_select give this error ".$error . "\n";
1301
+		}
988 1302
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY) || time() - $time >= $timeout) {
989
-			if (isset($globalDebug)) echo "Restarting...\n";
1303
+			if (isset($globalDebug)) {
1304
+				echo "Restarting...\n";
1305
+			}
990 1306
 			// Restart the script if possible
991 1307
 			if (is_array($sockets)) {
992
-			    if ($globalDebug) echo "Shutdown all sockets...";
1308
+			    if ($globalDebug) {
1309
+			    	echo "Shutdown all sockets...";
1310
+			    }
993 1311
 			    
994 1312
 			    foreach ($sockets as $sock) {
995 1313
 				@socket_shutdown($sock,2);
@@ -997,7 +1315,9 @@  discard block
 block discarded – undo
997 1315
 			    }
998 1316
 			    
999 1317
 			}
1000
-			    if ($globalDebug) echo "Restart all connections...";
1318
+			    if ($globalDebug) {
1319
+			    	echo "Restart all connections...";
1320
+			    }
1001 1321
 			    sleep(2);
1002 1322
 			    $time = time();
1003 1323
 			    //connect_all($hosts);
@@ -1008,7 +1328,9 @@  discard block
 block discarded – undo
1008 1328
 	    }
1009 1329
 	}
1010 1330
 	if ($globalDaemon === false) {
1011
-	    if ($globalDebug) echo 'Check all...'."\n";
1331
+	    if ($globalDebug) {
1332
+	    	echo 'Check all...'."\n";
1333
+	    }
1012 1334
 	    $SI->checkAll();
1013 1335
 	}
1014 1336
     }
Please login to merge, or discard this patch.