Completed
Push — master ( 362b52...c440c8 )
by Yannick
09:25
created
location-geojson.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
 		$coords = explode(',',$_GET['coord']);
16 16
 //		$spotter_array = Source::getAllLocationInfobyCoord($coords);
17 17
 		if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') 
18
-		    || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
18
+			|| (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
19 19
 			$spotter_array = $Source->getAllLocationInfo();
20 20
 		} else {
21 21
 			$spotter_array = $Source->getLocationInfoByType('');
22 22
 		}
23 23
 	} else {
24 24
 		if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') 
25
-		    || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
25
+			|| (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
26 26
 			$spotter_array = $Source->getAllLocationInfo();
27 27
 		} else {
28 28
 			$spotter_array = $Source->getLocationInfoByType('');
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		date_default_timezone_set('UTC');
39 39
 		//waypoint plotting
40 40
 		$output .= '{"type": "Feature",';
41
-		    $output .= '"properties": {';
41
+			$output .= '"properties": {';
42 42
 			$output .= '"id": "'.$spotter_item['id'].'",';
43 43
 			$output .= '"location_id": "'.$spotter_item['location_id'].'",';
44 44
 			$output .= '"name": "'.$spotter_item['name'].'",';
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 				if (isset($weather['temp'])) $output.= '"temp": "'.$weather['temp'].'",';
57 57
 			}
58 58
 			$output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"';
59
-		    $output .= '},';
60
-		    $output .= '"geometry": {';
59
+			$output .= '},';
60
+			$output .= '"geometry": {';
61 61
 			$output .= '"type": "Point",';
62 62
 			$output .= '"coordinates": [';
63
-			    $output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
63
+				$output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
64 64
 			$output .= ']';
65
-		    $output .= '}';
65
+			$output .= '}';
66 66
 		$output .= '},';
67 67
 	}
68 68
 	$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     <?php }; if (isset($globalTracker) && $globalTracker) { ?><td><div id="ibxtracker"><h4><?php echo _("Trackers Detected"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
46 46
 </tr></table></div>
47 47
 <?php
48
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
48
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
49 49
 
50 50
 ?>
51 51
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
66 66
 <?php
67 67
 	}
68
-    }
68
+	}
69 69
 ?>
70 70
 
71 71
 <div id="sidebar" class="sidebar collapsed">
@@ -76,34 +76,34 @@  discard block
 block discarded – undo
76 76
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
77 77
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
78 78
 <?php
79
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
79
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
80 80
 	if (isset($globalArchive) && $globalArchive == TRUE) {
81 81
 ?>
82 82
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
83 83
 <?php
84 84
 	}
85
-    }
85
+	}
86 86
 ?>
87 87
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
88 88
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
89 89
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
90 90
 <?php
91
-    if (isset($globalMap3D) && $globalMap3D) {
91
+	if (isset($globalMap3D) && $globalMap3D) {
92 92
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
93 93
 ?>
94 94
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
95 95
 <?php
96
-        } else {
97
-    	    if (isset($globalMapSatellites) && $globalMapSatellites) {
96
+		} else {
97
+			if (isset($globalMapSatellites) && $globalMapSatellites) {
98 98
 ?>
99 99
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
100 100
 <?php
101
-	    }
101
+		}
102 102
 ?>
103 103
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
104 104
 <?php
105 105
 	}
106
-    }
106
+	}
107 107
 ?>
108 108
     </ul>
109 109
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 ?>
179 179
         </div>
180 180
 <?php
181
-    if (isset($globalArchive) && $globalArchive == TRUE) {
181
+	if (isset($globalArchive) && $globalArchive == TRUE) {
182 182
 ?>
183 183
         <div class="sidebar-pane" id="archive">
184 184
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	    </form>
239 239
 	</div>
240 240
 <?php
241
-    }
241
+	}
242 242
 ?>
243 243
         <div class="sidebar-pane" id="settings">
244 244
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -249,56 +249,56 @@  discard block
 block discarded – undo
249 249
 			    <?php
250 250
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
251 251
 				else $MapType = $_COOKIE['MapType'];
252
-			    ?>
252
+				?>
253 253
 			    <?php
254 254
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
255
-			    ?>
255
+				?>
256 256
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
257 257
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
258 258
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
259 259
 			    <?php
260 260
 				}
261
-			    ?>
261
+				?>
262 262
 			    <?php
263
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
264
-			    ?>
263
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
264
+				?>
265 265
 			    <?php
266
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
267
-			    ?>
266
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
267
+				?>
268 268
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
269 269
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
270 270
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
271 271
 			    <?php
272
-				    }
273
-			    ?>
272
+					}
273
+				?>
274 274
 			    <?php
275
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
276
-			    ?>
275
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
276
+				?>
277 277
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
278 278
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
279 279
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
280 280
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
281 281
 			    <?php
282
-				    }
283
-			    ?>
282
+					}
283
+				?>
284 284
 			    <?php
285
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
286
-			    ?>
285
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
286
+				?>
287 287
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
288 288
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
289 289
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
290 290
 			    <?php
291
-				    }
292
-			    ?>
291
+					}
292
+				?>
293 293
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
294 294
 			    <?php
295 295
 				}
296
-			    ?>
296
+				?>
297 297
 			    <?php
298
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
298
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
299 299
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
300 300
 					else $MapBoxId = $_COOKIE['MapTypeId'];
301
-			    ?>
301
+				?>
302 302
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
303 303
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
304 304
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -312,13 +312,13 @@  discard block
 block discarded – undo
312 312
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
313 313
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
314 314
 			    <?php
315
-				    }
316
-			    ?>
315
+					}
316
+				?>
317 317
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
318 318
 			</select>
319 319
 		    </li>
320 320
 <?php
321
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
321
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
322 322
 ?>
323 323
 		    <li><?php echo _("Type of Terrain:"); ?>
324 324
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 			</select>
330 330
 		    </li>
331 331
 <?php
332
-    }
332
+	}
333 333
 ?>
334 334
 <?php
335
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
335
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
336 336
 ?>
337 337
 		    
338 338
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
@@ -341,76 +341,76 @@  discard block
 block discarded – undo
341 341
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
342 342
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
343 343
 <?php
344
-    }
344
+	}
345 345
 ?>
346 346
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
347 347
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
348 348
 <?php
349
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
349
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
350 350
 ?>
351 351
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
352 352
 <?php
353
-    }
354
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
353
+	}
354
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
355 355
 ?>
356 356
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
357 357
 <?php
358
-    }
358
+	}
359 359
 ?>
360 360
 
361 361
 		    <?php
362 362
 			if (function_exists('array_column')) {
363
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
364
-		    ?>
363
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
364
+			?>
365 365
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
366 366
 		    <?php
367
-			    }
367
+				}
368 368
 			} elseif (isset($globalSources)) {
369
-			    $dispolar = false;
370
-			    foreach ($globalSources as $testsource) {
371
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
372
-			    }
373
-			    if ($dispolar) {
374
-		    ?>
369
+				$dispolar = false;
370
+				foreach ($globalSources as $testsource) {
371
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
372
+				}
373
+				if ($dispolar) {
374
+			?>
375 375
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
376 376
 		    <?php
377
-			    }
378
-		        }
379
-		    ?>
377
+				}
378
+				}
379
+			?>
380 380
 <?php
381
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
381
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
382 382
 ?>
383 383
 
384 384
 		    <?php
385 385
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
386
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
387
-		    ?>
386
+					if (extension_loaded('gd') && function_exists('gd_info')) {
387
+			?>
388 388
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
389 389
 		    <?php 
390 390
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
391
-		    ?>
391
+			?>
392 392
 		    <li><?php echo _("Aircraft icon color:"); ?>
393 393
 			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
394 394
 		    </li>
395 395
 		    <?php
396 396
 				}
397
-			    }
398
-		        }
399
-		    ?>
397
+				}
398
+				}
399
+			?>
400 400
 		    <?php
401 401
 			if (isset($globalMarine) && $globalMarine === TRUE) {
402
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
403
-		    ?>
402
+				if (extension_loaded('gd') && function_exists('gd_info')) {
403
+			?>
404 404
 		    <li><?php echo _("Marine icon color:"); ?>
405 405
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
406 406
 		    </li>
407 407
 		    <?php
408
-			    }
409
-		        }
410
-		    ?>
408
+				}
409
+				}
410
+			?>
411 411
 		    <?php
412 412
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
413
-		    ?>
413
+			?>
414 414
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
415 415
 			<div class="range">
416 416
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -419,9 +419,9 @@  discard block
 block discarded – undo
419 419
 		    </li>
420 420
 		    <?php
421 421
 			}
422
-		    ?>
422
+			?>
423 423
 <?php
424
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
424
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
425 425
 ?>
426 426
 <?php
427 427
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 		    </li>
443 443
 <?php
444 444
 	}
445
-    }
445
+	}
446 446
 ?>
447 447
 		    <li><?php echo _("Distance unit:"); ?>
448 448
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -475,19 +475,19 @@  discard block
 block discarded – undo
475 475
 		    <ul>
476 476
 		    <?php
477 477
 			if (!isset($globalAircraft) || $globalAircraft) {
478
-		    ?>
478
+			?>
479 479
 		    <?php
480 480
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
481
-		    ?>
481
+			?>
482 482
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
483 483
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
484 484
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
485 485
 		    <?php
486 486
 			}
487
-		    ?>
487
+			?>
488 488
 		    <?php
489 489
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
490
-		    ?>
490
+			?>
491 491
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
492 492
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
493 493
 			<?php } ?>
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 			<?php } ?>
497 497
 		    <?php
498 498
 			}
499
-		    ?>
499
+			?>
500 500
 		    <li><?php echo _("Display airlines:"); ?>
501 501
 		    <br/>
502 502
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -516,14 +516,14 @@  discard block
 block discarded – undo
516 516
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
517 517
 					}
518 518
 				}
519
-			    ?>
519
+				?>
520 520
 			</select>
521 521
 		    </li>
522 522
 		    <?php
523 523
 			$Spotter = new Spotter();
524 524
 			$allalliancenames = $Spotter->getAllAllianceNames();
525 525
 			if (!empty($allalliancenames)) {
526
-		    ?>
526
+			?>
527 527
 		    <li><?php echo _("Display alliance:"); ?>
528 528
 		    <br/>
529 529
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -537,18 +537,18 @@  discard block
 block discarded – undo
537 537
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
538 538
 					}
539 539
 				}
540
-			    ?>
540
+				?>
541 541
 			</select>
542 542
 		    </li>
543 543
 		    <?php
544 544
 			}
545
-		    ?>
545
+			?>
546 546
 		    <?php
547 547
 			}
548
-		    ?>
548
+			?>
549 549
 		    <?php
550 550
 			if (isset($globalAPRS) && $globalAPRS) {
551
-		    ?>
551
+			?>
552 552
 		    <li><?php echo _("Display APRS sources name:"); ?>
553 553
 			<select class="selectpicker" multiple onchange="sources(this);">
554 554
 			    <?php
@@ -560,18 +560,18 @@  discard block
 block discarded – undo
560 560
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
561 561
 					}
562 562
 				}
563
-			    ?>
563
+				?>
564 564
 			</select>
565 565
 		    </li>
566 566
 		    <?php
567 567
 			}
568
-		    ?>
568
+			?>
569 569
 		    <?php
570 570
 			if (!isset($globalAircraft) && $globalAircraft) {
571
-		    ?>
571
+			?>
572 572
 		    <?php
573 573
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
574
-		    ?>
574
+			?>
575 575
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
576 576
 			<select class="selectpicker" onchange="airlinestype(this);">
577 577
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -582,14 +582,14 @@  discard block
 block discarded – undo
582 582
 		    </li>
583 583
 		    <?php
584 584
 			}
585
-		    ?>
585
+			?>
586 586
 		    <li>
587 587
 			<?php echo _("Display flight with ident:"); ?>
588 588
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
589 589
 		    </li>
590 590
 		    <?php
591 591
 			}
592
-		    ?>
592
+			?>
593 593
 		</ul>
594 594
 	    </form>
595 595
 	    <form method="post">
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 	    </form>
599 599
     	</div>
600 600
 <?php
601
-    if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
601
+	if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
602 602
 ?>
603 603
         <div class="sidebar-pane" id="satellites">
604 604
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -638,14 +638,14 @@  discard block
 block discarded – undo
638 638
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
639 639
 					}
640 640
 				}
641
-			    ?>
641
+				?>
642 642
 			</select>
643 643
 		    </li>
644 644
 		</ul>
645 645
 	    </form>
646 646
 	</div>
647 647
 <?php
648
-    }
648
+	}
649 649
 ?>
650 650
     </div>
651 651
 </div>
Please login to merge, or discard this patch.
require/class.APRS.php 1 patch
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 require_once(dirname(__FILE__).'/settings.php');
3 3
 require_once(dirname(__FILE__).'/class.Common.php');
4 4
 class aprs {
5
-    private $socket;
6
-    private $connected = false;
5
+	private $socket;
6
+	private $connected = false;
7 7
 
8
-    protected $symbols = array('/!' => 'Police',
8
+	protected $symbols = array('/!' => 'Police',
9 9
 	'/#' => 'DIGI',
10 10
 	'/$' => 'Phone',
11 11
 	'/%' => 'DX Cluster',
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 	'\~' => 'TNC Stream SW');
166 166
 	
167 167
 
168
-    private function urshift($n, $s) {
168
+	private function urshift($n, $s) {
169 169
 	return ($n >= 0) ? ($n >> $s) :
170
-	    (($n & 0x7fffffff) >> $s) | 
170
+		(($n & 0x7fffffff) >> $s) | 
171 171
 		(0x40000000 >> ($s - 1));
172
-    }
172
+	}
173 173
 
174
-    public function parse($input) {
174
+	public function parse($input) {
175 175
 	global $globalDebug;
176 176
 	$debug = false;
177 177
 	$result = array();
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
 	
184 184
 	/* Check that end was found and body has at least one byte. */
185 185
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
186
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
187
-	    return false;
186
+		if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
187
+		return false;
188 188
 	}
189 189
 	
190 190
 	if ($debug) echo 'input : '.$input."\n";
@@ -198,34 +198,34 @@  discard block
 block discarded – undo
198 198
 	/* Parse source, target and path. */
199 199
 	//FLRDF0A52>APRS,qAS,LSTB
200 200
 	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) {
201
-	    $ident = $matches[1];
202
-	    $all_elements = $matches[2];
203
-	    if ($ident == 'AIRCRAFT') {
201
+		$ident = $matches[1];
202
+		$all_elements = $matches[2];
203
+		if ($ident == 'AIRCRAFT') {
204 204
 		$result['format_source'] = 'famaprs';
205 205
 		$result['source_type'] = 'modes';
206
-	    } elseif ($ident == 'MARINE') {
206
+		} elseif ($ident == 'MARINE') {
207 207
 		$result['format_source'] = 'famaprs';
208 208
 		$result['source_type'] = 'ais';
209
-	    } else {
209
+		} else {
210 210
 		if ($debug) echo 'ident : '.$ident."\n";
211 211
 		$result['ident'] = $ident;
212
-	    }
212
+		}
213 213
 	} else {
214
-	    if ($debug) 'No ident'."\n";
215
-	    return false;
214
+		if ($debug) 'No ident'."\n";
215
+		return false;
216 216
 	}
217 217
 	$elements = explode(',',$all_elements);
218 218
 	$source = end($elements);
219 219
 	$result['source'] = $source;
220 220
 	foreach ($elements as $element) {
221
-	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
222
-	        //echo "ok";
223
-	        //if ($element == 'TCPIP*') return false;
224
-	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
221
+		if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
222
+			//echo "ok";
223
+			//if ($element == 'TCPIP*') return false;
224
+		} elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
225 225
 		if ($debug) echo 'element : '.$element."\n";
226 226
 		return false;
227
-	    }
228
-	    /*
227
+		}
228
+		/*
229 229
 	    } elseif (preg_match('/^([0-9A-F]{32})$/',$element)) {
230 230
 		//echo "ok";
231 231
 	    } else {
@@ -252,48 +252,48 @@  discard block
 block discarded – undo
252 252
 	$body_parse = substr($body,1);
253 253
 	//echo 'Body : '.$body."\n";
254 254
 	if (preg_match('/^;(.){9}\*/',$body,$matches)) {
255
-	    $body_parse = substr($body_parse,10);
256
-	    $find = true;
257
-	    //echo $body_parse."\n";
255
+		$body_parse = substr($body_parse,10);
256
+		$find = true;
257
+		//echo $body_parse."\n";
258 258
 	}
259 259
 	if (preg_match('/^`(.*)\//',$body,$matches)) {
260
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
261
-	    $find = true;
262
-	    //echo $body_parse."\n";
260
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
261
+		$find = true;
262
+		//echo $body_parse."\n";
263 263
 	}
264 264
 	if (preg_match("/^'(.*)\//",$body,$matches)) {
265
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
266
-	    $find = true;
267
-	    //echo $body_parse."\n";
265
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
266
+		$find = true;
267
+		//echo $body_parse."\n";
268 268
 	}
269 269
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) {
270
-	    $find = true;
271
-	    //print_r($matches);
272
-	    $timestamp = $matches[0];
273
-	    if ($matches[4] == 'h') {
270
+		$find = true;
271
+		//print_r($matches);
272
+		$timestamp = $matches[0];
273
+		if ($matches[4] == 'h') {
274 274
 		$timestamp = strtotime(date('Ymd').' '.$matches[1].':'.$matches[2].':'.$matches[3]);
275 275
 		//echo 'timestamp : '.$timestamp.' - now : '.time()."\n";
276 276
 		/*
277 277
 		if (time() + 3900 < $timestamp) $timestamp -= 86400;
278 278
 		elseif (time() - 82500 > $timestamp) $timestamp += 86400;
279 279
 		*/
280
-	    } elseif ($matches[4] == 'z' || $matches[4] == '/') {
280
+		} elseif ($matches[4] == 'z' || $matches[4] == '/') {
281 281
 		// This work or not ?
282 282
 		$timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]);
283
-	    }
284
-	    $body_parse = substr($body_parse,7);
285
-	    $result['timestamp'] = $timestamp;
286
-	    //echo date('Ymd H:i:s',$timestamp);
283
+		}
284
+		$body_parse = substr($body_parse,7);
285
+		$result['timestamp'] = $timestamp;
286
+		//echo date('Ymd H:i:s',$timestamp);
287 287
 	}
288 288
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) {
289
-	    $find = true;
290
-	    $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
291
-	    $body_parse = substr($body_parse,8);
292
-	    $result['timestamp'] = $timestamp;
293
-	    //echo date('Ymd H:i:s',$timestamp);
289
+		$find = true;
290
+		$timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
291
+		$body_parse = substr($body_parse,8);
292
+		$result['timestamp'] = $timestamp;
293
+		//echo date('Ymd H:i:s',$timestamp);
294 294
 	}
295 295
 	//if (strlen($body_parse) > 19) {
296
-	    if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
296
+		if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
297 297
 		$find = true;
298 298
 		// 4658.70N/00707.78Ez
299 299
 		//print_r(str_split($body_parse));
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		$lon = intval($lon_deg);
313 313
 		if ($lat > 89 || $lon > 179) return false;
314 314
 	    
315
-	    /*
315
+		/*
316 316
 	    $tmp_5b = str_replace('.','',$lat_min);
317 317
 	    if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) {
318 318
 	        print_r($matches);
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
 		$result['longitude'] = $longitude;
327 327
 		$body_parse = substr($body_parse,18);
328 328
 		$body_parse_len = strlen($body_parse);
329
-	    }
330
-	    $body_parse_len = strlen($body_parse);
331
-	    if ($body_parse_len > 0) {
329
+		}
330
+		$body_parse_len = strlen($body_parse);
331
+		if ($body_parse_len > 0) {
332 332
 		/*
333 333
 		if (!isset($result['timestamp']) && !isset($result['latitude'])) {
334 334
 			$body_split = str_split($body);
@@ -362,95 +362,95 @@  discard block
 block discarded – undo
362 362
 			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
363 363
 			if ($symbol_code != '_') {
364 364
 			}
365
-		    //$body_parse = substr($body_parse,1);
366
-		    //$body_parse = trim($body_parse);
367
-		    //$body_parse_len = strlen($body_parse);
368
-		    if ($body_parse_len >= 7) {
365
+			//$body_parse = substr($body_parse,1);
366
+			//$body_parse = trim($body_parse);
367
+			//$body_parse_len = strlen($body_parse);
368
+			if ($body_parse_len >= 7) {
369 369
 			
370
-		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
371
-		    	    $course = substr($body_parse,0,3);
372
-		    	    $tmp_s = intval($course);
373
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
374
-		    	    $speed = substr($body_parse,4,3);
375
-		    	    if ($speed != '...') {
376
-		    		//$result['speed'] = round($speed*1.852);
377
-		    		$result['speed'] = intval($speed);
378
-		    	    }
379
-		    	    $body_parse = substr($body_parse,7);
380
-		        }
381
-		        // Check PHGR, PHG, RNG
382
-		    } 
383
-		    /*
370
+				if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
371
+					$course = substr($body_parse,0,3);
372
+					$tmp_s = intval($course);
373
+					if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
374
+					$speed = substr($body_parse,4,3);
375
+					if ($speed != '...') {
376
+					//$result['speed'] = round($speed*1.852);
377
+					$result['speed'] = intval($speed);
378
+					}
379
+					$body_parse = substr($body_parse,7);
380
+				}
381
+				// Check PHGR, PHG, RNG
382
+			} 
383
+			/*
384 384
 		    else if ($body_parse_len > 0) {
385 385
 			$rest = $body_parse;
386 386
 		    }
387 387
 		    */
388
-		    if (strlen($body_parse) > 0) {
389
-		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
390
-		            $altitude = intval($matches[1]);
391
-		            //$result['altitude'] = round($altitude*0.3048);
392
-		            $result['altitude'] = $altitude;
393
-		            //$body_parse = trim(substr($body_parse,strlen($matches[0])));
394
-		            $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
395
-		        }
396
-		    }
388
+			if (strlen($body_parse) > 0) {
389
+				if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
390
+					$altitude = intval($matches[1]);
391
+					//$result['altitude'] = round($altitude*0.3048);
392
+					$result['altitude'] = $altitude;
393
+					//$body_parse = trim(substr($body_parse,strlen($matches[0])));
394
+					$body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
395
+				}
396
+			}
397 397
 		    
398
-		    // Telemetry
399
-		    /*
398
+			// Telemetry
399
+			/*
400 400
 		    if (preg_match('/^([0-9]+),(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,([01]{0,8})/',$body_parse,$matches)) {
401 401
 		        // Nothing yet...
402 402
 		    }
403 403
 		    */
404
-		    // DAO
404
+			// DAO
405 405
 		    
406
-		    if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
406
+			if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
407 407
 			    
408
-			    $dao = $matches[1];
409
-			    if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
408
+				$dao = $matches[1];
409
+				if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
410 410
 				$dao_split = str_split($dao);
411
-			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
412
-			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
411
+					$lat_off = (($dao_split[1])-48.0)*0.001/60.0;
412
+					$lon_off = (($dao_split[2])-48.0)*0.001/60.0;
413 413
 			    
414 414
 				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
415 415
 				else $result['latitude'] += $lat_off;
416 416
 				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
417 417
 				else $result['longitude'] += $lon_off;
418
-			    }
418
+				}
419 419
 			    
420
-		            $body_parse = substr($body_parse,6);
421
-		    }
420
+					$body_parse = substr($body_parse,6);
421
+			}
422 422
 		    
423
-		    if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
423
+			if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
424 424
 			$result['ident'] = str_replace('_',' ',$matches[1]);
425
-		    }
426
-		    if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
425
+			}
426
+			if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
427 427
 			$result['squawk'] = $matches[1];
428
-		    }
429
-		    if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
428
+			}
429
+			if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
430 430
 			$result['aircraft_icao'] = $matches[1];
431
-		    }
432
-		    if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
431
+			}
432
+			if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
433 433
 			$result['verticalrate'] = $matches[1];
434
-		    }
435
-		    if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
434
+			}
435
+			if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
436 436
 			$result['typeid'] = $matches[1];
437
-		    }
438
-		    if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
437
+			}
438
+			if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
439 439
 			$result['statusid'] = $matches[1];
440
-		    }
441
-		    if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
440
+			}
441
+			if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
442 442
 			$result['imo'] = $matches[1];
443
-		    }
444
-		    if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
443
+			}
444
+			if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
445 445
 			$result['arrival_date'] = $matches[1];
446
-		    }
447
-		    if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
446
+			}
447
+			if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
448 448
 			$result['arrival_code'] = str_replace('_',' ',$matches[1]);
449
-		    }
450
-		    // OGN comment
449
+			}
450
+			// OGN comment
451 451
 		   // echo "Before OGN : ".$body_parse."\n";
452
-		    //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
453
-		    if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
452
+			//if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
453
+			if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
454 454
 			$id = $matches[1];
455 455
 			//$mode = substr($id,0,2);
456 456
 			$address = substr($id,2);
@@ -480,42 +480,42 @@  discard block
 block discarded – undo
480 480
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
481 481
 			$result['stealth'] = $stealth;
482 482
 			$result['address'] = $address;
483
-		    }
483
+			}
484 484
 		    
485
-		    //Comment
486
-		    $result['comment'] = trim($body_parse);
485
+			//Comment
486
+			$result['comment'] = trim($body_parse);
487 487
 		//} else {
488
-		    // parse weather
489
-		    //$body_parse = substr($body_parse,1);
490
-		    //$body_parse_len = strlen($body_parse);
491
-		    //echo 'weather'."\n";
492
-		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
493
-			    $result['wind_dir'] = intval($matches[1]);
494
-			    $result['wind_speed'] = round(intval($matches[2])*1.60934,1);
495
-			    $result['wind_gust'] = round(intval($matches[3])*1.60934,1);
496
-			    $result['temp'] = round(5/9*((intval($matches[4]))-32),1);
497
-		    	    $body_parse = substr($body_parse,strlen($matches[0])+1);
498
-		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
488
+			// parse weather
489
+			//$body_parse = substr($body_parse,1);
490
+			//$body_parse_len = strlen($body_parse);
491
+			//echo 'weather'."\n";
492
+			if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
493
+				$result['wind_dir'] = intval($matches[1]);
494
+				$result['wind_speed'] = round(intval($matches[2])*1.60934,1);
495
+				$result['wind_gust'] = round(intval($matches[3])*1.60934,1);
496
+				$result['temp'] = round(5/9*((intval($matches[4]))-32),1);
497
+					$body_parse = substr($body_parse,strlen($matches[0])+1);
498
+			} elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
499 499
 			$result['wind_dir'] = intval($matches[1]);
500 500
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
501 501
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
502 502
 			$result['temp'] = round(5/9*(($matches[4])-32),1);
503
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
504
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
503
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
504
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
505 505
 			$result['wind_dir'] = intval($matches[1]);
506 506
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
507 507
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
508
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
509
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
508
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
509
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
510 510
 			$result['wind_dir'] = intval($matches[1]);
511 511
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
512 512
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
513
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
514
-		    }
515
-		    //if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
516
-		    //g012t088r000p000P000h38b10110
517
-		    //g011t086r000p000P000h29b10198
518
-		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
513
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
514
+			}
515
+			//if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
516
+			//g012t088r000p000P000h38b10110
517
+			//g011t086r000p000P000h29b10198
518
+			if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
519 519
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
520 520
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
521 521
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
524 524
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
525 525
 			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
526
-		        $body_parse = substr($body_parse,strlen($matches[0]));
527
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
526
+				$body_parse = substr($body_parse,strlen($matches[0]));
527
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
528 528
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
529 529
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
530 530
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
 			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
533 533
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
534 534
 			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
535
-		        $body_parse = substr($body_parse,strlen($matches[0]));
536
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
535
+				$body_parse = substr($body_parse,strlen($matches[0]));
536
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
537 537
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
538 538
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
539 539
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
@@ -541,58 +541,58 @@  discard block
 block discarded – undo
541 541
 			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
542 542
 			if ($matches[7] != '...') $result['humidity'] = intval($matches[7]);
543 543
 			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
544
-		        $body_parse = substr($body_parse,strlen($matches[0]));
545
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
544
+				$body_parse = substr($body_parse,strlen($matches[0]));
545
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
546 546
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
547 547
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
548 548
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
549 549
 			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
550 550
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
551 551
 			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
552
-		        $body_parse = substr($body_parse,strlen($matches[0]));
553
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
552
+				$body_parse = substr($body_parse,strlen($matches[0]));
553
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
554 554
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
555 555
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
556 556
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
557 557
 			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
558 558
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
559 559
 			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
560
-		        $body_parse = substr($body_parse,strlen($matches[0]));
561
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
560
+				$body_parse = substr($body_parse,strlen($matches[0]));
561
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
562 562
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
563 563
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
564 564
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
565 565
 			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
566 566
 			if ($matches[5] != '...') $result['humidity'] = intval($matches[5]);
567 567
 			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
568
-		        $body_parse = substr($body_parse,strlen($matches[0]));
569
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
568
+				$body_parse = substr($body_parse,strlen($matches[0]));
569
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
570 570
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
571 571
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
572 572
 			if ($matches[2] != '...') $result['humidity'] = intval($matches[3]);
573 573
 			if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1);
574
-		        $body_parse = substr($body_parse,strlen($matches[0]));
575
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
574
+				$body_parse = substr($body_parse,strlen($matches[0]));
575
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
576 576
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
577 577
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
578 578
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
579 579
 			if ($matches[4] != '...') $result['humidity'] = intval($matches[4]);
580 580
 			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
581
-		        $body_parse = substr($body_parse,strlen($matches[0]));
582
-		    }
583
-		    $result['comment'] = trim($body_parse);
581
+				$body_parse = substr($body_parse,strlen($matches[0]));
582
+			}
583
+			$result['comment'] = trim($body_parse);
584 584
 		}
585 585
 		} else $result['comment'] = trim($body_parse);
586 586
 
587
-	    }
587
+		}
588 588
 	//}
589 589
 	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
590 590
 	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
591 591
 	if ($debug) print_r($result);
592 592
 	return $result;
593
-    }
593
+	}
594 594
     
595
-    public function connect() {
595
+	public function connect() {
596 596
 	global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport;
597 597
 	$aprs_connect = 0;
598 598
 	$aprs_keep = 120;
@@ -616,24 +616,24 @@  discard block
 block discarded – undo
616 616
 		socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1);
617 617
 		while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) {
618 618
 			if (strpos($msgin, "$aprs_ssid verified") !== FALSE) {
619
-			    echo 'APRS user verified !'."\n";
620
-			    $this->connected = true;
621
-			    return true;
622
-			    break;
619
+				echo 'APRS user verified !'."\n";
620
+				$this->connected = true;
621
+				return true;
622
+				break;
623 623
 			}
624 624
 			if (time()-$authstart > 5) {
625
-			    echo 'APRS timeout'."\n";
626
-			    break;
625
+				echo 'APRS timeout'."\n";
626
+				break;
627 627
 			}
628 628
 		}
629 629
 	}
630
-    }
630
+	}
631 631
 
632
-    public function disconnect() {
632
+	public function disconnect() {
633 633
 	socket_close($this->socket);
634
-    }
634
+	}
635 635
     
636
-    public function send($data) {
636
+	public function send($data) {
637 637
 	global $globalDebug;
638 638
 	if ($this->connected === false) $this->connect();
639 639
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 		socket_close($this->socket);
643 643
 		$this->connect();
644 644
 	}
645
-    }
645
+	}
646 646
 }
647 647
 
648 648
 class APRSSpotter extends APRS {
Please login to merge, or discard this patch.