Completed
Push — master ( f8ab3f...18f23f )
by Yannick
17:25
created

NOTAM::deleteAllNOTAMLocation()   A

Complexity

Conditions 2
Paths 3

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 3
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
require_once(dirname(__FILE__).'/settings.php');
3
require_once(dirname(__FILE__).'/class.Connection.php');
4
require_once(dirname(__FILE__).'/class.Common.php');
5
require_once(dirname(__FILE__).'/class.Spotter.php');
6
7
class NOTAM {
8
	public $db;
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');
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');
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');
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');
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');
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');
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');
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');
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');
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');
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');
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');
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');
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');
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');
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');
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'); 
968
969
	public function __construct($dbc = null) {
970
		$Connection = new Connection($dbc);
971
		$this->db = $Connection->db;
972
	}
973
	public function getAllNOTAM() {
974
		global $globalDBdriver;
975
		//$query = "SELECT * FROM notam WHERE radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()";
976
		if ($globalDBdriver == 'mysql') {
977
			$query  = 'SELECT * FROM notam WHERE radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()';
978
		} else {
979
			$query  = "SELECT * FROM notam WHERE radius > 0 AND date_end > CURRENT_TIMESTAMP AT TIME ZONE 'UTC' AND date_begin < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
980
		}
981
		$query_values = array();
982
		try {
983
			$sth = $this->db->prepare($query);
984
			$sth->execute($query_values);
985
		} catch(PDOException $e) {
986
			echo "error : ".$e->getMessage();
987
		}
988
		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
989
		return $all;
990
	}
991
	public function getAllNOTAMbyScope($scope) {
992
		global $globalDBdriver;
993
		//$query = "SELECT * FROM notam WHERE radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()";
994
		if ($globalDBdriver == 'mysql') {
995
			$query  = 'SELECT * FROM notam WHERE radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope';
996
		} else {
997
			$query  = "SELECT * FROM notam WHERE radius > 0 AND date_end > CURRENT_TIMESTAMP AT TIME ZONE 'UTC' AND date_begin < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' AND scope = :scope";
998
		}
999
		$query_values = array(':scope' => $scope);
1000
		try {
1001
			$sth = $this->db->prepare($query);
1002
			$sth->execute($query_values);
1003
		} catch(PDOException $e) {
1004
			echo "error : ".$e->getMessage();
1005
		}
1006
		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1007
		return $all;
1008
	}
1009
	public function getAllNOTAMbyCoord($coord) {
1010
		global $globalDBdriver;
1011
		if (is_array($coord)) {
1012
			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1013
			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1014
			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1015
			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1016
		} else return array();
1017
		if ($globalDBdriver == 'mysql') {
1018
			$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()';
1019
		} else {
1020
			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong." AND radius > 0 AND date_end > CURRENT_TIMESTAMP AT TIME ZONE 'UTC' AND date_begin < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
1021
		}
1022
		//$query = "SELECT * FROM notam WHERE radius > 0";
1023
		$query_values = array();
1024
		try {
1025
			$sth = $this->db->prepare($query);
1026
			$sth->execute($query_values);
1027
		} catch(PDOException $e) {
1028
			echo "error : ".$e->getMessage();
1029
		}
1030
		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1031
		return $all;
1032
	}
1033
	public function getAllNOTAMbyCoordScope($coord,$scope) {
1034
		global $globalDBdriver;
1035
		if (is_array($coord)) {
1036
			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1037
			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1038
			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1039
			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1040
		} else return array();
1041
		if ($globalDBdriver == 'mysql') {
1042
			$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';
1043
		} else {
1044
			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong." AND radius > 0 AND date_end > CURRENT_TIMESTAMP AT TIME ZONE 'UTC' AND date_begin < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' AND scope = :scope";
1045
		}
1046
		//$query = "SELECT * FROM notam WHERE radius > 0";
1047
		$query_values = array(':scope' => $scope);
1048
		try {
1049
			$sth = $this->db->prepare($query);
1050
			$sth->execute($query_values);
1051
		} catch(PDOException $e) {
1052
			echo "error : ".$e->getMessage();
1053
		}
1054
		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1055
		return $all;
1056
	}
1057
	public function getNOTAMbyRef($ref) {
1058
		$query = "SELECT * FROM notam WHERE ref = :ref";
1059
		$query_values = array('ref' => $ref);
1060
		try {
1061
			$sth = $this->db->prepare($query);
1062
			$sth->execute($query_values);
1063
		} catch(PDOException $e) {
1064
			return "error : ".$e->getMessage();
1065
		}
1066
		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1067
		if (isset($all[0])) return $all[0];
1068
		else return array();
1069
	}
1070
1071
	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) {
1072
		$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)";
1073
		$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);
1074
		try {
1075
			$sth = $this->db->prepare($query);
1076
			$sth->execute($query_values);
1077
		} catch(PDOException $e) {
1078
			return "error : ".$e->getMessage();
1079
		}
1080
	}
1081
1082
	public function deleteNOTAM($id) {
1083
		$query = "DELETE FROM notam WHERE id = :id";
1084
		$query_values = array(':id' => $id);
1085
		try {
1086
			$sth = $this->db->prepare($query);
1087
			$sth->execute($query_values);
1088
		} catch(PDOException $e) {
1089
			return "error : ".$e->getMessage();
1090
		}
1091
	}
1092
	public function deleteOldNOTAM() {
1093
		global $globalDBdriver;
1094
		if ($globalDBdriver == 'mysql') {
1095
			$query = "DELETE FROM notam WHERE date_end < UTC_TIMESTAMP()";
1096
		} else {
1097
			$query = "DELETE FROM notam WHERE date_end < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
1098
		}
1099
		$query_values = array();
1100
		try {
1101
			$sth = $this->db->prepare($query);
1102
			$sth->execute($query_values);
1103
		} catch(PDOException $e) {
1104
			return "error : ".$e->getMessage();
1105
		}
1106
	}
1107
	public function deleteNOTAMbyRef($ref) {
1108
		$query = "DELETE FROM notam WHERE ref = :ref";
1109
		$query_values = array(':ref' => $ref);
1110
		try {
1111
			$sth = $this->db->prepare($query);
1112
			$sth->execute($query_values);
1113
		} catch(PDOException $e) {
1114
			return "error : ".$e->getMessage();
1115
		}
1116
	}
1117
	public function deleteAllNOTAM() {
1118
		$query = "DELETE FROM notam";
1119
		try {
1120
			$sth = $this->db->prepare($query);
1121
			$sth->execute();
1122
		} catch(PDOException $e) {
1123
			return "error : ".$e->getMessage();
1124
		}
1125
	}
1126
	public function deleteAllNOTAMLocation() {
1127
		$query = "DELETE FROM notam";
1128
		try {
1129
			$sth = $this->db->prepare($query);
1130
			$sth->execute();
1131
		} catch(PDOException $e) {
1132
			return "error : ".$e->getMessage();
1133
		}
1134
	}
1135
1136
	public function updateNOTAM() {
1137
		global $globalNOTAMAirports;
1138
		if (isset($globalNOTAMAirports) && is_array($globalNOTAMAirports) && count($globalNOTAMAirports) > 0) {
1139
			foreach (array_chunk($globalNOTAMAirports,10) as $airport) {
1140
				$airport_icao = implode(',',$airport);
1141
				$alldata = $this->downloadNOTAM($airport_icao);
1142
				if (count($alldata) > 0) {
1143
					foreach ($alldata as $initial_data) {
1144
						$data = $this->parse($initial_data);
1145
						$notamref = $this->getNOTAMbyRef($data['ref']);
1146
						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']);
1147
					}
1148
				}
1149
			}
1150
		}
1151
	}
1152
1153
	public function updateNOTAMallAirports() {
1154
		global $globalTransaction;
1155
		$Spotter = new Spotter();
1156
		$allairports = $Spotter->getAllAirportInfo();
1157
		foreach (array_chunk($allairports,20) as $airport) {
1158
			$airports_icao = array();
1159
			foreach($airport as $icao) {
1160
				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1161
			}
1162
			$airport_icao = implode(',',$airports_icao);
1163
			$alldata = $this->downloadNOTAM($airport_icao);
1164
			if ($globalTransaction) $this->db->beginTransaction();
1 ignored issue
show
Bug introduced by
The method beginTransaction cannot be called on $this->db (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
1165
			if (count($alldata) > 0) {
1166
				foreach ($alldata as $initial_data) {
1167
					//print_r($initial_data);
1168
					$data = $this->parse($initial_data);
1169
					//print_r($data);
1170
					if (isset($data['ref'])) {
1171
						$notamref = $this->getNOTAMbyRef($data['ref']);
1172
						if (count($notamref) == 0) {
1173
							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1174
							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1175
							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']);
1176
						}
1177
					}
1178
				}
1179
			} else echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1180
			if ($globalTransaction) $this->db->commit();
1 ignored issue
show
Bug introduced by
The method commit cannot be called on $this->db (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
1181
			sleep(5);
1182
		}
1183
	}
1184
1185
	public function downloadNOTAM($icao) {
1186
		date_default_timezone_set("UTC");
1187
		$Common = new Common();
1188
		//$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=DOMESTIC&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1189
		$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1190
		$data = $Common->getData($url);
1191
		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1192
		//print_r($matches);
1193
		if (isset($matches[1])) return $matches[1];
1194
		else return array();
1195
	}
1196
1197
	public function parse($data) {
1198
		$Common = new Common();
1199
		$result = array();
1200
		$result['full_notam'] = $data;
1201
		$data = str_ireplace(array("\r","\n",'\r','\n'),' ',$data);
1202
		$data = preg_split('#(?=([A-Z]\)\s))#',$data);
1203
		//print_r($data);
1204
		foreach ($data as $line) {
1205
			$line = trim($line);
1206
			if (preg_match('#Q\) (.*)#',$line,$matches)) {
1207
				$line = str_replace(' ','',$line);
1208
				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)) {
1209
				//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)) {
1210
					//print_r($matches);
1211
					$result['fir'] = $matches[1];
1212
					$result['code'] = $matches[2];
1213
					$result['title'] = $this->parse_code($result['code']);
1214
					$rules = str_split($matches[3]);
1215
					foreach ($rules as $rule) {
1216
						if ($rule == 'I') {
1217
							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/IFR';
1218
							else $result['rules'] = 'IFR';
1219
						} elseif ($rule == 'V') {
1220
							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/VFR';
1221
							else $result['rules'] = 'VFR';
1222
						} elseif ($rule == 'K') {
1223
							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/Checklist';
1224
							else $result['rules'] = 'Checklist';
1225
						}
1226
					}
1227
					$attentions = str_split($matches[4]);
1228
					foreach ($attentions as $attention) {
1229
						if ($attention == 'N') {
1230
							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Immediate attention';
1231
							else $result['rules'] = 'Immediate attention';
1232
						} elseif ($attention == 'B') {
1233
							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Operational significance';
1234
							else $result['rules'] = 'Operational significance';
1235
						} elseif ($attention == 'O') {
1236
							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Flight operations';
1237
							else $result['rules'] = 'Flight operations';
1238
						} elseif ($attention == 'M') {
1239
							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Misc';
1240
							else $result['rules'] = 'Misc';
1241
						} elseif ($attention == 'K') {
1242
							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Checklist';
1243
							else $result['rules'] = 'Checklist';
1244
						}
1245
					}
1246
					if ($matches[5] == 'A') $result['scope'] = 'Airport warning';
1247
					elseif ($matches[5] == 'E') $result['scope'] = 'Enroute warning';
1248
					elseif ($matches[5] == 'W') $result['scope'] = 'Navigation warning';
1249
					elseif ($matches[5] == 'K') $result['scope'] = 'Checklist';
1250
					elseif ($matches[5] == 'AE') $result['scope'] = 'Airport/Enroute warning';
1251
					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1252
					$result['lower_limit'] = $matches[6];
1253
					$result['upper_limit'] = $matches[7];
1254
					$latitude = $Common->convertDec($matches[8],'latitude');
1255
					if ($matches[9] == 'S') $latitude = -$latitude;
1256
					$longitude = $Common->convertDec($matches[10],'longitude');
1257
					if ($matches[11] == 'W') $longitude = -$longitude;
1258
					$result['latitude'] = $latitude;
1259
					$result['longitude'] = $longitude;
1260
					$result['radius'] = intval($matches[12]);
1261
				} else echo 'ERROR : '.$line."\n";
1262
			}
1263
			elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1264
				$result['icao'] = $matches[1];
1265
			}
1266
			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1267
				if ($matches[1] > 50) $year = '19'.$matches[1];
1268
				else $year = '20'.$matches[1];
1269
				$result['date_begin'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1270
			}
1271
			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1272
				if ($matches[1] > 50) $year = '19'.$matches[1];
1273
				else $year = '20'.$matches[1];
1274
				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1275
				$result['permanent'] = 0;
1276
			}
1277
			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1278
				if ($matches[1] > 50) $year = '19'.$matches[1];
1279
				else $year = '20'.$matches[1];
1280
				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1281
				if ($matches[6] == 'EST') $result['estimated'] = 1;
1282
				else $result['estimated'] = 0;
1283
				if ($matches[6] == 'PERM') $result['permanent'] = 1;
1284
				else $result['permanent'] = 0;
1285
			}
1286
			elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1287
				$result['date_end'] = '2030/12/20 12:00';
1288
				if ($matches[1] == 'EST') $result['estimated'] = 1;
1289
				else $result['estimated'] = 0;
1290
				if ($matches[1] == 'PERM') $result['permanent'] = 1;
1291
				else $result['permanent'] = 0;
1292
			}
1293
			elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1294
				$rtext = array();
1295
				$text = explode(' ',$matches[1]);
1296
				foreach ($text as $word) {
1297
					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1298
					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);
1299
					else $rtext[] = $word;
1300
				}
1301
				$result['text'] = implode(' ',$rtext);
1302
			//} elseif (preg_match('#F\) (.*)#',$line,$matches)) {
1303
			//} elseif (preg_match('#G\) (.*)#',$line,$matches)) {
1304
			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1305
				$text = explode(' ',$line);
1306
				$result['ref'] = $text[0];
1307
				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1308
				if ($matches[1] == 'NOTAMC') {
1309
					$result['type'] = 'cancel';
1310
					$result['ref_cancelled'] = $text[2];
1311
				}
1312
				if ($matches[1] == 'NOTAMR') {
1313
					$result['type'] = 'replace';
1314
					$result['ref_replaced'] = $text[2];
1315
				}
1316
			}
1317
		}
1318
		return $result;
1319
	}
1320
	
1321
	public function parse_code($code) {
1322
		$code = str_split($code);
1323
		$code_fp = $code[1].$code[2];
1324
		$code_sp = $code[3].$code[4];
1325
		$result = '';
1326
		switch ($code[1]) {
1327
			case 'A':
1328
				$result = 'Airspace organization ';
1329
				if (isset($this->code_airspace[$code_fp])) $result .= $this->code_airspace[$code_fp];
1330
				break;
1331
			case 'C':
1332
				$result = 'Communications and radar facilities ';
1333
				if (isset($this->code_comradar[$code_fp])) $result .= $this->code_comradar[$code_fp];
1334
				break;
1335
			case 'F':
1336
				$result = 'Facilities and services ';
1337
				if (isset($this->code_facilities[$code_fp])) $result .= $this->code_facilities[$code_fp];
1338
				break;
1339
			case 'I':
1340
				$result = 'Instrument and Microwave Landing System ';
1341
				if (isset($this->code_instrumentlanding[$code_fp])) $result .= $this->code_instrumentlanding[$code_fp];
1342
				break;
1343
			case 'L':
1344
				$result = 'Lighting facilities ';
1345
				if (isset($this->code_lightingfacilities[$code_fp])) $result .= $this->code_lightingfacilities[$code_fp];
1346
				break;
1347
			case 'M':
1348
				$result = 'Movement and landing areas ';
1349
				if (isset($this->code_movementareas[$code_fp])) $result .= $this->code_movementareas[$code_fp];
1350
				break;
1351
			case 'N':
1352
				$result = 'Terminal and En Route Navigation Facilities ';
1353
				if (isset($this->code_terminalfacilities[$code_fp])) $result .= $this->code_terminalfacilities[$code_fp];
1354
				break;
1355
			case 'O':
1356
				$result = 'Other information ';
1357
				if (isset($this->code_information[$code_fp])) $result .= $this->code_information[$code_fp];
1358
				break;
1359
			case 'P':
1360
				$result = 'Air Traffic procedures ';
1361
				if (isset($this->code_airtraffic[$code_fp])) $result .= $this->code_airtraffic[$code_fp];
1362
				break;
1363
			case 'R':
1364
				$result = 'Navigation Warnings: Airspace Restrictions ';
1365
				if (isset($this->code_navigationw[$code_fp])) $result .= $this->code_navigationw[$code_fp];
1366
				break;
1367
			case 'S':
1368
				$result = 'Air Traffic and VOLMET Services ';
1369
				if (isset($this->code_volmet[$code_fp])) $result .= $this->code_volmet[$code_fp];
1370
				break;
1371
			case 'W':
1372
				$result = 'Navigation Warnings: Warnings ';
1373
				if (isset($this->code_warnings[$code_fp])) $result .= $this->code_warnings[$code_fp];
1374
				break;
1375
		}
1376
		switch ($code[3]) {
1377
			case 'A':
1378
				// Availability
1379
				if (isset($this->code_sp_availabity[$code_sp])) $result .= ' '.$this->code_sp_availabity[$code_sp];
1380
				break;
1381
			case 'C':
1382
				// Changes
1383
				if (isset($this->code_sp_changes[$code_sp])) $result .= ' '.$this->code_sp_changes[$code_sp];
1384
				break;
1385
			case 'H':
1386
				// Hazardous conditions
1387
				if (isset($this->code_sp_hazardous[$code_sp])) $result .= ' '.$this->code_sp_hazardous[$code_sp];
1388
				break;
1389
			case 'L':
1390
				// Limitations
1391
				if (isset($this->code_sp_limitations[$code_sp])) $result .= ' '.$this->code_sp_limitations[$code_sp];
1392
				break;
1393
			case 'X':
1394
				// Other Information
1395
				break;
1396
		}
1397
		return trim($result);
1398
	}
1399
}
1400
/*
1401
$NOTAM = new NOTAM();
1402
//print_r($NOTAM->downloadNOTAM('lfll'));
1403
//print_r($NOTAM->parse(''));
1404
//$NOTAM->deleteAllNOTAM();
1405
//$NOTAM->updateNOTAMallAirports();
1406
echo $NOTAM->parse_code('QFATT');
1407
*/
1408
?>