Completed
Push — master ( 5a5719...9fb1e4 )
by Yannick
31:41
created
live-geojson.php 3 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -5,23 +5,23 @@  discard block
 block discarded – undo
5 5
 $marine = false;
6 6
 $usecoord = false;
7 7
 if (isset($_GET['tracker'])) {
8
-    $tracker = true;
8
+	$tracker = true;
9 9
 }
10 10
 if (isset($_GET['marine'])) {
11
-    $marine = true;
11
+	$marine = true;
12 12
 }
13 13
 if ($tracker) {
14
-    require_once('require/class.Tracker.php');
15
-    require_once('require/class.TrackerLive.php');
16
-    require_once('require/class.TrackerArchive.php');
14
+	require_once('require/class.Tracker.php');
15
+	require_once('require/class.TrackerLive.php');
16
+	require_once('require/class.TrackerArchive.php');
17 17
 } elseif ($marine) {
18
-    require_once('require/class.Marine.php');
19
-    require_once('require/class.MarineLive.php');
20
-    require_once('require/class.MarineArchive.php');
18
+	require_once('require/class.Marine.php');
19
+	require_once('require/class.MarineLive.php');
20
+	require_once('require/class.MarineArchive.php');
21 21
 } else {
22
-    require_once('require/class.Spotter.php');
23
-    require_once('require/class.SpotterLive.php');
24
-    require_once('require/class.SpotterArchive.php');
22
+	require_once('require/class.Spotter.php');
23
+	require_once('require/class.SpotterLive.php');
24
+	require_once('require/class.SpotterArchive.php');
25 25
 }
26 26
 
27 27
 $begintime = microtime(true);
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 $Common = new Common();
42 42
 
43 43
 if (isset($_GET['download'])) {
44
-    if ($_GET['download'] == "true")
45
-    {
44
+	if ($_GET['download'] == "true")
45
+	{
46 46
 	header('Content-disposition: attachment; filename="flightairmap.json"');
47
-    }
47
+	}
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
@@ -498,17 +498,17 @@  discard block
 block discarded – undo
498 498
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
499 499
 				
500 500
 				if (
501
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
502
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
501
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
502
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
503 503
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
504 504
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
505
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
506
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
507
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
508
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
509
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
510
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
511
-				    ) {
505
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
506
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
507
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
508
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
509
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
510
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
511
+					) {
512 512
 					if ($tracker) {
513 513
 						if ($from_archive || $globalArchive) {
514 514
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -597,65 +597,65 @@  discard block
 block discarded – undo
597 597
 				}
598 598
 				
599 599
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
600
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
601
-				     && (isset($spotter_item['departure_airport']) 
602
-				        && $spotter_item['departure_airport'] != 'NA' 
603
-				        && isset($spotter_item['arrival_airport']) 
604
-				        && $spotter_item['arrival_airport'] != 'NA' 
605
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
606
-				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
607
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
608
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
609
-				    if (isset($spotter_item['departure_airport_latitude'])) {
600
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
601
+					 && (isset($spotter_item['departure_airport']) 
602
+						&& $spotter_item['departure_airport'] != 'NA' 
603
+						&& isset($spotter_item['arrival_airport']) 
604
+						&& $spotter_item['arrival_airport'] != 'NA' 
605
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
606
+							|| (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
607
+					if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
608
+					else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
609
+					if (isset($spotter_item['departure_airport_latitude'])) {
610 610
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
611
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
611
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
612 612
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
613 613
 					if (isset($dairport[0]['latitude'])) {
614
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
614
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
615 615
 					}
616
-				    }
617
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
616
+					}
617
+					if (isset($spotter_item['arrival_airport_latitude'])) {
618 618
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],';
619
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
619
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
620 620
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
621 621
 					if (isset($aairport[0]['latitude'])) {
622
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
622
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
623 623
 					}
624
-				    }
625
-				    $output_air  = substr($output_air, 0, -1);
626
-				    $output_air .= ']}},';
627
-				    $output .= $output_air;
628
-				    unset($output_air);
624
+					}
625
+					$output_air  = substr($output_air, 0, -1);
626
+					$output_air .= ']}},';
627
+					$output .= $output_air;
628
+					unset($output_air);
629 629
 				}
630 630
 
631 631
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
632 632
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
633 633
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
634
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
635
-				     && (isset($spotter_item['arrival_airport']) 
636
-				        && $spotter_item['arrival_airport'] != 'NA' 
637
-				        && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
638
-				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
639
-				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
640
-				    $havedata = false;
641
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
642
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
643
-				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
634
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
635
+					 && (isset($spotter_item['arrival_airport']) 
636
+						&& $spotter_item['arrival_airport'] != 'NA' 
637
+						&& ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
638
+							|| (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
639
+							|| (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
640
+					$havedata = false;
641
+					if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
642
+					else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
643
+					$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
644 644
 
645
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
645
+					if (isset($spotter_item['arrival_airport_latitude'])) {
646 646
 					$output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
647 647
 					$havedata = true;
648
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
648
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
649 649
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
650 650
 					if (isset($aairport[0]['latitude'])) {
651
-					    $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
652
-					    $havedata = true;
651
+						$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
652
+						$havedata = true;
653 653
 					}
654
-				    }
655
-				    //$output_dest  = substr($output_dest, 0, -1);
656
-				    $output_dest .= ']}},';
657
-				    if ($havedata) $output .= $output_dest;
658
-				    unset($output_dest);
654
+					}
655
+					//$output_dest  = substr($output_dest, 0, -1);
656
+					$output_dest .= ']}},';
657
+					if ($havedata) $output .= $output_dest;
658
+					unset($output_dest);
659 659
 				}
660 660
 			}
661 661
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -55,23 +55,23 @@  discard block
 block discarded – undo
55 55
 $min = true;
56 56
 $allhistory = false;
57 57
 $filter['source'] = array();
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
60
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
62
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
63
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
67
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
58
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
59
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
60
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
61
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
62
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
63
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
64
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
65
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
66
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
67
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
68 68
 
69 69
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
70 70
 	$min = true;
71 71
 } else $min = false;
72 72
 
73 73
 if (isset($_GET['ident'])) {
74
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
74
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
75 75
 	if ($tracker) {
76 76
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
77 77
 	} elseif ($marine) {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	}
86 86
 	$allhistory = true;
87 87
 } elseif (isset($_GET['flightaware_id'])) {
88
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
88
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
89 89
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
90 90
 	if (empty($spotter_array)) {
91 91
 		$from_archive = true;
@@ -93,44 +93,44 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 	$allhistory = true;
95 95
 } elseif (isset($_GET['famtrack_id'])) {
96
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
96
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
97 97
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
98 98
 	$allhistory = true;
99 99
 } elseif (isset($_GET['fammarine_id'])) {
100
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
100
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
101 101
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
102 102
 	$allhistory = true;
103 103
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
104 104
 //} elseif (isset($_GET['coord'])) {
105 105
 	$usecoord = true;
106
-	$coord = explode(',',$_GET['coord']);
106
+	$coord = explode(',', $_GET['coord']);
107 107
 	if ($tracker) {
108
-		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
108
+		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter);
109 109
 	} elseif ($marine) {
110
-		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter);
110
+		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter);
111 111
 	} else {
112
-		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
112
+		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
113 113
 	}
114 114
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) {
115 115
 	$usecoord = true;
116
-	$coord = explode(',',$_GET['coord']);
116
+	$coord = explode(',', $_GET['coord']);
117 117
 	if ($tracker) {
118
-		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
118
+		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
119 119
 	} elseif ($marine) {
120
-		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
120
+		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
121 121
 	} else {
122
-		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
122
+		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
123 123
 	}
124 124
 } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) {
125 125
 	$from_archive = true;
126 126
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
127 127
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
128
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
129
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
130
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
131
-	$begindate = date('Y-m-d H:i:s',$begindate);
132
-	$enddate = date('Y-m-d H:i:s',$enddate);
133
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
128
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
129
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
130
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
131
+	$begindate = date('Y-m-d H:i:s', $begindate);
132
+	$enddate = date('Y-m-d H:i:s', $enddate);
133
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
134 134
 } elseif ($min) {
135 135
 	if ($tracker) {
136 136
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -142,17 +142,17 @@  discard block
 block discarded – undo
142 142
 #	$min = true;
143 143
 } else {
144 144
 	if ($tracker) {
145
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
145
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
146 146
 	} elseif ($marine) {
147
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
147
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
148 148
 	} else {
149
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
149
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
150 150
 	}
151 151
 }
152 152
 
153 153
 if ($usecoord) {
154 154
 	if (isset($_GET['archive'])) {
155
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
155
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
156 156
 	} else {
157 157
 		if ($tracker) {
158 158
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	if ($flightcnt == '') $flightcnt = 0;
166 166
 } else $flightcnt = 0;
167 167
 
168
-$sqltime = round(microtime(true)-$begintime,2);
168
+$sqltime = round(microtime(true) - $begintime, 2);
169 169
 
170
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
170
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
171 171
 if ($currenttime != '') $currenttime = round($currenttime/1000);
172 172
 
173 173
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		if (!empty($spotter_array) && is_array($spotter_array))
187 187
 		{
188 188
 			$output .= '"features": [';
189
-			foreach($spotter_array as $spotter_item)
189
+			foreach ($spotter_array as $spotter_item)
190 190
 			{
191 191
 				$j++;
192 192
 				date_default_timezone_set('UTC');
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
 */
243 243
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
244 244
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
245
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
246
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
245
+							if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
246
+							else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",';
247 247
 							//"
248 248
 						} else {
249 249
 							if ($compress) $output .= '"c": "NA",';
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
253 253
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
254 254
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
255
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
255
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
256 256
 						} elseif (isset($spotter_item['aircraft_type'])) {
257 257
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
258 258
 						} elseif (!$min) {
@@ -395,26 +395,26 @@  discard block
 block discarded – undo
395 395
 						if ($currenttime != '') {
396 396
 							if (strtotime($spotter_item['date']) < $currenttime) {
397 397
 								if (isset($archivespeed)) {
398
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date'])+$globalMapRefresh);
398
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, $currenttime - strtotime($spotter_item['date']) + $globalMapRefresh);
399 399
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
400 400
 								} elseif ($usenextlatlon) {
401
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],1,$currenttime-strtotime($spotter_item['date'])+$globalMapRefresh);
401
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], 1, $currenttime - strtotime($spotter_item['date']) + $globalMapRefresh);
402 402
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
403 403
 								}
404 404
 							}
405 405
 						} else {
406 406
 							if (isset($archivespeed)) {
407
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
407
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
408 408
 								$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
409 409
 							} elseif ($usenextlatlon) {
410
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
410
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
411 411
 								$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
412 412
 							}
413 413
 						}
414 414
 
415 415
 						if (!$min) $output .= '"image": "'.$image.'",';
416 416
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
417
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
417
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
418 418
 						}
419 419
 						if (isset($spotter_item['image_source_website'])) {
420 420
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
437 437
 						}
438 438
 						if (isset($spotter_item['acars'])) {
439
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
439
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
440 440
 						}
441 441
 						// type when not aircraft ?
442 442
 						if (isset($spotter_item['type'])) {
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 								if ($currenttime != '') {
457 457
 									if (strtotime($spotter_item['date']) < $currenttime) {
458 458
 										if (!isset($archivespeed)) $archivespeed = 1;
459
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date']));
459
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, $currenttime - strtotime($spotter_item['date']));
460 460
 										$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
461 461
 									} else {
462 462
 										$output .= $spotter_item['longitude'].', ';
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                 
526 526
 			}
527 527
 */
528
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
528
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
529 529
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
530 530
 				
531 531
 				if (
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
534 534
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
535 535
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
536
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
536
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
537 537
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
538
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
538
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
539 539
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
540
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
540
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
541 541
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
542 542
 				    ) {
543 543
 					if ($tracker) {
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
575 575
 							}
576 576
 							$output_history .= '[';
577
-							$output_history .=  $spotter_history['longitude'].', ';
578
-							$output_history .=  $spotter_history['latitude'].', ';
579
-							$output_history .=  $spotter_history['altitude']*30.48;
577
+							$output_history .= $spotter_history['longitude'].', ';
578
+							$output_history .= $spotter_history['latitude'].', ';
579
+							$output_history .= $spotter_history['altitude']*30.48;
580 580
 							$output_history .= '],';
581 581
 							/*
582 582
 							if ($from_archive === false) {
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
595 595
 							} else $d = true;
596 596
 							$output_history .= '[';
597
-							$output_history .=  $spotter_history['longitude'].', ';
598
-							$output_history .=  $spotter_history['latitude'];
597
+							$output_history .= $spotter_history['longitude'].', ';
598
+							$output_history .= $spotter_history['latitude'];
599 599
 							$output_history .= '],';
600 600
 							/*
601 601
 							if ($from_archive === false) {
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 					
612 612
 						if ($from_archive === false) {
613 613
 							$output_historyd = '[';
614
-							$output_historyd .=  $spotter_item['longitude'].', ';
615
-							$output_historyd .=  $spotter_item['latitude'];
616
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
614
+							$output_historyd .= $spotter_item['longitude'].', ';
615
+							$output_historyd .= $spotter_item['latitude'];
616
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
617 617
 							$output_historyd .= '],';
618 618
 							//$output_history = $output_historyd.$output_history;
619 619
 							$output_history = $output_history.$output_historyd;
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 					}
628 628
 				}
629 629
 				
630
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
630
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
631 631
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
632 632
 				     && (isset($spotter_item['departure_airport']) 
633 633
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 
662 662
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
663 663
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
664
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
664
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
665 665
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
666 666
 				     && (isset($spotter_item['arrival_airport']) 
667 667
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 			$output  = substr($output, 0, -1);
693 693
 			$output .= ']';
694 694
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
695
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
695
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
696 696
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
697 697
 			$output .= '"fc": "'.$j.'"';
698 698
 		} else {
Please login to merge, or discard this patch.
Braces   +297 added lines, -116 removed lines patch added patch discarded remove patch
@@ -48,27 +48,52 @@  discard block
 block discarded – undo
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
51
-if (!isset($globalJsonCompress)) $compress = true;
52
-else $compress = $globalJsonCompress;
51
+if (!isset($globalJsonCompress)) {
52
+	$compress = true;
53
+} else {
54
+	$compress = $globalJsonCompress;
55
+}
53 56
 
54 57
 $from_archive = false;
55 58
 $min = true;
56 59
 $allhistory = false;
57 60
 $filter['source'] = array();
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
60
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
62
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
63
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
67
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
61
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
62
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
63
+}
64
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
65
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
66
+}
67
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
68
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
69
+}
70
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
71
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
72
+}
73
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
74
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
75
+}
76
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
77
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
78
+}
79
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
80
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
81
+}
82
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
83
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
84
+}
85
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
86
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
87
+}
88
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
89
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
90
+}
68 91
 
69 92
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
70 93
 	$min = true;
71
-} else $min = false;
94
+} else {
95
+	$min = false;
96
+}
72 97
 
73 98
 if (isset($_GET['ident'])) {
74 99
 	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
@@ -162,24 +187,38 @@  discard block
 block discarded – undo
162 187
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
163 188
 		}
164 189
 	}
165
-	if ($flightcnt == '') $flightcnt = 0;
166
-} else $flightcnt = 0;
190
+	if ($flightcnt == '') {
191
+		$flightcnt = 0;
192
+	}
193
+	} else {
194
+	$flightcnt = 0;
195
+}
167 196
 
168 197
 $sqltime = round(microtime(true)-$begintime,2);
169 198
 
170 199
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
171
-if ($currenttime != '') $currenttime = round($currenttime/1000);
200
+if ($currenttime != '') {
201
+	$currenttime = round($currenttime/1000);
202
+}
172 203
 
173
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
174
-else $usenextlatlon = true;
175
-if ($usenextlatlon === false) $currenttime = '';
204
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
205
+	$usenextlatlon = false;
206
+} else {
207
+	$usenextlatlon = true;
208
+}
209
+if ($usenextlatlon === false) {
210
+	$currenttime = '';
211
+}
176 212
 $j = 0;
177 213
 $prev_flightaware_id = '';
178 214
 $aircrafts_shadow = array();
179 215
 $output = '{';
180 216
 	$output .= '"type": "FeatureCollection",';
181
-		if ($min) $output .= '"minimal": "true",';
182
-		else $output .= '"minimal": "false",';
217
+		if ($min) {
218
+			$output .= '"minimal": "true",';
219
+		} else {
220
+			$output .= '"minimal": "false",';
221
+		}
183 222
 		//$output .= '"fc": "'.$flightcnt.'",';
184 223
 		$output .= '"sqt": "'.$sqltime.'",';
185 224
 
@@ -223,18 +262,29 @@  discard block
 block discarded – undo
223 262
 						}
224 263
 						$output .= '"properties": {';
225 264
 						if (isset($spotter_item['flightaware_id'])) {
226
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
227
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
265
+							if ($compress) {
266
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
267
+							} else {
268
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
269
+							}
228 270
 						} elseif (isset($spotter_item['famtrackid'])) {
229
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
230
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
271
+							if ($compress) {
272
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
273
+							} else {
274
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
275
+							}
231 276
 						} elseif (isset($spotter_item['fammarine_id'])) {
232
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
233
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
277
+							if ($compress) {
278
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
279
+							} else {
280
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
281
+							}
234 282
 						}
235 283
 							$output .= '"fc": "'.$flightcnt.'",';
236 284
 							$output .= '"sqt": "'.$sqltime.'",';
237
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
285
+							if (isset($begindate)) {
286
+								$output .= '"archive_date": "'.$begindate.'",';
287
+							}
238 288
 
239 289
 /*
240 290
 							if ($min) $output .= '"minimal": "true",';
@@ -242,14 +292,22 @@  discard block
 block discarded – undo
242 292
 */
243 293
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
244 294
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
245
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
246
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
295
+							if ($compress) {
296
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
297
+							} else {
298
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
299
+							}
247 300
 							//"
248 301
 						} else {
249
-							if ($compress) $output .= '"c": "NA",';
250
-							else $output .= '"callsign": "NA",';
302
+							if ($compress) {
303
+								$output .= '"c": "NA",';
304
+							} else {
305
+								$output .= '"callsign": "NA",';
306
+							}
307
+						}
308
+						if (isset($spotter_item['registration'])) {
309
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
251 310
 						}
252
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
253 311
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
254 312
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
255 313
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -262,16 +320,23 @@  discard block
 block discarded – undo
262 320
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
263 321
 						}
264 322
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
265
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
266
-							else {
323
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
324
+								$spotter_item['aircraft_shadow'] = '';
325
+							} else {
267 326
 								$aircraft_icao = $spotter_item['aircraft_icao'];
268
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
269
-								else {
327
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
328
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
329
+								} else {
270 330
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
271
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
272
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
273
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
274
-									else $spotter_item['aircraft_shadow'] = '';
331
+									if (count($aircraft_info) > 0) {
332
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
333
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
334
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
335
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
336
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
337
+									} else {
338
+										$spotter_item['aircraft_shadow'] = '';
339
+									}
275 340
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
276 341
 								}
277 342
 							}
@@ -279,73 +344,139 @@  discard block
 block discarded – undo
279 344
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
280 345
 							if ($tracker) {
281 346
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
282
-									if ($compress) $output .= '"as": "ambulance.png",';
283
-									else $output .= '"aircraft_shadow": "ambulance.png",';
347
+									if ($compress) {
348
+										$output .= '"as": "ambulance.png",';
349
+									} else {
350
+										$output .= '"aircraft_shadow": "ambulance.png",';
351
+									}
284 352
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
285
-									if ($compress) $output .= '"as": "police.png",';
286
-									else $output .= '"aircraft_shadow": "police.png",';
353
+									if ($compress) {
354
+										$output .= '"as": "police.png",';
355
+									} else {
356
+										$output .= '"aircraft_shadow": "police.png",';
357
+									}
287 358
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
288
-									if ($compress) $output .= '"as": "ship.png",';
289
-									else $output .= '"aircraft_shadow": "ship.png",';
359
+									if ($compress) {
360
+										$output .= '"as": "ship.png",';
361
+									} else {
362
+										$output .= '"aircraft_shadow": "ship.png",';
363
+									}
290 364
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
291
-									if ($compress) $output .= '"as": "ship.png",';
292
-									else $output .= '"aircraft_shadow": "ship.png",';
365
+									if ($compress) {
366
+										$output .= '"as": "ship.png",';
367
+									} else {
368
+										$output .= '"aircraft_shadow": "ship.png",';
369
+									}
293 370
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
294
-									if ($compress) $output .= '"as": "ship.png",';
295
-									else $output .= '"aircraft_shadow": "ship.png",';
371
+									if ($compress) {
372
+										$output .= '"as": "ship.png",';
373
+									} else {
374
+										$output .= '"aircraft_shadow": "ship.png",';
375
+									}
296 376
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
297
-									if ($compress) $output .= '"as": "truck.png",';
298
-									else $output .= '"aircraft_shadow": "truck.png",';
377
+									if ($compress) {
378
+										$output .= '"as": "truck.png",';
379
+									} else {
380
+										$output .= '"aircraft_shadow": "truck.png",';
381
+									}
299 382
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
300
-									if ($compress) $output .= '"as": "truck.png",';
301
-									else $output .= '"aircraft_shadow": "truck.png",';
383
+									if ($compress) {
384
+										$output .= '"as": "truck.png",';
385
+									} else {
386
+										$output .= '"aircraft_shadow": "truck.png",';
387
+									}
302 388
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
303
-									if ($compress) $output .= '"as": "aircraft.png",';
304
-									else $output .= '"aircraft_shadow": "aircraft.png",';
389
+									if ($compress) {
390
+										$output .= '"as": "aircraft.png",';
391
+									} else {
392
+										$output .= '"aircraft_shadow": "aircraft.png",';
393
+									}
305 394
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
306
-									if ($compress) $output .= '"as": "aircraft.png",';
307
-									else $output .= '"aircraft_shadow": "aircraft.png",';
395
+									if ($compress) {
396
+										$output .= '"as": "aircraft.png",';
397
+									} else {
398
+										$output .= '"aircraft_shadow": "aircraft.png",';
399
+									}
308 400
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
309
-									if ($compress) $output .= '"as": "helico.png",';
310
-									else $output .= '"aircraft_shadow": "helico.png",';
401
+									if ($compress) {
402
+										$output .= '"as": "helico.png",';
403
+									} else {
404
+										$output .= '"aircraft_shadow": "helico.png",';
405
+									}
311 406
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
312
-									if ($compress) $output .= '"as": "rail.png",';
313
-									else $output .= '"aircraft_shadow": "rail.png",';
407
+									if ($compress) {
408
+										$output .= '"as": "rail.png",';
409
+									} else {
410
+										$output .= '"aircraft_shadow": "rail.png",';
411
+									}
314 412
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
315
-									if ($compress) $output .= '"as": "firetruck.png",';
316
-									else $output .= '"aircraft_shadow": "firetruck.png",';
413
+									if ($compress) {
414
+										$output .= '"as": "firetruck.png",';
415
+									} else {
416
+										$output .= '"aircraft_shadow": "firetruck.png",';
417
+									}
317 418
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
318
-									if ($compress) $output .= '"as": "bus.png",';
319
-									else $output .= '"aircraft_shadow": "bus.png",';
419
+									if ($compress) {
420
+										$output .= '"as": "bus.png",';
421
+									} else {
422
+										$output .= '"aircraft_shadow": "bus.png",';
423
+									}
320 424
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
321
-									if ($compress) $output .= '"as": "phone.png",';
322
-									else $output .= '"aircraft_shadow": "phone.png",';
425
+									if ($compress) {
426
+										$output .= '"as": "phone.png",';
427
+									} else {
428
+										$output .= '"aircraft_shadow": "phone.png",';
429
+									}
323 430
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
324
-									if ($compress) $output .= '"as": "jogger.png",';
325
-									else $output .= '"aircraft_shadow": "jogger.png",';
431
+									if ($compress) {
432
+										$output .= '"as": "jogger.png",';
433
+									} else {
434
+										$output .= '"aircraft_shadow": "jogger.png",';
435
+									}
326 436
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
327
-									if ($compress) $output .= '"as": "bike.png",';
328
-									else $output .= '"aircraft_shadow": "bike.png",';
437
+									if ($compress) {
438
+										$output .= '"as": "bike.png",';
439
+									} else {
440
+										$output .= '"aircraft_shadow": "bike.png",';
441
+									}
329 442
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
330
-									if ($compress) $output .= '"as": "motorcycle.png",';
331
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
443
+									if ($compress) {
444
+										$output .= '"as": "motorcycle.png",';
445
+									} else {
446
+										$output .= '"aircraft_shadow": "motorcycle.png",';
447
+									}
332 448
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
333
-									if ($compress) $output .= '"as": "balloon.png",';
334
-									else $output .= '"aircraft_shadow": "balloon.png",';
449
+									if ($compress) {
450
+										$output .= '"as": "balloon.png",';
451
+									} else {
452
+										$output .= '"aircraft_shadow": "balloon.png",';
453
+									}
335 454
 								} else {
336
-									if ($compress) $output .= '"as": "car.png",';
337
-									else $output .= '"aircraft_shadow": "car.png",';
455
+									if ($compress) {
456
+										$output .= '"as": "car.png",';
457
+									} else {
458
+										$output .= '"aircraft_shadow": "car.png",';
459
+									}
338 460
 								}
339 461
 							} elseif ($marine) {
340
-								if ($compress) $output .= '"as": "ship.png",';
341
-								else $output .= '"aircraft_shadow": "ship.png",';
462
+								if ($compress) {
463
+									$output .= '"as": "ship.png",';
464
+								} else {
465
+									$output .= '"aircraft_shadow": "ship.png",';
466
+								}
342 467
 							} else {
343
-								if ($compress) $output .= '"as": "default.png",';
344
-								else $output .= '"aircraft_shadow": "default.png",';
468
+								if ($compress) {
469
+									$output .= '"as": "default.png",';
470
+								} else {
471
+									$output .= '"aircraft_shadow": "default.png",';
472
+								}
345 473
 							}
346 474
 						} else {
347
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
348
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
475
+							if ($compress) {
476
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
477
+							} else {
478
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
479
+							}
349 480
 						}
350 481
 						if (isset($spotter_item['airline_name'])) {
351 482
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -353,8 +484,11 @@  discard block
 block discarded – undo
353 484
 							$output .= '"airline_name": "NA",';
354 485
 						}
355 486
 						if (isset($spotter_item['departure_airport'])) {
356
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
357
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
487
+							if ($compress) {
488
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
489
+							} else {
490
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
491
+							}
358 492
 						}
359 493
 						if (isset($spotter_item['departure_airport_city'])) {
360 494
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -366,8 +500,11 @@  discard block
 block discarded – undo
366 500
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
367 501
 						}
368 502
 						if (isset($spotter_item['arrival_airport'])) {
369
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
370
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
503
+							if ($compress) {
504
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
505
+							} else {
506
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
507
+							}
371 508
 						}
372 509
 						if (isset($spotter_item['arrival_airport_city'])) {
373 510
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -386,11 +523,17 @@  discard block
 block discarded – undo
386 523
 						}
387 524
 						
388 525
 						if (isset($spotter_item['altitude'])) {
389
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
390
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
526
+							if ($compress) {
527
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
528
+							} else {
529
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
530
+							}
531
+						}
532
+						if ($compress) {
533
+							$output .= '"h": "'.$spotter_item['heading'].'",';
534
+						} else {
535
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
391 536
 						}
392
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
393
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
394 537
 						
395 538
 						if ($currenttime != '') {
396 539
 							if (strtotime($spotter_item['date']) < $currenttime) {
@@ -412,7 +555,9 @@  discard block
 block discarded – undo
412 555
 							}
413 556
 						}
414 557
 
415
-						if (!$min) $output .= '"image": "'.$image.'",';
558
+						if (!$min) {
559
+							$output .= '"image": "'.$image.'",';
560
+						}
416 561
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
417 562
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
418 563
 						}
@@ -420,8 +565,11 @@  discard block
 block discarded – undo
420 565
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
421 566
 						}
422 567
 						if (isset($spotter_item['squawk'])) {
423
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
424
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
568
+							if ($compress) {
569
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
570
+							} else {
571
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
572
+							}
425 573
 						}
426 574
 						if (isset($spotter_item['squawk_usage'])) {
427 575
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -440,14 +588,23 @@  discard block
 block discarded – undo
440 588
 						}
441 589
 						// type when not aircraft ?
442 590
 						if (isset($spotter_item['type'])) {
443
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
444
-							else $output .= '"type": "'.$spotter_item['type'].'"';
591
+							if ($compress) {
592
+								$output .= '"t": "'.$spotter_item['type'].'"';
593
+							} else {
594
+								$output .= '"type": "'.$spotter_item['type'].'"';
595
+							}
445 596
 						} elseif ($marine) {
446
-							if ($compress) $output .= '"t": "ship"';
447
-							else $output .= '"type": "ship"';
597
+							if ($compress) {
598
+								$output .= '"t": "ship"';
599
+							} else {
600
+								$output .= '"type": "ship"';
601
+							}
448 602
 						} else {
449
-							if ($compress) $output .= '"t": "aircraft"';
450
-							else $output .= '"type": "aircraft"';
603
+							if ($compress) {
604
+								$output .= '"t": "aircraft"';
605
+							} else {
606
+								$output .= '"type": "aircraft"';
607
+							}
451 608
 						}
452 609
 						$output .= '},';
453 610
 						$output .= '"geometry": {';
@@ -455,7 +612,9 @@  discard block
 block discarded – undo
455 612
 								$output .= '"coordinates": [';
456 613
 								if ($currenttime != '') {
457 614
 									if (strtotime($spotter_item['date']) < $currenttime) {
458
-										if (!isset($archivespeed)) $archivespeed = 1;
615
+										if (!isset($archivespeed)) {
616
+											$archivespeed = 1;
617
+										}
459 618
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date']));
460 619
 										$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
461 620
 									} else {
@@ -526,7 +685,9 @@  discard block
 block discarded – undo
526 685
 			}
527 686
 */
528 687
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
529
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
688
+				if ($history == '' && isset($_COOKIE['history'])) {
689
+					$history = $_COOKIE['history'];
690
+				}
530 691
 				
531 692
 				if (
532 693
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -570,8 +731,11 @@  discard block
 block discarded – undo
570 731
 									$output_history .= ']}},';
571 732
 									$output .= $output_history;
572 733
 								}
573
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
574
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
734
+								if ($compress) {
735
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
736
+								} else {
737
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
738
+								}
575 739
 							}
576 740
 							$output_history .= '[';
577 741
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -590,9 +754,14 @@  discard block
 block discarded – undo
590 754
 							$prev_alt = $alt;
591 755
 						} else {
592 756
 							if ($d == false) {
593
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
594
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
595
-							} else $d = true;
757
+								if ($compress) {
758
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
759
+								} else {
760
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
761
+								}
762
+							} else {
763
+								$d = true;
764
+							}
596 765
 							$output_history .= '[';
597 766
 							$output_history .=  $spotter_history['longitude'].', ';
598 767
 							$output_history .=  $spotter_history['latitude'];
@@ -613,7 +782,9 @@  discard block
 block discarded – undo
613 782
 							$output_historyd = '[';
614 783
 							$output_historyd .=  $spotter_item['longitude'].', ';
615 784
 							$output_historyd .=  $spotter_item['latitude'];
616
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
785
+							if (isset($spotter_history['altitude'])) {
786
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
787
+							}
617 788
 							$output_historyd .= '],';
618 789
 							//$output_history = $output_historyd.$output_history;
619 790
 							$output_history = $output_history.$output_historyd;
@@ -635,8 +806,11 @@  discard block
 block discarded – undo
635 806
 				        && $spotter_item['arrival_airport'] != 'NA' 
636 807
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
637 808
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
638
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
639
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
809
+				    if ($compress) {
810
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
811
+				    } else {
812
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
813
+				    }
640 814
 				    if (isset($spotter_item['departure_airport_latitude'])) {
641 815
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
642 816
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -669,8 +843,11 @@  discard block
 block discarded – undo
669 843
 				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
670 844
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
671 845
 				    $havedata = false;
672
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
673
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
846
+				    if ($compress) {
847
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
848
+				    } else {
849
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
850
+				    }
674 851
 				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
675 852
 
676 853
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -685,7 +862,9 @@  discard block
 block discarded – undo
685 862
 				    }
686 863
 				    //$output_dest  = substr($output_dest, 0, -1);
687 864
 				    $output_dest .= ']}},';
688
-				    if ($havedata) $output .= $output_dest;
865
+				    if ($havedata) {
866
+				    	$output .= $output_dest;
867
+				    }
689 868
 				    unset($output_dest);
690 869
 				}
691 870
 			}
@@ -693,7 +872,9 @@  discard block
 block discarded – undo
693 872
 			$output .= ']';
694 873
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
695 874
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
696
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
875
+			if (isset($begindate)) {
876
+				$output .= '"archive_date": "'.$begindate.'",';
877
+			}
697 878
 			$output .= '"fc": "'.$j.'"';
698 879
 		} else {
699 880
 			$output .= '"features": ';
Please login to merge, or discard this patch.
js/map.2d.js.php 3 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5
-setcookie("MapFormat",'2d');
5
+setcookie("MapFormat", '2d');
6 6
 
7 7
 if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
8 8
 // Compressed GeoJson is used if true
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 	$lastupd = $_GET['archivespeed']*$archiveupdatetime;
21 21
 	if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate'];
22 22
 	else $enddate = time();
23
-	setcookie("archive_begin",$begindate);
24
-	setcookie("archive_end",$enddate);
25
-	setcookie("archive_update",$lastupd);
26
-	setcookie("archive_speed",$archivespeed);
23
+	setcookie("archive_begin", $begindate);
24
+	setcookie("archive_end", $enddate);
25
+	setcookie("archive_update", $lastupd);
26
+	setcookie("archive_speed", $archivespeed);
27 27
 ?>
28 28
 document.cookie =  'archive_begin=<?php print $begindate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/';
29 29
 document.cookie =  'archive_end=<?php print $enddate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/';
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
 <?php
75 75
 	}
76 76
 	if (isset($_GET['ident'])) {
77
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
77
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
78 78
 	}
79 79
 	if (isset($_GET['flightaware_id'])) {
80
-		$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
80
+		$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
81 81
 	}
82 82
 	if (isset($_GET['latitude'])) {
83
-		$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_STRING);
83
+		$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_STRING);
84 84
 	}
85 85
 	if (isset($_GET['longitude'])) {
86
-		$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_STRING);
86
+		$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_STRING);
87 87
 	}
88 88
 ?>
89 89
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	     || navigator.userAgent.match(/BlackBerry/i)
120 120
 	     || navigator.userAgent.match(/Windows Phone/i))
121 121
 	{
122
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>;
122
+		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom - 1; else print '8'; ?>;
123 123
 	} else {
124 124
 		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>;
125 125
 	}
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
 	map.addLayer(yandexLayer);
214 214
 <?php
215 215
 	} elseif ($MapType == 'Bing-Aerial') {
216
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
216
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
217 217
 ?>
218 218
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
219 219
 	map.addLayer(bingLayer);
220 220
 <?php
221 221
 	} elseif ($MapType == 'Bing-Hybrid') {
222
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
222
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
223 223
 ?>
224 224
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
225 225
 	map.addLayer(bingLayer);
226 226
 <?php
227 227
 	} elseif ($MapType == 'Bing-Road') {
228
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
228
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
229 229
 ?>
230 230
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
231 231
 	map.addLayer(bingLayer);
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
386 386
 
387 387
 <?php
388
-    // Add support for custom json via $globalMapJson
389
-    if (isset($globalMapJson) && is_array($globalMapJson)) {
388
+	// Add support for custom json via $globalMapJson
389
+	if (isset($globalMapJson) && is_array($globalMapJson)) {
390 390
 	foreach ($globalMapJson as $json) {
391
-	    if (isset($json['url'])) {
391
+		if (isset($json['url'])) {
392 392
 ?>
393 393
 update_genLayer('<?php print $json['url']; ?>');
394 394
 <?php
@@ -397,9 +397,9 @@  discard block
 block discarded – undo
397 397
 setInterval(function(){update_genLayer('<?php print $json['url']; ?>')}, <?php print $json['refresh']; ?>);
398 398
 <?php
399 399
 		}
400
-	    }
400
+		}
401
+	}
401 402
 	}
402
-    }
403 403
 
404 404
 ?>
405 405
 //adds the bootstrap tooltip to the map icons
Please login to merge, or discard this patch.
Braces   +101 added lines, -26 removed lines patch added patch discarded remove patch
@@ -4,10 +4,15 @@  discard block
 block discarded – undo
4 4
 
5 5
 setcookie("MapFormat",'2d');
6 6
 
7
-if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
7
+if (!isset($globalOpenWeatherMapKey)) {
8
+	$globalOpenWeatherMapKey = '';
9
+}
8 10
 // Compressed GeoJson is used if true
9
-if (!isset($globalJsonCompress)) $compress = true;
10
-else $compress = $globalJsonCompress;
11
+if (!isset($globalJsonCompress)) {
12
+	$compress = true;
13
+} else {
14
+	$compress = $globalJsonCompress;
15
+}
11 16
 if (isset($_GET['archive'])) {
12 17
 	$archive = true;
13 18
 	//$archiveupdatetime = 50;
@@ -18,8 +23,11 @@  discard block
 block discarded – undo
18 23
 	//$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10));
19 24
 	//$lastupd = 20;
20 25
 	$lastupd = $_GET['archivespeed']*$archiveupdatetime;
21
-	if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate'];
22
-	else $enddate = time();
26
+	if (isset($_GET['enddate']) && $_GET['enddate'] != '') {
27
+		$enddate = $_GET['enddate'];
28
+	} else {
29
+		$enddate = time();
30
+	}
23 31
 	setcookie("archive_begin",$begindate);
24 32
 	setcookie("archive_end",$enddate);
25 33
 	setcookie("archive_update",$lastupd);
@@ -106,7 +114,17 @@  discard block
 block discarded – undo
106 114
 	}
107 115
 
108 116
 	//create the map
109
-	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom);
117
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
118
+	print $latitude;
119
+} else {
120
+	print $globalCenterLatitude;
121
+}
122
+?>,<?php if (isset($longitude)) {
123
+	print $longitude;
124
+} else {
125
+	print $globalCenterLongitude;
126
+}
127
+?>], zoom);
110 128
 <?php
111 129
 	} else {
112 130
 ?>
@@ -119,9 +137,19 @@  discard block
 block discarded – undo
119 137
 	     || navigator.userAgent.match(/BlackBerry/i)
120 138
 	     || navigator.userAgent.match(/Windows Phone/i))
121 139
 	{
122
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>;
140
+		var zoom = <?php if (isset($globalLiveZoom)) {
141
+	print $globalLiveZoom-1;
142
+} else {
143
+	print '8';
144
+}
145
+?>;
123 146
 	} else {
124
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>;
147
+		var zoom = <?php if (isset($globalLiveZoom)) {
148
+	print $globalLiveZoom;
149
+} else {
150
+	print '9';
151
+}
152
+?>;
125 153
 	}
126 154
 
127 155
 	//create the map
@@ -146,16 +174,27 @@  discard block
 block discarded – undo
146 174
 	bounds = L.latLngBounds(southWest,northEast);
147 175
 	//a few title layers
148 176
 <?php
149
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
150
-	else $MapType = $globalMapProvider;
177
+	if (isset($_COOKIE['MapType'])) {
178
+		$MapType = $_COOKIE['MapType'];
179
+	} else {
180
+		$MapType = $globalMapProvider;
181
+	}
151 182
 
152 183
 	if ($MapType == 'Mapbox') {
153
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
154
-		else $MapBoxId = $_COOKIE['MapTypeId'];
155
-?>
184
+		if ($_COOKIE['MapTypeId'] == 'default') {
185
+			$MapBoxId = $globalMapboxId;
186
+		} else {
187
+			$MapBoxId = $_COOKIE['MapTypeId'];
188
+		}
189
+		?>
156 190
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
157 191
 	    maxZoom: 18,
158
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
192
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
193
+	print 'false';
194
+} else {
195
+	print 'true';
196
+}
197
+?>,
159 198
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
160 199
 	      '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
161 200
 	      'Imagery © <a href="http://mapbox.com">Mapbox</a>',
@@ -167,7 +206,12 @@  discard block
 block discarded – undo
167 206
 ?>
168 207
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
169 208
 	    maxZoom: 18,
170
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
209
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
210
+	print 'false';
211
+} else {
212
+	print 'true';
213
+}
214
+?>,
171 215
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
172 216
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
173 217
 	}).addTo(map);
@@ -213,20 +257,26 @@  discard block
 block discarded – undo
213 257
 	map.addLayer(yandexLayer);
214 258
 <?php
215 259
 	} elseif ($MapType == 'Bing-Aerial') {
216
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
217
-?>
260
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
261
+			setcookie('MapType','OpenStreetMap');
262
+		}
263
+		?>
218 264
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
219 265
 	map.addLayer(bingLayer);
220 266
 <?php
221 267
 	} elseif ($MapType == 'Bing-Hybrid') {
222
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
223
-?>
268
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
269
+			setcookie('MapType','OpenStreetMap');
270
+		}
271
+		?>
224 272
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
225 273
 	map.addLayer(bingLayer);
226 274
 <?php
227 275
 	} elseif ($MapType == 'Bing-Road') {
228
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
229
-?>
276
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
277
+			setcookie('MapType','OpenStreetMap');
278
+		}
279
+		?>
230 280
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
231 281
 	map.addLayer(bingLayer);
232 282
 <?php
@@ -249,9 +299,24 @@  discard block
 block discarded – undo
249 299
 		$customid = $MapType;
250 300
 ?>
251 301
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
252
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
253
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
254
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
302
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
303
+	print $globalMapCustomLayer[$customid]['maxZoom'];
304
+} else {
305
+	print '18';
306
+}
307
+?>,
308
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
309
+	print $globalMapCustomLayer[$customid]['minZoom'];
310
+} else {
311
+	print '0';
312
+}
313
+?>,
314
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
315
+	print 'false';
316
+} else {
317
+	print 'true';
318
+}
319
+?>,
255 320
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
256 321
 	}).addTo(map);
257 322
 
@@ -285,7 +350,12 @@  discard block
 block discarded – undo
285 350
 		}
286 351
 	} elseif ($globalBounding == 'circle') {
287 352
 ?>
288
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
353
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
354
+	print $globalBoundingCircleSize;
355
+} else {
356
+	print '70000';
357
+}
358
+?>,{
289 359
 	    color: '#92C7D1',
290 360
 	    fillColor: '#92C7D1',
291 361
 	    fillOpacity: 0.3,
@@ -382,7 +452,12 @@  discard block
 block discarded – undo
382 452
 		//}
383 453
 	});
384 454
 update_locationsLayer();
385
-setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
455
+setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) {
456
+	print $globalMapRefresh*1000*2;
457
+} else {
458
+	print '60000';
459
+}
460
+?>);
386 461
 
387 462
 <?php
388 463
     // Add support for custom json via $globalMapJson
Please login to merge, or discard this patch.
require/class.Elevation.php 3 patches
Doc Comments   +11 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,6 +52,10 @@  discard block
 block discarded – undo
52 52
 		$this->openedFiles = [];
53 53
 	}
54 54
 
55
+	/**
56
+	 * @param double $row
57
+	 * @param double $column
58
+	 */
55 59
 	private function getElevationAtPosition($fileName, $row, $column) {
56 60
 		if (!array_key_exists($fileName, $this->openedFiles)) {
57 61
 			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
@@ -85,7 +89,7 @@  discard block
 block discarded – undo
85 89
 	 * @param float $lon
86 90
 	 * @param null  $fName
87 91
 	 *
88
-	 * @return mixed
92
+	 * @return double
89 93
 	 * @throws \Exception
90 94
 	 */
91 95
 	public function getElevation($lat, $lon, &$fName = null) {
@@ -142,6 +146,9 @@  discard block
 block discarded – undo
142 146
 		return $zN;
143 147
 	}
144 148
 
149
+	/**
150
+	 * @param integer $numPrefix
151
+	 */
145 152
 	private function getDeg($deg, $numPrefix) {
146 153
 		$deg = abs($deg);
147 154
 		$d   = floor($deg);     // round degrees
@@ -156,6 +163,9 @@  discard block
 block discarded – undo
156 163
 		return $d;
157 164
 	}
158 165
 
166
+	/**
167
+	 * @param double $deg
168
+	 */
159 169
 	private function getSec($deg) {
160 170
 		$deg = abs($deg);
161 171
 		$sec = round($deg * 3600, 4);
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@  discard block
 block discarded – undo
28 28
 	private $openedFiles = [];
29 29
 
30 30
 	public function __construct($htgFilesDestination = '', $resolution = 3) {
31
-		if ($htgFilesDestination == '') $htgFilesDestination = dirname(__FILE__).'/../data/';
31
+		if ($htgFilesDestination == '') {
32
+			$htgFilesDestination = dirname(__FILE__).'/../data/';
33
+		}
32 34
 		$this->htgFilesDestination = $htgFilesDestination;
33 35
 		$this->resolution          = $resolution;
34 36
 		switch ($resolution) {
@@ -171,16 +173,26 @@  discard block
 block discarded – undo
171 173
 		$fileName  = "N{$N}E{$E}.hgt";
172 174
 		if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
173 175
 			$Common = new Common();
174
-			if ($debug) echo 'Downloading '.$fileName.'.gz ...';
176
+			if ($debug) {
177
+				echo 'Downloading '.$fileName.'.gz ...';
178
+			}
175 179
 			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
176 180
 			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) {
177
-				if ($debug) echo "File '{$fileName}.gz' not exists.";
181
+				if ($debug) {
182
+					echo "File '{$fileName}.gz' not exists.";
183
+				}
178 184
 				return false;
179 185
 			}
180
-			if ($debug) echo 'Done'."\n";
181
-			if ($debug) echo 'Decompress '.$fileName.' ....';
186
+			if ($debug) {
187
+				echo 'Done'."\n";
188
+			}
189
+			if ($debug) {
190
+				echo 'Decompress '.$fileName.' ....';
191
+			}
182 192
 			$Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName);
183
-			if ($debug) echo 'Done'."\n";
193
+			if ($debug) {
194
+				echo 'Done'."\n";
195
+			}
184 196
 			unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
185 197
 		}
186 198
 		return true;
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			default:
42 42
 				throw new \Exception("bad resolution can be only one of 1,3");
43 43
 		}
44
-		register_shutdown_function(function () {
44
+		register_shutdown_function(function() {
45 45
 			$this->closeAllFiles();
46 46
 		});
47 47
 	}
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 
56 56
 	private function getElevationAtPosition($fileName, $row, $column) {
57 57
 		if (!array_key_exists($fileName, $this->openedFiles)) {
58
-			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
58
+			if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) {
59 59
 				throw new \Exception("File '{$fileName}' not exists.");
60 60
 			}
61
-			$file = fopen($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName, "r");
61
+			$file = fopen($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName, "r");
62 62
 			if ($file === false) {
63 63
 				throw new \Exception("Cant open file '{$fileName}' for reading.");
64 64
 			}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			throw new \Exception("Not implemented yet");
73 73
 		}
74 74
 		$aRow     = $this->measPerDeg - $row;
75
-		$position = ($this->measPerDeg * ($aRow - 1)) + $column;
75
+		$position = ($this->measPerDeg*($aRow - 1)) + $column;
76 76
 		$position *= 2;
77 77
 		fseek($file, $position);
78 78
 		$short  = fread($file, 2);
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 		$latSec = $this->getSec($lat);
101 101
 		$lonSec = $this->getSec($lon);
102 102
 
103
-		$Xn = round($latSec / $this->resolution, 3);
104
-		$Yn = round($lonSec / $this->resolution, 3);
103
+		$Xn = round($latSec/$this->resolution, 3);
104
+		$Yn = round($lonSec/$this->resolution, 3);
105 105
 
106 106
 		$a1 = round($Xn);
107 107
 		$a2 = round($Yn);
@@ -133,55 +133,55 @@  discard block
 block discarded – undo
133 133
 		$b3 = $this->getElevationAtPosition($fName, $b1, $b2);
134 134
 		$c3 = $this->getElevationAtPosition($fName, $c1, $c2);
135 135
 
136
-		$n1 = ($c2 - $a2) * ($b3 - $a3) - ($c3 - $a3) * ($b2 - $a2);
137
-		$n2 = ($c3 - $a3) * ($b1 - $a1) - ($c1 - $a1) * ($b3 - $a3);
138
-		$n3 = ($c1 - $a1) * ($b2 - $a2) - ($c2 - $a2) * ($b1 - $a1);
136
+		$n1 = ($c2 - $a2)*($b3 - $a3) - ($c3 - $a3)*($b2 - $a2);
137
+		$n2 = ($c3 - $a3)*($b1 - $a1) - ($c1 - $a1)*($b3 - $a3);
138
+		$n3 = ($c1 - $a1)*($b2 - $a2) - ($c2 - $a2)*($b1 - $a1);
139 139
 
140
-		$d  = -$n1 * $a1 - $n2 * $a2 - $n3 * $a3;
141
-		$zN = (-$n1 * $Xn - $n2 * $Yn - $d) / $n3;
140
+		$d  = -$n1*$a1 - $n2*$a2 - $n3*$a3;
141
+		$zN = (-$n1*$Xn - $n2*$Yn - $d)/$n3;
142 142
 
143 143
 		return $zN;
144 144
 	}
145 145
 
146 146
 	private function getDeg($deg, $numPrefix) {
147 147
 		$deg = abs($deg);
148
-		$d   = floor($deg);     // round degrees
148
+		$d   = floor($deg); // round degrees
149 149
 		if ($numPrefix >= 3) {
150 150
 			if ($d < 100) {
151
-				$d = '0' . $d;
151
+				$d = '0'.$d;
152 152
 			}
153 153
 		} // pad with leading zeros
154 154
 		if ($d < 10) {
155
-			$d = '0' . $d;
155
+			$d = '0'.$d;
156 156
 		}
157 157
 		return $d;
158 158
 	}
159 159
 
160 160
 	private function getSec($deg) {
161 161
 		$deg = abs($deg);
162
-		$sec = round($deg * 3600, 4);
163
-		$m   = fmod(floor($sec / 60), 60);
162
+		$sec = round($deg*3600, 4);
163
+		$m   = fmod(floor($sec/60), 60);
164 164
 		$s   = round(fmod($sec, 60), 4);
165
-		return ($m * 60) + $s;
165
+		return ($m*60) + $s;
166 166
 	}
167 167
 
168
-	public function download($lat,$lon, $debug = false) {
168
+	public function download($lat, $lon, $debug = false) {
169 169
 		$N      = $this->getDeg($lat, 2);
170 170
 		$E      = $this->getDeg($lon, 3);
171
-		$fileName  = "N{$N}E{$E}.hgt";
172
-		if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
171
+		$fileName = "N{$N}E{$E}.hgt";
172
+		if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) {
173 173
 			$Common = new Common();
174 174
 			if ($debug) echo 'Downloading '.$fileName.'.gz ...';
175
-			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
176
-			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) {
175
+			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz');
176
+			if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz')) {
177 177
 				if ($debug) echo "File '{$fileName}.gz' not exists.";
178 178
 				return false;
179 179
 			}
180 180
 			if ($debug) echo 'Done'."\n";
181 181
 			if ($debug) echo 'Decompress '.$fileName.' ....';
182
-			$Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName);
182
+			$Common->gunzip($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName);
183 183
 			if ($debug) echo 'Done'."\n";
184
-			unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
184
+			unlink($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz');
185 185
 		}
186 186
 		return true;
187 187
 	}
@@ -194,22 +194,22 @@  discard block
 block discarded – undo
194 194
 		try {
195 195
 			$sth = $db->prepare($query);
196 196
 			$sth->execute($query_values);
197
-		} catch(PDOException $e) {
197
+		} catch (PDOException $e) {
198 198
 			return "error : ".$e->getMessage();
199 199
 		}
200 200
 		while ($data = $sth->fetch(PDO::FETCH_ASSOC)) {
201
-			$this->download($data['latitude'],$data['longitude'],true);
201
+			$this->download($data['latitude'], $data['longitude'], true);
202 202
 		}
203 203
 		$query = 'SELECT latitude, longitude FROM tracker_output WHERE latitude <> 0 AND longitude <> 0 ORDER BY date DESC LIMIT 10';
204 204
 		$query_values = array();
205 205
 		try {
206 206
 			$sth = $db->prepare($query);
207 207
 			$sth->execute($query_values);
208
-		} catch(PDOException $e) {
208
+		} catch (PDOException $e) {
209 209
 			return "error : ".$e->getMessage();
210 210
 		}
211 211
 		while ($data = $sth->fetch(PDO::FETCH_ASSOC)) {
212
-			$this->download($data['latitude'],$data['longitude'],true);
212
+			$this->download($data['latitude'], $data['longitude'], true);
213 213
 		}
214 214
 	}
215 215
 }
Please login to merge, or discard this patch.
aircraft-data.php 2 patches
Braces   +51 added lines, -20 removed lines patch added patch discarded remove patch
@@ -57,7 +57,9 @@  discard block
 block discarded – undo
57 57
 {
58 58
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
59 59
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
60
-	} else $image = $spotter_item['image_thumbnail'];
60
+	} else {
61
+		$image = $spotter_item['image_thumbnail'];
62
+	}
61 63
 
62 64
 }
63 65
 /* else {
@@ -70,8 +72,12 @@  discard block
 block discarded – undo
70 72
 }
71 73
 print '<div class="right">';
72 74
 print '<div class="callsign-details">';
73
-if ($spotter_item['ident'] != 'Not Available') print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
74
-if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
75
+if ($spotter_item['ident'] != 'Not Available') {
76
+	print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
77
+}
78
+if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') {
79
+	print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
80
+}
75 81
 print '</div>';
76 82
 if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') {
77 83
 	print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
@@ -103,10 +109,16 @@  discard block
 block discarded – undo
103 109
 print '</div>';
104 110
 print '<div id="aircraft">';
105 111
 print '<span>'._("Aircraft").'</span>';
106
-if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
107
-if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
108
-elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
109
-else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
112
+if (isset($spotter_item['aircraft_wiki'])) {
113
+	print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
114
+}
115
+if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') {
116
+	print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
117
+} elseif (isset($spotter_item['aircraft_type'])) {
118
+	print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
119
+} else {
120
+	print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
121
+}
110 122
 print '</div>';
111 123
 print '<div id ="altitude"><span>'._("Altitude").'</span>';
112 124
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
@@ -117,12 +129,18 @@  discard block
 block discarded – undo
117 129
 }
118 130
 
119 131
 if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
120
-	if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
121
-	else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
122
-} else {
123
-	if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
124
-	else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
125
-}
132
+	if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
133
+		print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
134
+	} else {
135
+		print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
136
+	}
137
+	} else {
138
+	if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
139
+		print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
140
+	} else {
141
+		print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
142
+	}
143
+	}
126 144
 
127 145
 if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*30.48) {
128 146
 	print '<br>';
@@ -136,7 +154,9 @@  discard block
 block discarded – undo
136 154
 }
137 155
 
138 156
 print '</div>';
139
-if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
157
+if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') {
158
+	print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
159
+}
140 160
 print '<div id="speed"><span>'._("Speed").'</span>';
141 161
 if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
142 162
 	print round($spotter_item['ground_speed']*1.15078).' mph';
@@ -150,8 +170,11 @@  discard block
 block discarded – undo
150 170
 print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>';
151 171
 if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') {
152 172
 	print '<div id="pilot"><span>'._("Pilot").'</span>';
153
-	if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
154
-	else print $spotter_item['pilot_name'];
173
+	if (isset($spotter_item['pilot_id'])) {
174
+		print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
175
+	} else {
176
+		print $spotter_item['pilot_name'];
177
+	}
155 178
 	print '</div>';
156 179
 }
157 180
 
@@ -179,10 +202,18 @@  discard block
 block discarded – undo
179 202
 print '</div>';
180 203
 print '</div>';
181 204
 
182
-if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
183
-if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
184
-if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
185
-if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
205
+if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') {
206
+	print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
207
+}
208
+if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') {
209
+	print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
210
+}
211
+if (isset($spotter_item['acars']['message'])) {
212
+	print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
213
+}
214
+if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) {
215
+	print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
216
+}
186 217
 print '</div>';
187 218
 ?>
188 219
 </div>
189 220
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 
12 12
 $from_archive = false;
13 13
 if (isset($_GET['ident'])) {
14
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
15 15
 	if (isset($_GET['currenttime'])) {
16
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
16
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
17 17
 		$currenttime = round($currenttime/1000);
18
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime);
18
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime);
19 19
 		if (empty($spotter_array)) {
20 20
 			$from_archive = true;
21
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime);
21
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime);
22 22
 		}
23 23
 	} else {
24 24
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident);
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	}
30 30
 }
31 31
 if (isset($_GET['flightaware_id'])) {
32
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
32
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
33 33
 	if (isset($_GET['currenttime'])) {
34
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
34
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
35 35
 		$currenttime = round($currenttime/1000);
36
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime);
36
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime);
37 37
 		if (empty($spotter_array)) {
38 38
 			$from_archive = true;
39 39
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
40
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime);
40
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime);
41 41
 		}
42 42
 	} else {
43 43
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
57 57
 {
58 58
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
59
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
59
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
60 60
 	} else $image = $spotter_item['image_thumbnail'];
61 61
 
62 62
 }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
78 78
 	if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
79 79
 		if ($spotter_item['departure_airport_time'] > 2460) {
80
-			print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>';
80
+			print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>';
81 81
 		} else {
82 82
 			print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>';
83 83
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country'];
87 87
 	if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
88 88
 		if ($spotter_item['arrival_airport_time'] > 2460) {
89
-			print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>';
89
+			print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>';
90 90
 		} else {
91 91
 			print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>';
92 92
 		}
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 print '<div id ="altitude"><span>'._("Altitude").'</span>';
112 112
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
113 113
 	try {
114
-		$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
115
-	} catch(Exception $e) {
114
+		$groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']);
115
+	} catch (Exception $e) {
116 116
 		// If catched not exist
117 117
 	}
118 118
 }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
184 184
 if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
185
-if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
185
+if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>';
186 186
 if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
187 187
 print '</div>';
188 188
 ?>
Please login to merge, or discard this patch.
require/class.GeoidHeight.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -91,6 +91,10 @@
 block discarded – undo
91 91
 		$this->rlatres = (($this->height - 1) / 180.0);
92 92
 	}
93 93
 
94
+	/**
95
+	 * @param integer $ix
96
+	 * @param integer $iy
97
+	 */
94 98
 	private function _rawval($ix,$iy) {
95 99
 		if (($iy < 0)) {
96 100
 			$iy = -$iy;
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 * Translated to PHP of GeographicLib/src/Geoid.cpp
12 12
 * by Ycarus <[email protected]> in 2017
13 13
 */
14
-class GeoidHeight  {
14
+class GeoidHeight {
15 15
 	private $c0 = 240;
16 16
 	private $c3 = [[9, -18, -88, 0, 96, 90, 0, 0, -60, -20], [-9, 18, 8, 0, -96, 30, 0, 0, 60, -20], [9, -88, -18, 90, 96, 0, -20, -60, 0, 0], [186, -42, -42, -150, -96, -150, 60, 60, 60, 60], [54, 162, -78, 30, -24, -90, -60, 60, -60, 60], [-9, -32, 18, 30, 24, 0, 20, -60, 0, 0], [-9, 8, 18, 30, -96, 0, -20, 60, 0, 0], [54, -78, 162, -90, -24, 30, 60, -60, 60, -60], [-54, 78, 78, 90, 144, 90, -60, -60, -60, -60], [9, -8, -18, -30, -24, 0, 20, 60, 0, 0], [-9, 18, -32, 0, 24, 30, 0, 0, -60, 20], [9, -18, -8, 0, -24, -30, 0, 0, 60, 20]];
17 17
 	private $c0n = 372;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	private $v10 = null;
35 35
 	private $v11 = null;
36 36
 
37
-	public function __construct($name='') {
37
+	public function __construct($name = '') {
38 38
 		global $globalGeoidSource;
39 39
 		//if ($name == '') $name = dirname(__FILE__).'/../install/tmp/egm2008-1.pgm';
40 40
 		if ($name == '') {
@@ -42,35 +42,35 @@  discard block
 block discarded – undo
42 42
 			else $name = dirname(__FILE__).'/../data/egm96-15.pgm';
43 43
 		}
44 44
 
45
-		$f = @fopen($name,"r");
45
+		$f = @fopen($name, "r");
46 46
 		if ($f === FALSE) {
47 47
 			throw new Exception("Can't open ".$name);
48 48
 		}
49
-		$line = fgets($f,4096);
49
+		$line = fgets($f, 4096);
50 50
 		if (trim($line) != 'P5') {
51 51
 			throw new Exception('No PGM header');
52 52
 		}
53 53
 		$headerlen = strlen($line);
54 54
 		while (true) {
55
-			$line = fgets($f,4096);
55
+			$line = fgets($f, 4096);
56 56
 			if ((strlen($line) == 0)) {
57 57
 				throw new Exception('EOF before end of file header');
58 58
 			}
59 59
 			$headerlen += strlen($line);
60
-			if (strpos($line,'# Offset ') !== FALSE) {
60
+			if (strpos($line, '# Offset ') !== FALSE) {
61 61
 				$this->offset = substr($line, 9);
62
-			} else if (strpos($line,'# Scale ') !== FALSE) {
62
+			} else if (strpos($line, '# Scale ') !== FALSE) {
63 63
 				$this->scale = substr($line, 8);
64
-			} else if ((strpos($line,'#') === FALSE)) {
65
-				list($this->width, $this->height) = preg_split('/\s+/',$line);
64
+			} else if ((strpos($line, '#') === FALSE)) {
65
+				list($this->width, $this->height) = preg_split('/\s+/', $line);
66 66
 				break;
67 67
 			}
68 68
 		}
69
-		$line = fgets($f,4096);
69
+		$line = fgets($f, 4096);
70 70
 		$headerlen += strlen($line);
71
-		$levels = (int)$line;
72
-		$this->width = (int)$this->width;
73
-		$this->height = (int)$this->height;
71
+		$levels = (int) $line;
72
+		$this->width = (int) $this->width;
73
+		$this->height = (int) $this->height;
74 74
 		if (($levels != 65535)) {
75 75
 			throw new Exception('PGM file must have 65535 gray levels ('.$levels.')');
76 76
 		}
@@ -85,42 +85,42 @@  discard block
 block discarded – undo
85 85
 		}
86 86
 
87 87
 		$fullsize = filesize($name);
88
-		if ((($fullsize - $headerlen) != (($this->width * $this->height) * 2))) {
88
+		if ((($fullsize - $headerlen) != (($this->width*$this->height)*2))) {
89 89
 			throw new Exception('File has the wrong length');
90 90
 		}
91 91
 
92 92
 		$this->headerlen = $headerlen;
93
-		$this->raw= $f;
94
-		$this->rlonres = ($this->width / 360.0);
95
-		$this->rlatres = (($this->height - 1) / 180.0);
93
+		$this->raw = $f;
94
+		$this->rlonres = ($this->width/360.0);
95
+		$this->rlatres = (($this->height - 1)/180.0);
96 96
 	}
97 97
 
98
-	private function _rawval($ix,$iy) {
98
+	private function _rawval($ix, $iy) {
99 99
 		if (($iy < 0)) {
100 100
 			$iy = -$iy;
101
-			$ix += ($this->width / 2);
101
+			$ix += ($this->width/2);
102 102
 		} else if (($iy >= $this->height)) {
103
-			$iy = ((2 * ($this->height - 1)) - $iy);
104
-			$ix += ($this->width / 2);
103
+			$iy = ((2*($this->height - 1)) - $iy);
104
+			$ix += ($this->width/2);
105 105
 		}
106 106
 		if (($ix < 0)) {
107 107
 			$ix += $this->width;
108 108
 		} else if (($ix >= $this->width)) {
109 109
 			$ix -= $this->width;
110 110
 		}
111
-		$k = ((($iy * $this->width) + $ix) * 2) + $this->headerlen;
112
-		fseek($this->raw,$k);
113
-		return unpack('n',fread($this->raw,2))[1];
111
+		$k = ((($iy*$this->width) + $ix)*2) + $this->headerlen;
112
+		fseek($this->raw, $k);
113
+		return unpack('n', fread($this->raw, 2))[1];
114 114
 	}
115 115
 
116
-	public function get($lat,$lon,$cubic=true) {
116
+	public function get($lat, $lon, $cubic = true) {
117 117
 		if (($lon < 0)) {
118 118
 			$lon += 360;
119 119
 		}
120
-		$fy = ((90 - $lat) * $this->rlatres);
121
-		$fx = ($lon * $this->rlonres);
122
-		$iy = (int)$fy;
123
-		$ix = (int)$fx;
120
+		$fy = ((90 - $lat)*$this->rlatres);
121
+		$fx = ($lon*$this->rlonres);
122
+		$iy = (int) $fy;
123
+		$ix = (int) $fx;
124 124
 		$fx -= $ix;
125 125
 		$fy -= $iy;
126 126
 		$t = array();
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 					$c3x = $this->c3;
148 148
 					$c0x = $this->c0;
149 149
 				}
150
-				for ($i = 0; $i < 10;++$i) {
150
+				for ($i = 0; $i < 10; ++$i) {
151 151
 					$t[$i] = 0;
152 152
 					for ($j = 0; $j < 12; ++$j) {
153 153
 						$t[$i] += $v[$j]*$c3x[$j][$i];
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
 			$this->t = $t;
159 159
 		} else $t = $this->t;
160 160
 		if (!($cubic)) {
161
-			$a = (((1 - $fx) * $this->v00) + ($fx * $this->v01));
162
-			$b = (((1 - $fx) * $this->v10) + ($fx * $this->v11));
163
-			$h = (((1 - $fy) * $a) + ($fy * $b));
161
+			$a = (((1 - $fx)*$this->v00) + ($fx*$this->v01));
162
+			$b = (((1 - $fx)*$this->v10) + ($fx*$this->v11));
163
+			$h = (((1 - $fy)*$a) + ($fy*$b));
164 164
 		} else {
165
-			$h = (($t[0] + ($fx * ($t[1] + ($fx * ($t[3] + ($fx * $t[6])))))) + ($fy * (($t[2] + ($fx * ($t[4] + ($fx * $t[7])))) + ($fy * (($t[5] + ($fx * $t[8])) + ($fy * $t[9]))))));
165
+			$h = (($t[0] + ($fx*($t[1] + ($fx*($t[3] + ($fx*$t[6])))))) + ($fy*(($t[2] + ($fx*($t[4] + ($fx*$t[7])))) + ($fy*(($t[5] + ($fx*$t[8])) + ($fy*$t[9]))))));
166 166
 		}
167
-		return ((float)$this->offset + ((float)$this->scale * (float)$h));
167
+		return ((float) $this->offset + ((float) $this->scale*(float) $h));
168 168
 	}
169 169
 }
170 170
 /*
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,8 +38,11 @@  discard block
 block discarded – undo
38 38
 		global $globalGeoidSource;
39 39
 		//if ($name == '') $name = dirname(__FILE__).'/../install/tmp/egm2008-1.pgm';
40 40
 		if ($name == '') {
41
-			if (isset($globalGeoidSource) && $globalGeoidSource != '') $name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm';
42
-			else $name = dirname(__FILE__).'/../data/egm96-15.pgm';
41
+			if (isset($globalGeoidSource) && $globalGeoidSource != '') {
42
+				$name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm';
43
+			} else {
44
+				$name = dirname(__FILE__).'/../data/egm96-15.pgm';
45
+			}
43 46
 		}
44 47
 
45 48
 		$f = @fopen($name,"r");
@@ -156,7 +159,9 @@  discard block
 block discarded – undo
156 159
 				}
157 160
 			}
158 161
 			$this->t = $t;
159
-		} else $t = $this->t;
162
+		} else {
163
+			$t = $this->t;
164
+		}
160 165
 		if (!($cubic)) {
161 166
 			$a = (((1 - $fx) * $this->v00) + ($fx * $this->v01));
162 167
 			$b = (((1 - $fx) * $this->v10) + ($fx * $this->v11));
Please login to merge, or discard this patch.
require/settings.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 $globalLongitudeMin = '1.0'; //the minimum longitude (east)
43 43
 
44 44
 $globalCenterLatitude = '46.38'; //the latitude center of your coverage area
45
-$globalCenterLongitude = '5.29';//the longitude center of your coverage area
45
+$globalCenterLongitude = '5.29'; //the longitude center of your coverage area
46 46
 
47 47
 $globalLiveZoom = '9'; //default zoom on Live Map
48 48
 $globalAirportZoom = '7'; //default zoom to begin to display airports icons
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 $globalACARS = FALSE;
152 152
 $globalACARSHost = '0.0.0.0'; // Local IP to listen
153 153
 $globalACARSPort = '9999';
154
-$globalACARSArchive = array('10','80','81','82','3F'); // labels of messages to archive
154
+$globalACARSArchive = array('10', '80', '81', '82', '3F'); // labels of messages to archive
155 155
 $globalACARSArchiveKeepMonths = '0';
156 156
 
157 157
 //APRS configuration (for glidernet)
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 //Check by aircraft ICAO if image is not found by registration
249 249
 $globalAircraftImageCheckICAO = TRUE;
250 250
 //Sources for Aircraft image
251
-$globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters','customsources');
251
+$globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters', 'customsources');
252 252
 // Custom source configuration {registration} will be replaced by aircraft registration (exif get copyright from exif data for each pic)
253 253
 // example of config : $globalAircraftImageCustomSources = array('thumbnail' => 'http://pics.myurl.com/thumbnail/{registration}.jpg','original' => 'http://myurl/original/{registration}.jpg','source_website' => 'https://www.myurl.com', 'source' => 'customsite', 'copyright' => 'myself','exif' => true);
254 254
 // ************************
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 //Retrieve Image from externals sources
258 258
 $globalMarineImageFetch = TRUE;
259 259
 //Sources for Marine image
260
-$globalMarineImageSources = array('wikimedia','flickr','deviantart','bing','customsources');
260
+$globalMarineImageSources = array('wikimedia', 'flickr', 'deviantart', 'bing', 'customsources');
261 261
 // Custom source configuration {mmsi} will be replaced by vessel mmsi, {name} by it's name (exif get copyright from exif data for each pic)
262 262
 // example of config : $globalMarineImageCustomSources = array('thumbnail' => 'http://pics.myurl.com/thumbnail/{name}.jpg','original' => 'http://myurl/original/{name}.jpg','source_website' => 'https://www.myurl.com', 'source' => 'customsite', 'copyright' => 'myself','exif' => true);
263 263
 // ************************
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 //Retrieve schedules from externals sources (set to FALSE for IVAO or if $globalFork = FALSE)
266 266
 $globalSchedulesFetch = TRUE;
267 267
 //Sources for airline schedule if not official airline site
268
-$globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
268
+$globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
269 269
 
270 270
 //Retrieve translation from external sources (set to FALSE for IVAO)
271 271
 $globalTranslationFetch = TRUE;
Please login to merge, or discard this patch.
import/callback.php 2 patches
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,15 +27,21 @@  discard block
 block discarded – undo
27 27
 		}
28 28
 	}
29 29
 }
30
-if ($authorize === false) die;
30
+if ($authorize === false) {
31
+	die;
32
+}
31 33
 
32
-if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
34
+if (isset($globalTracker) && $globalTracker) {
35
+	require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
36
+}
33 37
 if (isset($globalMarine) && $globalMarine) {
34 38
 	require_once(dirname(__FILE__).'/../require/class.AIS.php');
35 39
 	require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
36 40
 }
37 41
 
38
-if (!isset($globalDebug)) $globalDebug = FALSE;
42
+if (!isset($globalDebug)) {
43
+	$globalDebug = FALSE;
44
+}
39 45
 
40 46
 // Check if schema is at latest version
41 47
 $Connection = new Connection();
@@ -45,10 +51,16 @@  discard block
 block discarded – undo
45 51
 }
46 52
 
47 53
 if (isset($globalServer) && $globalServer) {
48
-	if ($globalDebug) echo "Using Server Mode\n";
54
+	if ($globalDebug) {
55
+		echo "Using Server Mode\n";
56
+	}
49 57
 	$SI=new SpotterServer();
50
-} else $SI=new SpotterImport($Connection->db);
51
-if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
58
+} else {
59
+	$SI=new SpotterImport($Connection->db);
60
+}
61
+if (isset($globalTracker) && $globalTracker) {
62
+	$TI = new TrackerImport($Connection->db);
63
+}
52 64
 if (isset($globalMarine) && $globalMarine) {
53 65
 	$AIS = new AIS();
54 66
 	$MI = new MarineImport($Connection->db);
@@ -57,7 +69,9 @@  discard block
 block discarded – undo
57 69
 date_default_timezone_set('UTC');
58 70
 
59 71
 $buffer = '';
60
-if (isset($_POST)) $buffer = $_POST;
72
+if (isset($_POST)) {
73
+	$buffer = $_POST;
74
+}
61 75
 $data = array();
62 76
 if (isset($buffer['type_event']) && isset($buffer['lat']) && isset($buffer['lon'])) {
63 77
 	$data['ident'] = $buffer['device_id'];
@@ -68,15 +82,27 @@  discard block
 block discarded – undo
68 82
 	//$data['heading'] = $buffer['cap']; // Only N/S/E/W
69 83
 	$data['datetime'] = date('Y-m-d H:i:s',$buffer['timestamp']);
70 84
 	$data['comment'] = '';
71
-	if (isset($buffer['battery']) && $buffer['battery'] != '') $data['comment'] .= 'Battery: '.$buffer['battery'].'% ';
85
+	if (isset($buffer['battery']) && $buffer['battery'] != '') {
86
+		$data['comment'] .= 'Battery: '.$buffer['battery'].'% ';
87
+	}
72 88
 	//if (isset($buffer['snr']) && $buffer['snr'] != '') $data['comment'] .= 'SNR: '.$buffer['snr'].' ';
73
-	if (isset($buffer['temp']) && $buffer['temp'] != '') $data['comment'] .= 'Temperature: '.$buffer['temp'].'°C ';
74
-	if (isset($buffer['press']) && $buffer['press'] != '') $data['comment'] .= 'Pressure: '.$buffer['press'].'hPa ';
89
+	if (isset($buffer['temp']) && $buffer['temp'] != '') {
90
+		$data['comment'] .= 'Temperature: '.$buffer['temp'].'°C ';
91
+	}
92
+	if (isset($buffer['press']) && $buffer['press'] != '') {
93
+		$data['comment'] .= 'Pressure: '.$buffer['press'].'hPa ';
94
+	}
75 95
 	$TI->add($data);
76 96
 	unset($data);
77 97
 }
78
-if (isset($SI)) $SI->checkAll();
79
-if (isset($MI)) $MI->checkAll();
80
-if (isset($TI)) $TI->checkAll();
98
+if (isset($SI)) {
99
+	$SI->checkAll();
100
+}
101
+if (isset($MI)) {
102
+	$MI->checkAll();
103
+}
104
+if (isset($TI)) {
105
+	$TI->checkAll();
106
+}
81 107
 
82 108
 ?>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/../require/class.Source.php');
10 10
 require_once(dirname(__FILE__).'/../require/class.Connection.php');
11 11
 require_once(dirname(__FILE__).'/../require/class.Common.php');
12
-$Common=new Common();
12
+$Common = new Common();
13 13
 $authorize = false;
14 14
 $params = array();
15 15
 $userip = $Common->getUserIP();
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 			$authorize = true;
21 21
 			break;
22 22
 		}
23
-		if ($userip != '' && isset($cb['host']) && in_array($userip,explode(',',$cb['host']))) {
23
+		if ($userip != '' && isset($cb['host']) && in_array($userip, explode(',', $cb['host']))) {
24 24
 			$params = $globalSources[$key];
25 25
 			$authorize = true;
26 26
 			break;
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 
47 47
 if (isset($globalServer) && $globalServer) {
48 48
 	if ($globalDebug) echo "Using Server Mode\n";
49
-	$SI=new SpotterServer();
50
-} else $SI=new SpotterImport($Connection->db);
49
+	$SI = new SpotterServer();
50
+} else $SI = new SpotterImport($Connection->db);
51 51
 if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
52 52
 if (isset($globalMarine) && $globalMarine) {
53 53
 	$AIS = new AIS();
54 54
 	$MI = new MarineImport($Connection->db);
55 55
 }
56
-$Source=new Source($Connection->db);
56
+$Source = new Source($Connection->db);
57 57
 date_default_timezone_set('UTC');
58 58
 
59 59
 $buffer = '';
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	$data['altitude'] = round($buffer['altitude']*3.28084);
67 67
 	$data['speed'] = $buffer['speed'];
68 68
 	//$data['heading'] = $buffer['cap']; // Only N/S/E/W
69
-	$data['datetime'] = date('Y-m-d H:i:s',$buffer['timestamp']);
69
+	$data['datetime'] = date('Y-m-d H:i:s', $buffer['timestamp']);
70 70
 	$data['comment'] = '';
71 71
 	if (isset($buffer['battery']) && $buffer['battery'] != '') $data['comment'] .= 'Battery: '.$buffer['battery'].'% ';
72 72
 	//if (isset($buffer['snr']) && $buffer['snr'] != '') $data['comment'] .= 'SNR: '.$buffer['snr'].' ';
Please login to merge, or discard this patch.
require/class.APRS.php 4 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -165,6 +165,10 @@  discard block
 block discarded – undo
165 165
 	'\~' => 'TNC Stream SW');
166 166
 	
167 167
 
168
+    /**
169
+     * @param integer $n
170
+     * @param integer $s
171
+     */
168 172
     private function urshift($n, $s) {
169 173
 	return ($n >= 0) ? ($n >> $s) :
170 174
 	    (($n & 0x7fffffff) >> $s) | 
@@ -565,6 +569,9 @@  discard block
 block discarded – undo
565 569
 	socket_close($this->socket);
566 570
     }
567 571
     
572
+    /**
573
+     * @param string $data
574
+     */
568 575
     public function send($data) {
569 576
 	global $globalDebug;
570 577
 	if ($this->connected === false) $this->connect();
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 require_once(dirname(__FILE__).'/class.Common.php');
4 4
 require_once(dirname(__FILE__).'/class.GeoidHeight.php');
5 5
 class aprs {
6
-    private $socket;
7
-    private $connected = false;
6
+	private $socket;
7
+	private $connected = false;
8 8
 
9
-    protected $symbols = array('/!' => 'Police',
9
+	protected $symbols = array('/!' => 'Police',
10 10
 	'/#' => 'DIGI',
11 11
 	'/$' => 'Phone',
12 12
 	'/%' => 'DX Cluster',
@@ -166,13 +166,13 @@  discard block
 block discarded – undo
166 166
 	'\~' => 'TNC Stream SW');
167 167
 	
168 168
 
169
-    private function urshift($n, $s) {
169
+	private function urshift($n, $s) {
170 170
 	return ($n >= 0) ? ($n >> $s) :
171
-	    (($n & 0x7fffffff) >> $s) | 
171
+		(($n & 0x7fffffff) >> $s) | 
172 172
 		(0x40000000 >> ($s - 1));
173
-    }
173
+	}
174 174
 
175
-    public function parse($input) {
175
+	public function parse($input) {
176 176
 	global $globalDebug;
177 177
 	$debug = false;
178 178
 	$result = array();
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 	
185 185
 	/* Check that end was found and body has at least one byte. */
186 186
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
187
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
188
-	    return false;
187
+		if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
188
+		return false;
189 189
 	}
190 190
 	
191 191
 	if ($debug) echo 'input : '.$input."\n";
@@ -199,34 +199,34 @@  discard block
 block discarded – undo
199 199
 	/* Parse source, target and path. */
200 200
 	//FLRDF0A52>APRS,qAS,LSTB
201 201
 	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) {
202
-	    $ident = $matches[1];
203
-	    $all_elements = $matches[2];
204
-	    if ($ident == 'AIRCRAFT') {
202
+		$ident = $matches[1];
203
+		$all_elements = $matches[2];
204
+		if ($ident == 'AIRCRAFT') {
205 205
 		$result['format_source'] = 'famaprs';
206 206
 		$result['source_type'] = 'modes';
207
-	    } elseif ($ident == 'MARINE') {
207
+		} elseif ($ident == 'MARINE') {
208 208
 		$result['format_source'] = 'famaprs';
209 209
 		$result['source_type'] = 'ais';
210
-	    } else {
210
+		} else {
211 211
 		if ($debug) echo 'ident : '.$ident."\n";
212 212
 		$result['ident'] = $ident;
213
-	    }
213
+		}
214 214
 	} else {
215
-	    if ($debug) 'No ident'."\n";
216
-	    return false;
215
+		if ($debug) 'No ident'."\n";
216
+		return false;
217 217
 	}
218 218
 	$elements = explode(',',$all_elements);
219 219
 	$source = end($elements);
220 220
 	$result['source'] = $source;
221 221
 	foreach ($elements as $element) {
222
-	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
223
-	        //echo "ok";
224
-	        //if ($element == 'TCPIP*') return false;
225
-	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
222
+		if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
223
+			//echo "ok";
224
+			//if ($element == 'TCPIP*') return false;
225
+		} elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
226 226
 		if ($debug) echo 'element : '.$element."\n";
227 227
 		return false;
228
-	    }
229
-	    /*
228
+		}
229
+		/*
230 230
 	    } elseif (preg_match('/^([0-9A-F]{32})$/',$element)) {
231 231
 		//echo "ok";
232 232
 	    } else {
@@ -253,48 +253,48 @@  discard block
 block discarded – undo
253 253
 	$body_parse = substr($body,1);
254 254
 	//echo 'Body : '.$body."\n";
255 255
 	if (preg_match('/^;(.){9}\*/',$body,$matches)) {
256
-	    $body_parse = substr($body_parse,10);
257
-	    $find = true;
258
-	    //echo $body_parse."\n";
256
+		$body_parse = substr($body_parse,10);
257
+		$find = true;
258
+		//echo $body_parse."\n";
259 259
 	}
260 260
 	if (preg_match('/^`(.*)\//',$body,$matches)) {
261
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
262
-	    $find = true;
263
-	    //echo $body_parse."\n";
261
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
262
+		$find = true;
263
+		//echo $body_parse."\n";
264 264
 	}
265 265
 	if (preg_match("/^'(.*)\//",$body,$matches)) {
266
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
267
-	    $find = true;
268
-	    //echo $body_parse."\n";
266
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
267
+		$find = true;
268
+		//echo $body_parse."\n";
269 269
 	}
270 270
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) {
271
-	    $find = true;
272
-	    //print_r($matches);
273
-	    $timestamp = $matches[0];
274
-	    if ($matches[4] == 'h') {
271
+		$find = true;
272
+		//print_r($matches);
273
+		$timestamp = $matches[0];
274
+		if ($matches[4] == 'h') {
275 275
 		$timestamp = strtotime(date('Ymd').' '.$matches[1].':'.$matches[2].':'.$matches[3]);
276 276
 		//echo 'timestamp : '.$timestamp.' - now : '.time()."\n";
277 277
 		/*
278 278
 		if (time() + 3900 < $timestamp) $timestamp -= 86400;
279 279
 		elseif (time() - 82500 > $timestamp) $timestamp += 86400;
280 280
 		*/
281
-	    } elseif ($matches[4] == 'z' || $matches[4] == '/') {
281
+		} elseif ($matches[4] == 'z' || $matches[4] == '/') {
282 282
 		// This work or not ?
283 283
 		$timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]);
284
-	    }
285
-	    $body_parse = substr($body_parse,7);
286
-	    $result['timestamp'] = $timestamp;
287
-	    //echo date('Ymd H:i:s',$timestamp);
284
+		}
285
+		$body_parse = substr($body_parse,7);
286
+		$result['timestamp'] = $timestamp;
287
+		//echo date('Ymd H:i:s',$timestamp);
288 288
 	}
289 289
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) {
290
-	    $find = true;
291
-	    $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
292
-	    $body_parse = substr($body_parse,8);
293
-	    $result['timestamp'] = $timestamp;
294
-	    //echo date('Ymd H:i:s',$timestamp);
290
+		$find = true;
291
+		$timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
292
+		$body_parse = substr($body_parse,8);
293
+		$result['timestamp'] = $timestamp;
294
+		//echo date('Ymd H:i:s',$timestamp);
295 295
 	}
296 296
 	//if (strlen($body_parse) > 19) {
297
-	    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
+		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)) {
298 298
 		$find = true;
299 299
 		// 4658.70N/00707.78Ez
300 300
 		//print_r(str_split($body_parse));
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		$lon = intval($lon_deg);
314 314
 		if ($lat > 89 || $lon > 179) return false;
315 315
 	    
316
-	    /*
316
+		/*
317 317
 	    $tmp_5b = str_replace('.','',$lat_min);
318 318
 	    if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) {
319 319
 	        print_r($matches);
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 		$result['longitude'] = $longitude;
328 328
 		$body_parse = substr($body_parse,18);
329 329
 		$body_parse_len = strlen($body_parse);
330
-	    }
331
-	    $body_parse_len = strlen($body_parse);
332
-	    if ($body_parse_len > 0) {
330
+		}
331
+		$body_parse_len = strlen($body_parse);
332
+		if ($body_parse_len > 0) {
333 333
 		/*
334 334
 		if (!isset($result['timestamp']) && !isset($result['latitude'])) {
335 335
 			$body_split = str_split($body);
@@ -363,95 +363,95 @@  discard block
 block discarded – undo
363 363
 			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
364 364
 			if ($symbol_code != '_') {
365 365
 			}
366
-		    //$body_parse = substr($body_parse,1);
367
-		    //$body_parse = trim($body_parse);
368
-		    //$body_parse_len = strlen($body_parse);
369
-		    if ($body_parse_len >= 7) {
366
+			//$body_parse = substr($body_parse,1);
367
+			//$body_parse = trim($body_parse);
368
+			//$body_parse_len = strlen($body_parse);
369
+			if ($body_parse_len >= 7) {
370 370
 			
371
-		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
372
-		    	    $course = substr($body_parse,0,3);
373
-		    	    $tmp_s = intval($course);
374
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
375
-		    	    $speed = substr($body_parse,4,3);
376
-		    	    if ($speed != '...') {
377
-		    		//$result['speed'] = round($speed*1.852);
378
-		    		$result['speed'] = intval($speed);
379
-		    	    }
380
-		    	    $body_parse = substr($body_parse,7);
381
-		        }
382
-		        // Check PHGR, PHG, RNG
383
-		    } 
384
-		    /*
371
+				if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
372
+					$course = substr($body_parse,0,3);
373
+					$tmp_s = intval($course);
374
+					if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
375
+					$speed = substr($body_parse,4,3);
376
+					if ($speed != '...') {
377
+					//$result['speed'] = round($speed*1.852);
378
+					$result['speed'] = intval($speed);
379
+					}
380
+					$body_parse = substr($body_parse,7);
381
+				}
382
+				// Check PHGR, PHG, RNG
383
+			} 
384
+			/*
385 385
 		    else if ($body_parse_len > 0) {
386 386
 			$rest = $body_parse;
387 387
 		    }
388 388
 		    */
389
-		    if (strlen($body_parse) > 0) {
390
-		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
391
-		            $altitude = intval($matches[1]);
392
-		            //$result['altitude'] = round($altitude*0.3048);
393
-		            $result['altitude'] = $altitude;
394
-		            //$body_parse = trim(substr($body_parse,strlen($matches[0])));
395
-		            $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
396
-		        }
397
-		    }
389
+			if (strlen($body_parse) > 0) {
390
+				if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
391
+					$altitude = intval($matches[1]);
392
+					//$result['altitude'] = round($altitude*0.3048);
393
+					$result['altitude'] = $altitude;
394
+					//$body_parse = trim(substr($body_parse,strlen($matches[0])));
395
+					$body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
396
+				}
397
+			}
398 398
 		    
399
-		    // Telemetry
400
-		    /*
399
+			// Telemetry
400
+			/*
401 401
 		    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)) {
402 402
 		        // Nothing yet...
403 403
 		    }
404 404
 		    */
405
-		    // DAO
405
+			// DAO
406 406
 		    
407
-		    if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
407
+			if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
408 408
 			    
409
-			    $dao = $matches[1];
410
-			    if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
409
+				$dao = $matches[1];
410
+				if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
411 411
 				$dao_split = str_split($dao);
412
-			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
413
-			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
412
+					$lat_off = (($dao_split[1])-48.0)*0.001/60.0;
413
+					$lon_off = (($dao_split[2])-48.0)*0.001/60.0;
414 414
 			    
415 415
 				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
416 416
 				else $result['latitude'] += $lat_off;
417 417
 				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
418 418
 				else $result['longitude'] += $lon_off;
419
-			    }
419
+				}
420 420
 			    
421
-		            $body_parse = substr($body_parse,6);
422
-		    }
421
+					$body_parse = substr($body_parse,6);
422
+			}
423 423
 		    
424
-		    if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
424
+			if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
425 425
 			$result['ident'] = str_replace('_',' ',$matches[1]);
426
-		    }
427
-		    if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
426
+			}
427
+			if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
428 428
 			$result['squawk'] = $matches[1];
429
-		    }
430
-		    if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
429
+			}
430
+			if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
431 431
 			$result['aircraft_icao'] = $matches[1];
432
-		    }
433
-		    if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
432
+			}
433
+			if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
434 434
 			$result['verticalrate'] = $matches[1];
435
-		    }
436
-		    if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
435
+			}
436
+			if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
437 437
 			$result['typeid'] = $matches[1];
438
-		    }
439
-		    if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
438
+			}
439
+			if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
440 440
 			$result['statusid'] = $matches[1];
441
-		    }
442
-		    if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
441
+			}
442
+			if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
443 443
 			$result['imo'] = $matches[1];
444
-		    }
445
-		    if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
444
+			}
445
+			if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
446 446
 			$result['arrival_date'] = $matches[1];
447
-		    }
448
-		    if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
447
+			}
448
+			if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
449 449
 			$result['arrival_code'] = str_replace('_',' ',$matches[1]);
450
-		    }
451
-		    // OGN comment
450
+			}
451
+			// OGN comment
452 452
 		   // echo "Before OGN : ".$body_parse."\n";
453
-		    //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
454
-		    if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
453
+			//if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
454
+			if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
455 455
 			$id = $matches[1];
456 456
 			//$mode = substr($id,0,2);
457 457
 			$address = substr($id,2);
@@ -481,42 +481,42 @@  discard block
 block discarded – undo
481 481
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
482 482
 			$result['stealth'] = $stealth;
483 483
 			$result['address'] = $address;
484
-		    }
484
+			}
485 485
 		    
486
-		    //Comment
487
-		    $result['comment'] = trim($body_parse);
486
+			//Comment
487
+			$result['comment'] = trim($body_parse);
488 488
 		//} else {
489
-		    // parse weather
490
-		    //$body_parse = substr($body_parse,1);
491
-		    //$body_parse_len = strlen($body_parse);
492
-		    //echo 'weather'."\n";
493
-		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
494
-			    $result['wind_dir'] = intval($matches[1]);
495
-			    $result['wind_speed'] = round(intval($matches[2])*1.60934,1);
496
-			    $result['wind_gust'] = round(intval($matches[3])*1.60934,1);
497
-			    $result['temp'] = round(5/9*((intval($matches[4]))-32),1);
498
-		    	    $body_parse = substr($body_parse,strlen($matches[0])+1);
499
-		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
489
+			// parse weather
490
+			//$body_parse = substr($body_parse,1);
491
+			//$body_parse_len = strlen($body_parse);
492
+			//echo 'weather'."\n";
493
+			if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
494
+				$result['wind_dir'] = intval($matches[1]);
495
+				$result['wind_speed'] = round(intval($matches[2])*1.60934,1);
496
+				$result['wind_gust'] = round(intval($matches[3])*1.60934,1);
497
+				$result['temp'] = round(5/9*((intval($matches[4]))-32),1);
498
+					$body_parse = substr($body_parse,strlen($matches[0])+1);
499
+			} elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
500 500
 			$result['wind_dir'] = intval($matches[1]);
501 501
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
502 502
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
503 503
 			$result['temp'] = round(5/9*(($matches[4])-32),1);
504
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
505
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
504
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
505
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
506 506
 			$result['wind_dir'] = intval($matches[1]);
507 507
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
508 508
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
509
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
510
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
509
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
510
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
511 511
 			$result['wind_dir'] = intval($matches[1]);
512 512
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
513 513
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
514
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
515
-		    }
516
-		    //if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
517
-		    //g012t088r000p000P000h38b10110
518
-		    //g011t086r000p000P000h29b10198
519
-		    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)) {
514
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
515
+			}
516
+			//if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
517
+			//g012t088r000p000P000h38b10110
518
+			//g011t086r000p000P000h29b10198
519
+			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)) {
520 520
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
521 521
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
522 522
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
 			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
525 525
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
526 526
 			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
527
-		        $body_parse = substr($body_parse,strlen($matches[0]));
528
-		    } 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)) {
527
+				$body_parse = substr($body_parse,strlen($matches[0]));
528
+			} 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)) {
529 529
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
530 530
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
531 531
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
@@ -533,8 +533,8 @@  discard block
 block discarded – undo
533 533
 			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
534 534
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
535 535
 			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
536
-		        $body_parse = substr($body_parse,strlen($matches[0]));
537
-		    } 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)) {
536
+				$body_parse = substr($body_parse,strlen($matches[0]));
537
+			} 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)) {
538 538
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
539 539
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
540 540
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
@@ -542,58 +542,58 @@  discard block
 block discarded – undo
542 542
 			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
543 543
 			if ($matches[7] != '...') $result['humidity'] = intval($matches[7]);
544 544
 			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
545
-		        $body_parse = substr($body_parse,strlen($matches[0]));
546
-		    } 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)) {
545
+				$body_parse = substr($body_parse,strlen($matches[0]));
546
+			} 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)) {
547 547
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
548 548
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
549 549
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
550 550
 			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
551 551
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
552 552
 			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
553
-		        $body_parse = substr($body_parse,strlen($matches[0]));
554
-		    } 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)) {
553
+				$body_parse = substr($body_parse,strlen($matches[0]));
554
+			} 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)) {
555 555
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
556 556
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
557 557
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
558 558
 			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
559 559
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
560 560
 			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
561
-		        $body_parse = substr($body_parse,strlen($matches[0]));
562
-		    } 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)) {
561
+				$body_parse = substr($body_parse,strlen($matches[0]));
562
+			} 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)) {
563 563
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
564 564
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
565 565
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
566 566
 			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
567 567
 			if ($matches[5] != '...') $result['humidity'] = intval($matches[5]);
568 568
 			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
569
-		        $body_parse = substr($body_parse,strlen($matches[0]));
570
-		    } 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)) {
569
+				$body_parse = substr($body_parse,strlen($matches[0]));
570
+			} 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)) {
571 571
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
572 572
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
573 573
 			if ($matches[2] != '...') $result['humidity'] = intval($matches[3]);
574 574
 			if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1);
575
-		        $body_parse = substr($body_parse,strlen($matches[0]));
576
-		    } 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)) {
575
+				$body_parse = substr($body_parse,strlen($matches[0]));
576
+			} 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)) {
577 577
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
578 578
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
579 579
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
580 580
 			if ($matches[4] != '...') $result['humidity'] = intval($matches[4]);
581 581
 			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
582
-		        $body_parse = substr($body_parse,strlen($matches[0]));
583
-		    }
584
-		    $result['comment'] = trim($body_parse);
582
+				$body_parse = substr($body_parse,strlen($matches[0]));
583
+			}
584
+			$result['comment'] = trim($body_parse);
585 585
 		}
586 586
 		} else $result['comment'] = trim($body_parse);
587 587
 
588
-	    }
588
+		}
589 589
 	//}
590 590
 	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
591 591
 	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
592 592
 	if ($debug) print_r($result);
593 593
 	return $result;
594
-    }
594
+	}
595 595
     
596
-    public function connect() {
596
+	public function connect() {
597 597
 	global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport;
598 598
 	$aprs_connect = 0;
599 599
 	$aprs_keep = 120;
@@ -617,24 +617,24 @@  discard block
 block discarded – undo
617 617
 		socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1);
618 618
 		while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) {
619 619
 			if (strpos($msgin, "$aprs_ssid verified") !== FALSE) {
620
-			    echo 'APRS user verified !'."\n";
621
-			    $this->connected = true;
622
-			    return true;
623
-			    break;
620
+				echo 'APRS user verified !'."\n";
621
+				$this->connected = true;
622
+				return true;
623
+				break;
624 624
 			}
625 625
 			if (time()-$authstart > 5) {
626
-			    echo 'APRS timeout'."\n";
627
-			    break;
626
+				echo 'APRS timeout'."\n";
627
+				break;
628 628
 			}
629 629
 		}
630 630
 	}
631
-    }
631
+	}
632 632
 
633
-    public function disconnect() {
633
+	public function disconnect() {
634 634
 	socket_close($this->socket);
635
-    }
635
+	}
636 636
     
637
-    public function send($data) {
637
+	public function send($data) {
638 638
 	global $globalDebug;
639 639
 	if ($this->connected === false) $this->connect();
640 640
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 		socket_close($this->socket);
644 644
 		$this->connect();
645 645
 	}
646
-    }
646
+	}
647 647
 }
648 648
 
649 649
 class APRSSpotter extends APRS {
Please login to merge, or discard this patch.
Braces   +307 added lines, -110 removed lines patch added patch discarded remove patch
@@ -184,17 +184,23 @@  discard block
 block discarded – undo
184 184
 	
185 185
 	/* Check that end was found and body has at least one byte. */
186 186
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
187
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
187
+	    if ($globalDebug) {
188
+	    	echo '!!! APRS invalid : '.$input."\n";
189
+	    }
188 190
 	    return false;
189 191
 	}
190 192
 	
191
-	if ($debug) echo 'input : '.$input."\n";
193
+	if ($debug) {
194
+		echo 'input : '.$input."\n";
195
+	}
192 196
 	/* Save header and body. */
193 197
 	$body = substr($input,$splitpos+1,$input_len);
194 198
 	$body_len = strlen($body);
195 199
 	$header = substr($input,0,$splitpos);
196 200
 	//$header_len = strlen($header);
197
-	if ($debug) echo 'header : '.$header."\n";
201
+	if ($debug) {
202
+		echo 'header : '.$header."\n";
203
+	}
198 204
 	
199 205
 	/* Parse source, target and path. */
200 206
 	//FLRDF0A52>APRS,qAS,LSTB
@@ -208,11 +214,15 @@  discard block
 block discarded – undo
208 214
 		$result['format_source'] = 'famaprs';
209 215
 		$result['source_type'] = 'ais';
210 216
 	    } else {
211
-		if ($debug) echo 'ident : '.$ident."\n";
217
+		if ($debug) {
218
+			echo 'ident : '.$ident."\n";
219
+		}
212 220
 		$result['ident'] = $ident;
213 221
 	    }
214 222
 	} else {
215
-	    if ($debug) 'No ident'."\n";
223
+	    if ($debug) {
224
+	    	'No ident'."\n";
225
+	    }
216 226
 	    return false;
217 227
 	}
218 228
 	$elements = explode(',',$all_elements);
@@ -223,7 +233,9 @@  discard block
 block discarded – undo
223 233
 	        //echo "ok";
224 234
 	        //if ($element == 'TCPIP*') return false;
225 235
 	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
226
-		if ($debug) echo 'element : '.$element."\n";
236
+		if ($debug) {
237
+			echo 'element : '.$element."\n";
238
+		}
227 239
 		return false;
228 240
 	    }
229 241
 	    /*
@@ -236,13 +248,17 @@  discard block
 block discarded – undo
236 248
 	}
237 249
 	
238 250
 	$type = substr($body,0,1);
239
-	if ($debug) echo 'type : '.$type."\n";
251
+	if ($debug) {
252
+		echo 'type : '.$type."\n";
253
+	}
240 254
 	if ($type == ';') {
241 255
 		if (isset($result['source_type']) && $result['source_type'] == 'modes') {
242 256
 			$result['address'] = trim(substr($body,1,9));
243 257
 		} elseif (isset($result['source_type']) && $result['source_type'] == 'ais') {
244 258
 			$result['mmsi'] = trim(substr($body,1,9));
245
-		} else $result['ident'] = trim(substr($body,1,9));
259
+		} else {
260
+			$result['ident'] = trim(substr($body,1,9));
261
+		}
246 262
 	} elseif ($type == ',') {
247 263
 		// Invalid data or test data
248 264
 		return false;
@@ -311,7 +327,9 @@  discard block
 block discarded – undo
311 327
 		//$symbol_table = $matches[4];
312 328
 		$lat = intval($lat_deg);
313 329
 		$lon = intval($lon_deg);
314
-		if ($lat > 89 || $lon > 179) return false;
330
+		if ($lat > 89 || $lon > 179) {
331
+			return false;
332
+		}
315 333
 	    
316 334
 	    /*
317 335
 	    $tmp_5b = str_replace('.','',$lat_min);
@@ -321,8 +339,12 @@  discard block
 block discarded – undo
321 339
 	    */
322 340
 		$latitude = $lat + floatval($lat_min)/60;
323 341
 		$longitude = $lon + floatval($lon_min)/60;
324
-		if ($sind == 'S') $latitude = 0-$latitude;
325
-		if ($wind == 'W') $longitude = 0-$longitude;
342
+		if ($sind == 'S') {
343
+			$latitude = 0-$latitude;
344
+		}
345
+		if ($wind == 'W') {
346
+			$longitude = 0-$longitude;
347
+		}
326 348
 		$result['latitude'] = $latitude;
327 349
 		$result['longitude'] = $longitude;
328 350
 		$body_parse = substr($body_parse,18);
@@ -350,8 +372,11 @@  discard block
 block discarded – undo
350 372
 			//echo 'find'."\n";
351 373
 			$body_split = str_split($body_parse);
352 374
 			$symbol_code = $body_split[0];
353
-			if (!isset($symbolll) || $symbolll == '/') $symbol_code = '/'.$symbol_code;
354
-			else $symbol_code = '\\'.$symbol_code;
375
+			if (!isset($symbolll) || $symbolll == '/') {
376
+				$symbol_code = '/'.$symbol_code;
377
+			} else {
378
+				$symbol_code = '\\'.$symbol_code;
379
+			}
355 380
 		//'
356 381
 		//}
357 382
 		//echo $body_parse;
@@ -360,7 +385,9 @@  discard block
 block discarded – undo
360 385
 			$body_parse = substr($body_parse,1);
361 386
 			$body_parse_len = strlen($body_parse);
362 387
 			$result['symbol_code'] = $symbol_code;
363
-			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
388
+			if (isset($this->symbols[$symbol_code])) {
389
+				$result['symbol'] = $this->symbols[$symbol_code];
390
+			}
364 391
 			if ($symbol_code != '_') {
365 392
 			}
366 393
 		    //$body_parse = substr($body_parse,1);
@@ -371,7 +398,9 @@  discard block
 block discarded – undo
371 398
 		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
372 399
 		    	    $course = substr($body_parse,0,3);
373 400
 		    	    $tmp_s = intval($course);
374
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
401
+		    	    if ($tmp_s >= 1 && $tmp_s <= 360) {
402
+		    	    	$result['heading'] = intval($course);
403
+		    	    }
375 404
 		    	    $speed = substr($body_parse,4,3);
376 405
 		    	    if ($speed != '...') {
377 406
 		    		//$result['speed'] = round($speed*1.852);
@@ -412,10 +441,16 @@  discard block
 block discarded – undo
412 441
 			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
413 442
 			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
414 443
 			    
415
-				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
416
-				else $result['latitude'] += $lat_off;
417
-				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
418
-				else $result['longitude'] += $lon_off;
444
+				if ($result['latitude'] < 0) {
445
+					$result['latitude'] -= $lat_off;
446
+				} else {
447
+					$result['latitude'] += $lat_off;
448
+				}
449
+				if ($result['longitude'] < 0) {
450
+					$result['longitude'] -= $lon_off;
451
+				} else {
452
+					$result['longitude'] += $lon_off;
453
+				}
419 454
 			    }
420 455
 			    
421 456
 		            $body_parse = substr($body_parse,6);
@@ -457,27 +492,48 @@  discard block
 block discarded – undo
457 492
 			$address = substr($id,2);
458 493
 			//print_r($matches);
459 494
 			$addressType = (intval(substr($id,0,2),16))&3;
460
-			if ($addressType == 0) $result['addresstype'] = "RANDOM";
461
-			elseif ($addressType == 1) $result['addresstype'] = "ICAO";
462
-			elseif ($addressType == 2) $result['addresstype'] = "FLARM";
463
-			elseif ($addressType == 3) $result['addresstype'] = "OGN";
495
+			if ($addressType == 0) {
496
+				$result['addresstype'] = "RANDOM";
497
+			} elseif ($addressType == 1) {
498
+				$result['addresstype'] = "ICAO";
499
+			} elseif ($addressType == 2) {
500
+				$result['addresstype'] = "FLARM";
501
+			} elseif ($addressType == 3) {
502
+				$result['addresstype'] = "OGN";
503
+			}
464 504
 			$aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2);
465 505
 			$result['aircrafttype_code'] = $aircraftType;
466
-			if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN";
467
-			elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER";
468
-			elseif ($aircraftType == 2) $result['aircrafttype'] = "TOW_PLANE";
469
-			elseif ($aircraftType == 3) $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT";
470
-			elseif ($aircraftType == 4) $result['aircrafttype'] = "PARACHUTE";
471
-			elseif ($aircraftType == 5) $result['aircrafttype'] = "DROP_PLANE";
472
-			elseif ($aircraftType == 6) $result['aircrafttype'] = "HANG_GLIDER";
473
-			elseif ($aircraftType == 7) $result['aircrafttype'] = "PARA_GLIDER";
474
-			elseif ($aircraftType == 8) $result['aircrafttype'] = "POWERED_AIRCRAFT";
475
-			elseif ($aircraftType == 9) $result['aircrafttype'] = "JET_AIRCRAFT";
476
-			elseif ($aircraftType == 10) $result['aircrafttype'] = "UFO";
477
-			elseif ($aircraftType == 11) $result['aircrafttype'] = "BALLOON";
478
-			elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP";
479
-			elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV";
480
-			elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT";
506
+			if ($aircraftType == 0) {
507
+				$result['aircrafttype'] = "UNKNOWN";
508
+			} elseif ($aircraftType == 1) {
509
+				$result['aircrafttype'] = "GLIDER";
510
+			} elseif ($aircraftType == 2) {
511
+				$result['aircrafttype'] = "TOW_PLANE";
512
+			} elseif ($aircraftType == 3) {
513
+				$result['aircrafttype'] = "HELICOPTER_ROTORCRAFT";
514
+			} elseif ($aircraftType == 4) {
515
+				$result['aircrafttype'] = "PARACHUTE";
516
+			} elseif ($aircraftType == 5) {
517
+				$result['aircrafttype'] = "DROP_PLANE";
518
+			} elseif ($aircraftType == 6) {
519
+				$result['aircrafttype'] = "HANG_GLIDER";
520
+			} elseif ($aircraftType == 7) {
521
+				$result['aircrafttype'] = "PARA_GLIDER";
522
+			} elseif ($aircraftType == 8) {
523
+				$result['aircrafttype'] = "POWERED_AIRCRAFT";
524
+			} elseif ($aircraftType == 9) {
525
+				$result['aircrafttype'] = "JET_AIRCRAFT";
526
+			} elseif ($aircraftType == 10) {
527
+				$result['aircrafttype'] = "UFO";
528
+			} elseif ($aircraftType == 11) {
529
+				$result['aircrafttype'] = "BALLOON";
530
+			} elseif ($aircraftType == 12) {
531
+				$result['aircrafttype'] = "AIRSHIP";
532
+			} elseif ($aircraftType == 13) {
533
+				$result['aircrafttype'] = "UAV";
534
+			} elseif ($aircraftType == 15) {
535
+				$result['aircrafttype'] = "STATIC_OBJECT";
536
+			}
481 537
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
482 538
 			$result['stealth'] = $stealth;
483 539
 			$result['address'] = $address;
@@ -517,79 +573,183 @@  discard block
 block discarded – undo
517 573
 		    //g012t088r000p000P000h38b10110
518 574
 		    //g011t086r000p000P000h29b10198
519 575
 		    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)) {
520
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
521
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
522
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
523
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
524
-			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
525
-			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
526
-			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
576
+			if ($matches[1] != '...') {
577
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
578
+			}
579
+			if ($matches[2] != '...') {
580
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
581
+			}
582
+			if ($matches[3] != '...') {
583
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
584
+			}
585
+			if ($matches[4] != '...') {
586
+				$result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
587
+			}
588
+			if ($matches[5] != '...') {
589
+				$result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
590
+			}
591
+			if ($matches[6] != '...') {
592
+				$result['humidity'] = intval($matches[6]);
593
+			}
594
+			if ($matches[7] != '...') {
595
+				$result['pressure'] = round((intval($matches[7])/10),1);
596
+			}
527 597
 		        $body_parse = substr($body_parse,strlen($matches[0]));
528 598
 		    } 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)) {
529
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
530
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
531
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
532
-			if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1);
533
-			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
534
-			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
535
-			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
599
+			if ($matches[1] != '...') {
600
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
601
+			}
602
+			if ($matches[2] != '...') {
603
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
604
+			}
605
+			if ($matches[3] != '...') {
606
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
607
+			}
608
+			if ($matches[5] != '...') {
609
+				$result['precipitation'] = round((intval($matches[5])/100)*25.1,1);
610
+			}
611
+			if ($matches[4] != '...') {
612
+				$result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
613
+			}
614
+			if ($matches[6] != '...') {
615
+				$result['humidity'] = intval($matches[6]);
616
+			}
617
+			if ($matches[7] != '...') {
618
+				$result['pressure'] = round((intval($matches[7])/10),1);
619
+			}
536 620
 		        $body_parse = substr($body_parse,strlen($matches[0]));
537 621
 		    } 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)) {
538
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
539
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
540
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
541
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
542
-			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
543
-			if ($matches[7] != '...') $result['humidity'] = intval($matches[7]);
544
-			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
622
+			if ($matches[1] != '...') {
623
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
624
+			}
625
+			if ($matches[2] != '...') {
626
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
627
+			}
628
+			if ($matches[3] != '...') {
629
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
630
+			}
631
+			if ($matches[4] != '...') {
632
+				$result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
633
+			}
634
+			if ($matches[5] != '...') {
635
+				$result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
636
+			}
637
+			if ($matches[7] != '...') {
638
+				$result['humidity'] = intval($matches[7]);
639
+			}
640
+			if ($matches[6] != '...') {
641
+				$result['pressure'] = round((intval($matches[6])/10),1);
642
+			}
545 643
 		        $body_parse = substr($body_parse,strlen($matches[0]));
546 644
 		    } 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)) {
547
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
548
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
549
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
550
-			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
551
-			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
552
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
645
+			if ($matches[1] != '...') {
646
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
647
+			}
648
+			if ($matches[2] != '...') {
649
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
650
+			}
651
+			if ($matches[3] != '...') {
652
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
653
+			}
654
+			if ($matches[4] != '...') {
655
+				$result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
656
+			}
657
+			if ($matches[6] != '...') {
658
+				$result['humidity'] = intval($matches[6]);
659
+			}
660
+			if ($matches[5] != '...') {
661
+				$result['pressure'] = round((intval($matches[5])/10),1);
662
+			}
553 663
 		        $body_parse = substr($body_parse,strlen($matches[0]));
554 664
 		    } 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)) {
555
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
556
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
557
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
558
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
559
-			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
560
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
665
+			if ($matches[1] != '...') {
666
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
667
+			}
668
+			if ($matches[2] != '...') {
669
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
670
+			}
671
+			if ($matches[3] != '...') {
672
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
673
+			}
674
+			if ($matches[4] != '...') {
675
+				$result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
676
+			}
677
+			if ($matches[6] != '...') {
678
+				$result['humidity'] = intval($matches[6]);
679
+			}
680
+			if ($matches[5] != '...') {
681
+				$result['pressure'] = round((intval($matches[5])/10),1);
682
+			}
561 683
 		        $body_parse = substr($body_parse,strlen($matches[0]));
562 684
 		    } 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)) {
563
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
564
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
565
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
566
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
567
-			if ($matches[5] != '...') $result['humidity'] = intval($matches[5]);
568
-			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
685
+			if ($matches[1] != '...') {
686
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
687
+			}
688
+			if ($matches[2] != '...') {
689
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
690
+			}
691
+			if ($matches[3] != '...') {
692
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
693
+			}
694
+			if ($matches[4] != '...') {
695
+				$result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
696
+			}
697
+			if ($matches[5] != '...') {
698
+				$result['humidity'] = intval($matches[5]);
699
+			}
700
+			if ($matches[6] != '...') {
701
+				$result['pressure'] = round((intval($matches[6])/10),1);
702
+			}
569 703
 		        $body_parse = substr($body_parse,strlen($matches[0]));
570 704
 		    } 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)) {
571
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
572
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
573
-			if ($matches[2] != '...') $result['humidity'] = intval($matches[3]);
574
-			if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1);
705
+			if ($matches[1] != '...') {
706
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
707
+			}
708
+			if ($matches[2] != '...') {
709
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
710
+			}
711
+			if ($matches[2] != '...') {
712
+				$result['humidity'] = intval($matches[3]);
713
+			}
714
+			if ($matches[4] != '...') {
715
+				$result['pressure'] = round((intval($matches[4])/10),1);
716
+			}
575 717
 		        $body_parse = substr($body_parse,strlen($matches[0]));
576 718
 		    } 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)) {
577
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
578
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
579
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
580
-			if ($matches[4] != '...') $result['humidity'] = intval($matches[4]);
581
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
719
+			if ($matches[1] != '...') {
720
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
721
+			}
722
+			if ($matches[2] != '...') {
723
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
724
+			}
725
+			if ($matches[3] != '...') {
726
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
727
+			}
728
+			if ($matches[4] != '...') {
729
+				$result['humidity'] = intval($matches[4]);
730
+			}
731
+			if ($matches[5] != '...') {
732
+				$result['pressure'] = round((intval($matches[5])/10),1);
733
+			}
582 734
 		        $body_parse = substr($body_parse,strlen($matches[0]));
583 735
 		    }
584 736
 		    $result['comment'] = trim($body_parse);
585 737
 		}
586
-		} else $result['comment'] = trim($body_parse);
738
+		} else {
739
+			$result['comment'] = trim($body_parse);
740
+		}
587 741
 
588 742
 	    }
589 743
 	//}
590
-	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
591
-	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
592
-	if ($debug) print_r($result);
744
+	if (isset($result['latitude'])) {
745
+		$result['latitude'] = round($result['latitude'],4);
746
+	}
747
+	if (isset($result['longitude'])) {
748
+		$result['longitude'] = round($result['longitude'],4);
749
+	}
750
+	if ($debug) {
751
+		print_r($result);
752
+	}
593 753
 	return $result;
594 754
     }
595 755
     
@@ -598,12 +758,21 @@  discard block
 block discarded – undo
598 758
 	$aprs_connect = 0;
599 759
 	$aprs_keep = 120;
600 760
 	$aprs_last_tx = time();
601
-	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
602
-	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
603
-	if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid;
604
-	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
605
-	if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass;
606
-	else $aprs_pass = '-1';
761
+	if (isset($globalAPRSversion)) {
762
+		$aprs_version = $globalAPRSversion;
763
+	} else {
764
+		$aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
765
+	}
766
+	if (isset($globalServerAPRSssid)) {
767
+		$aprs_ssid = $globalServerAPRSssid;
768
+	} else {
769
+		$aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
770
+	}
771
+	if (isset($globalServerAPRSpass)) {
772
+		$aprs_pass = $globalServerAPRSpass;
773
+	} else {
774
+		$aprs_pass = '-1';
775
+	}
607 776
 	
608 777
 	$aprs_filter  = '';
609 778
 	$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
@@ -636,10 +805,14 @@  discard block
 block discarded – undo
636 805
     
637 806
     public function send($data) {
638 807
 	global $globalDebug;
639
-	if ($this->connected === false) $this->connect();
808
+	if ($this->connected === false) {
809
+		$this->connect();
810
+	}
640 811
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
641 812
 	if ($send === FALSE) {
642
-		if ($globalDebug) echo 'Reconnect...';
813
+		if ($globalDebug) {
814
+			echo 'Reconnect...';
815
+		}
643 816
 		socket_close($this->socket);
644 817
 		$this->connect();
645 818
 	}
@@ -661,22 +834,32 @@  discard block
 block discarded – undo
661 834
 			//$w = '00';
662 835
 			$custom = '';
663 836
 			if ($ident != '') {
664
-				if ($custom != '') $custom .= '/';
837
+				if ($custom != '') {
838
+					$custom .= '/';
839
+				}
665 840
 				$custom .= 'CS='.$ident;
666 841
 			}
667 842
 			if ($squawk != '') {
668
-				if ($custom != '') $custom .= '/';
843
+				if ($custom != '') {
844
+					$custom .= '/';
845
+				}
669 846
 				$custom .= 'SQ='.$squawk;
670 847
 			}
671 848
 			if ($verticalrate != '') {
672
-				if ($custom != '') $custom .= '/';
849
+				if ($custom != '') {
850
+					$custom .= '/';
851
+				}
673 852
 				$custom .= 'VR='.$verticalrate;
674 853
 			}
675 854
 			if ($aircraft_icao != '' && $aircraft_icao != 'NA') {
676
-				if ($custom != '') $custom .= '/';
855
+				if ($custom != '') {
856
+					$custom .= '/';
857
+				}
677 858
 				$custom .= 'AI='.$aircraft_icao;
678 859
 			}
679
-			if ($custom != '') $custom = ' '.$custom;
860
+			if ($custom != '') {
861
+				$custom = ' '.$custom;
862
+			}
680 863
 			/*
681 864
 			// Use AMSL altitude
682 865
 			$GeoidClass = new GeoidHeight();
@@ -700,30 +883,44 @@  discard block
 block discarded – undo
700 883
 			//$w = '00';
701 884
 			$custom = '';
702 885
 			if ($ident != '') {
703
-				if ($custom != '') $custom .= '/';
886
+				if ($custom != '') {
887
+					$custom .= '/';
888
+				}
704 889
 				$custom .= 'CS='.str_replace(' ','_',$ident);
705 890
 			}
706 891
 			if ($typeid != '') {
707
-				if ($custom != '') $custom .= '/';
892
+				if ($custom != '') {
893
+					$custom .= '/';
894
+				}
708 895
 				$custom .= 'TI='.$typeid;
709 896
 			}
710 897
 			if ($statusid != '') {
711
-				if ($custom != '') $custom .= '/';
898
+				if ($custom != '') {
899
+					$custom .= '/';
900
+				}
712 901
 				$custom .= 'SI='.$statusid;
713 902
 			}
714 903
 			if ($imo != '') {
715
-				if ($custom != '') $custom .= '/';
904
+				if ($custom != '') {
905
+					$custom .= '/';
906
+				}
716 907
 				$custom .= 'IMO='.$imo;
717 908
 			}
718 909
 			if ($arrival_date != '') {
719
-				if ($custom != '') $custom .= '/';
910
+				if ($custom != '') {
911
+					$custom .= '/';
912
+				}
720 913
 				$custom .= 'AD='.strtotime($arrival_date);
721 914
 			}
722 915
 			if ($arrival_code != '') {
723
-				if ($custom != '') $custom .= '/';
916
+				if ($custom != '') {
917
+					$custom .= '/';
918
+				}
724 919
 				$custom .= 'AC='.str_replace(' ','_',$arrival_code);
725 920
 			}
726
-			if ($custom != '') $custom = ' '.$custom;
921
+			if ($custom != '') {
922
+				$custom = ' '.$custom;
923
+			}
727 924
 			$altitude = 0;
728 925
 			$this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
729 926
 		}
Please login to merge, or discard this patch.
Spacing   +157 added lines, -158 removed lines patch added patch discarded remove patch
@@ -167,8 +167,7 @@  discard block
 block discarded – undo
167 167
 	
168 168
 
169 169
     private function urshift($n, $s) {
170
-	return ($n >= 0) ? ($n >> $s) :
171
-	    (($n & 0x7fffffff) >> $s) | 
170
+	return ($n >= 0) ? ($n >> $s) : (($n&0x7fffffff) >> $s)| 
172 171
 		(0x40000000 >> ($s - 1));
173 172
     }
174 173
 
@@ -180,7 +179,7 @@  discard block
 block discarded – undo
180 179
 	//$split_input = str_split($input);
181 180
 
182 181
 	/* Find the end of header checking for NULL bytes while doing it. */
183
-	$splitpos = strpos($input,':');
182
+	$splitpos = strpos($input, ':');
184 183
 	
185 184
 	/* Check that end was found and body has at least one byte. */
186 185
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
@@ -190,15 +189,15 @@  discard block
 block discarded – undo
190 189
 	
191 190
 	if ($debug) echo 'input : '.$input."\n";
192 191
 	/* Save header and body. */
193
-	$body = substr($input,$splitpos+1,$input_len);
192
+	$body = substr($input, $splitpos + 1, $input_len);
194 193
 	$body_len = strlen($body);
195
-	$header = substr($input,0,$splitpos);
194
+	$header = substr($input, 0, $splitpos);
196 195
 	//$header_len = strlen($header);
197 196
 	if ($debug) echo 'header : '.$header."\n";
198 197
 	
199 198
 	/* Parse source, target and path. */
200 199
 	//FLRDF0A52>APRS,qAS,LSTB
201
-	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) {
200
+	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/', $header, $matches)) {
202 201
 	    $ident = $matches[1];
203 202
 	    $all_elements = $matches[2];
204 203
 	    if ($ident == 'AIRCRAFT') {
@@ -215,14 +214,14 @@  discard block
 block discarded – undo
215 214
 	    if ($debug) 'No ident'."\n";
216 215
 	    return false;
217 216
 	}
218
-	$elements = explode(',',$all_elements);
217
+	$elements = explode(',', $all_elements);
219 218
 	$source = end($elements);
220 219
 	$result['source'] = $source;
221 220
 	foreach ($elements as $element) {
222
-	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
221
+	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/', $element)) {
223 222
 	        //echo "ok";
224 223
 	        //if ($element == 'TCPIP*') return false;
225
-	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
224
+	    } elseif (!preg_match('/^([0-9A-F]{32})$/', $element)) {
226 225
 		if ($debug) echo 'element : '.$element."\n";
227 226
 		return false;
228 227
 	    }
@@ -235,14 +234,14 @@  discard block
 block discarded – undo
235 234
 	    */
236 235
 	}
237 236
 	
238
-	$type = substr($body,0,1);
237
+	$type = substr($body, 0, 1);
239 238
 	if ($debug) echo 'type : '.$type."\n";
240 239
 	if ($type == ';') {
241 240
 		if (isset($result['source_type']) && $result['source_type'] == 'modes') {
242
-			$result['address'] = trim(substr($body,1,9));
241
+			$result['address'] = trim(substr($body, 1, 9));
243 242
 		} elseif (isset($result['source_type']) && $result['source_type'] == 'ais') {
244
-			$result['mmsi'] = trim(substr($body,1,9));
245
-		} else $result['ident'] = trim(substr($body,1,9));
243
+			$result['mmsi'] = trim(substr($body, 1, 9));
244
+		} else $result['ident'] = trim(substr($body, 1, 9));
246 245
 	} elseif ($type == ',') {
247 246
 		// Invalid data or test data
248 247
 		return false;
@@ -250,24 +249,24 @@  discard block
 block discarded – undo
250 249
 	
251 250
 	// Check for Timestamp
252 251
 	$find = false;
253
-	$body_parse = substr($body,1);
252
+	$body_parse = substr($body, 1);
254 253
 	//echo 'Body : '.$body."\n";
255
-	if (preg_match('/^;(.){9}\*/',$body,$matches)) {
256
-	    $body_parse = substr($body_parse,10);
254
+	if (preg_match('/^;(.){9}\*/', $body, $matches)) {
255
+	    $body_parse = substr($body_parse, 10);
257 256
 	    $find = true;
258 257
 	    //echo $body_parse."\n";
259 258
 	}
260
-	if (preg_match('/^`(.*)\//',$body,$matches)) {
261
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
259
+	if (preg_match('/^`(.*)\//', $body, $matches)) {
260
+	    $body_parse = substr($body_parse, strlen($matches[1]) - 1);
262 261
 	    $find = true;
263 262
 	    //echo $body_parse."\n";
264 263
 	}
265
-	if (preg_match("/^'(.*)\//",$body,$matches)) {
266
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
264
+	if (preg_match("/^'(.*)\//", $body, $matches)) {
265
+	    $body_parse = substr($body_parse, strlen($matches[1]) - 1);
267 266
 	    $find = true;
268 267
 	    //echo $body_parse."\n";
269 268
 	}
270
-	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) {
269
+	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/', $body_parse, $matches)) {
271 270
 	    $find = true;
272 271
 	    //print_r($matches);
273 272
 	    $timestamp = $matches[0];
@@ -282,19 +281,19 @@  discard block
 block discarded – undo
282 281
 		// This work or not ?
283 282
 		$timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]);
284 283
 	    }
285
-	    $body_parse = substr($body_parse,7);
284
+	    $body_parse = substr($body_parse, 7);
286 285
 	    $result['timestamp'] = $timestamp;
287 286
 	    //echo date('Ymd H:i:s',$timestamp);
288 287
 	}
289
-	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) {
288
+	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $body_parse, $matches)) {
290 289
 	    $find = true;
291 290
 	    $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
292
-	    $body_parse = substr($body_parse,8);
291
+	    $body_parse = substr($body_parse, 8);
293 292
 	    $result['timestamp'] = $timestamp;
294 293
 	    //echo date('Ymd H:i:s',$timestamp);
295 294
 	}
296 295
 	//if (strlen($body_parse) > 19) {
297
-	    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)) {
298 297
 		$find = true;
299 298
 		// 4658.70N/00707.78Ez
300 299
 		//print_r(str_split($body_parse));
@@ -321,11 +320,11 @@  discard block
 block discarded – undo
321 320
 	    */
322 321
 		$latitude = $lat + floatval($lat_min)/60;
323 322
 		$longitude = $lon + floatval($lon_min)/60;
324
-		if ($sind == 'S') $latitude = 0-$latitude;
325
-		if ($wind == 'W') $longitude = 0-$longitude;
323
+		if ($sind == 'S') $latitude = 0 - $latitude;
324
+		if ($wind == 'W') $longitude = 0 - $longitude;
326 325
 		$result['latitude'] = $latitude;
327 326
 		$result['longitude'] = $longitude;
328
-		$body_parse = substr($body_parse,18);
327
+		$body_parse = substr($body_parse, 18);
329 328
 		$body_parse_len = strlen($body_parse);
330 329
 	    }
331 330
 	    $body_parse_len = strlen($body_parse);
@@ -357,7 +356,7 @@  discard block
 block discarded – undo
357 356
 		//echo $body_parse;
358 357
 			//if ($type != ';' && $type != '>') {
359 358
 			if ($type != '') {
360
-			$body_parse = substr($body_parse,1);
359
+			$body_parse = substr($body_parse, 1);
361 360
 			$body_parse_len = strlen($body_parse);
362 361
 			$result['symbol_code'] = $symbol_code;
363 362
 			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
@@ -368,16 +367,16 @@  discard block
 block discarded – undo
368 367
 		    //$body_parse_len = strlen($body_parse);
369 368
 		    if ($body_parse_len >= 7) {
370 369
 			
371
-		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
372
-		    	    $course = substr($body_parse,0,3);
370
+		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/', $body_parse)) {
371
+		    	    $course = substr($body_parse, 0, 3);
373 372
 		    	    $tmp_s = intval($course);
374 373
 		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
375
-		    	    $speed = substr($body_parse,4,3);
374
+		    	    $speed = substr($body_parse, 4, 3);
376 375
 		    	    if ($speed != '...') {
377 376
 		    		//$result['speed'] = round($speed*1.852);
378 377
 		    		$result['speed'] = intval($speed);
379 378
 		    	    }
380
-		    	    $body_parse = substr($body_parse,7);
379
+		    	    $body_parse = substr($body_parse, 7);
381 380
 		        }
382 381
 		        // Check PHGR, PHG, RNG
383 382
 		    } 
@@ -387,12 +386,12 @@  discard block
 block discarded – undo
387 386
 		    }
388 387
 		    */
389 388
 		    if (strlen($body_parse) > 0) {
390
-		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
389
+		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/', $body_parse, $matches)) {
391 390
 		            $altitude = intval($matches[1]);
392 391
 		            //$result['altitude'] = round($altitude*0.3048);
393 392
 		            $result['altitude'] = $altitude;
394 393
 		            //$body_parse = trim(substr($body_parse,strlen($matches[0])));
395
-		            $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
394
+		            $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/', '', $body_parse));
396 395
 		        }
397 396
 		    }
398 397
 		    
@@ -404,13 +403,13 @@  discard block
 block discarded – undo
404 403
 		    */
405 404
 		    // DAO
406 405
 		    
407
-		    if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
406
+		    if (preg_match('/^!([0-9A-Z]{3})/', $body_parse, $matches)) {
408 407
 			    
409 408
 			    $dao = $matches[1];
410
-			    if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
409
+			    if (preg_match('/^([A-Z])([0-9]{2})/', $dao)) {
411 410
 				$dao_split = str_split($dao);
412
-			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
413
-			        $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;
414 413
 			    
415 414
 				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
416 415
 				else $result['latitude'] += $lat_off;
@@ -418,50 +417,50 @@  discard block
 block discarded – undo
418 417
 				else $result['longitude'] += $lon_off;
419 418
 			    }
420 419
 			    
421
-		            $body_parse = substr($body_parse,6);
420
+		            $body_parse = substr($body_parse, 6);
422 421
 		    }
423 422
 		    
424
-		    if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
425
-			$result['ident'] = str_replace('_',' ',$matches[1]);
423
+		    if (preg_match('/CS=([0-9A-Z_]*)/', $body_parse, $matches)) {
424
+			$result['ident'] = str_replace('_', ' ', $matches[1]);
426 425
 		    }
427
-		    if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
426
+		    if (preg_match('/SQ=([0-9]{4})/', $body_parse, $matches)) {
428 427
 			$result['squawk'] = $matches[1];
429 428
 		    }
430
-		    if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
429
+		    if (preg_match('/AI=([0-9A-Z]{4})/', $body_parse, $matches)) {
431 430
 			$result['aircraft_icao'] = $matches[1];
432 431
 		    }
433
-		    if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
432
+		    if (preg_match('/VR=([0-9]*)/', $body_parse, $matches)) {
434 433
 			$result['verticalrate'] = $matches[1];
435 434
 		    }
436
-		    if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
435
+		    if (preg_match('/TI=([0-9]*)/', $body_parse, $matches)) {
437 436
 			$result['typeid'] = $matches[1];
438 437
 		    }
439
-		    if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
438
+		    if (preg_match('/SI=([0-9]*)/', $body_parse, $matches)) {
440 439
 			$result['statusid'] = $matches[1];
441 440
 		    }
442
-		    if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
441
+		    if (preg_match('/IMO=([0-9]{7})/', $body_parse, $matches)) {
443 442
 			$result['imo'] = $matches[1];
444 443
 		    }
445
-		    if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
444
+		    if (preg_match('/AD=([0-9]*)/', $body_parse, $matches)) {
446 445
 			$result['arrival_date'] = $matches[1];
447 446
 		    }
448
-		    if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
449
-			$result['arrival_code'] = str_replace('_',' ',$matches[1]);
447
+		    if (preg_match('/AC=([0-9A-Z_]*)/', $body_parse, $matches)) {
448
+			$result['arrival_code'] = str_replace('_', ' ', $matches[1]);
450 449
 		    }
451 450
 		    // OGN comment
452 451
 		   // echo "Before OGN : ".$body_parse."\n";
453 452
 		    //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
454
-		    if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
453
+		    if (preg_match('/^id([0-9A-F]{8})/', $body_parse, $matches)) {
455 454
 			$id = $matches[1];
456 455
 			//$mode = substr($id,0,2);
457
-			$address = substr($id,2);
456
+			$address = substr($id, 2);
458 457
 			//print_r($matches);
459
-			$addressType = (intval(substr($id,0,2),16))&3;
458
+			$addressType = (intval(substr($id, 0, 2), 16))&3;
460 459
 			if ($addressType == 0) $result['addresstype'] = "RANDOM";
461 460
 			elseif ($addressType == 1) $result['addresstype'] = "ICAO";
462 461
 			elseif ($addressType == 2) $result['addresstype'] = "FLARM";
463 462
 			elseif ($addressType == 3) $result['addresstype'] = "OGN";
464
-			$aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2);
463
+			$aircraftType = $this->urshift(((intval(substr($id, 0, 2), 16))&0b1111100), 2);
465 464
 			$result['aircrafttype_code'] = $aircraftType;
466 465
 			if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN";
467 466
 			elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER";
@@ -478,7 +477,7 @@  discard block
 block discarded – undo
478 477
 			elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP";
479 478
 			elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV";
480 479
 			elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT";
481
-			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
480
+			$stealth = (intval(substr($id, 0, 2), 16)&0b10000000) != 0;
482 481
 			$result['stealth'] = $stealth;
483 482
 			$result['address'] = $address;
484 483
 		    }
@@ -490,96 +489,96 @@  discard block
 block discarded – undo
490 489
 		    //$body_parse = substr($body_parse,1);
491 490
 		    //$body_parse_len = strlen($body_parse);
492 491
 		    //echo 'weather'."\n";
493
-		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
492
+		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) {
494 493
 			    $result['wind_dir'] = intval($matches[1]);
495
-			    $result['wind_speed'] = round(intval($matches[2])*1.60934,1);
496
-			    $result['wind_gust'] = round(intval($matches[3])*1.60934,1);
497
-			    $result['temp'] = round(5/9*((intval($matches[4]))-32),1);
498
-		    	    $body_parse = substr($body_parse,strlen($matches[0])+1);
499
-		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
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)) {
500 499
 			$result['wind_dir'] = intval($matches[1]);
501
-			$result['wind_speed'] = round($matches[2]*1.60934,1);
502
-			$result['wind_gust'] = round($matches[3]*1.60934,1);
503
-			$result['temp'] = round(5/9*(($matches[4])-32),1);
504
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
505
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
500
+			$result['wind_speed'] = round($matches[2]*1.60934, 1);
501
+			$result['wind_gust'] = round($matches[3]*1.60934, 1);
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)) {
506 505
 			$result['wind_dir'] = intval($matches[1]);
507
-			$result['wind_speed'] = round($matches[2]*1.60934,1);
508
-			$result['wind_gust'] = round($matches[3]*1.60934,1);
509
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
510
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
506
+			$result['wind_speed'] = round($matches[2]*1.60934, 1);
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)) {
511 510
 			$result['wind_dir'] = intval($matches[1]);
512
-			$result['wind_speed'] = round($matches[2]*1.60934,1);
513
-			$result['wind_gust'] = round($matches[3]*1.60934,1);
514
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
511
+			$result['wind_speed'] = round($matches[2]*1.60934, 1);
512
+			$result['wind_gust'] = round($matches[3]*1.60934, 1);
513
+		        $body_parse = substr($body_parse, strlen($matches[0]) + 1);
515 514
 		    }
516 515
 		    //if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
517 516
 		    //g012t088r000p000P000h38b10110
518 517
 		    //g011t086r000p000P000h29b10198
519
-		    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)) {
520
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
521
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
522
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
523
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
524
-			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
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
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
520
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
521
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
522
+			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1);
523
+			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1);
525 524
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
526
-			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
527
-		        $body_parse = substr($body_parse,strlen($matches[0]));
528
-		    } 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)) {
529
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
530
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
531
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
532
-			if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1);
533
-			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
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)) {
528
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
529
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
530
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
531
+			if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1, 1);
532
+			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1);
534 533
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
535
-			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
536
-		        $body_parse = substr($body_parse,strlen($matches[0]));
537
-		    } 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)) {
538
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
539
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
540
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
541
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
542
-			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
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)) {
537
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
538
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
539
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
540
+			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1);
541
+			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1);
543 542
 			if ($matches[7] != '...') $result['humidity'] = intval($matches[7]);
544
-			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
545
-		        $body_parse = substr($body_parse,strlen($matches[0]));
546
-		    } 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)) {
547
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
548
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
549
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
550
-			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
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)) {
546
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
547
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
548
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
549
+			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1);
551 550
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
552
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
553
-		        $body_parse = substr($body_parse,strlen($matches[0]));
554
-		    } 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)) {
555
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
556
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
557
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
558
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
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)) {
554
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
555
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
556
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
557
+			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1);
559 558
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
560
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
561
-		        $body_parse = substr($body_parse,strlen($matches[0]));
562
-		    } 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)) {
563
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
564
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
565
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
566
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
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)) {
562
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
563
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
564
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
565
+			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1);
567 566
 			if ($matches[5] != '...') $result['humidity'] = intval($matches[5]);
568
-			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
569
-		        $body_parse = substr($body_parse,strlen($matches[0]));
570
-		    } 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)) {
571
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
572
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
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)) {
570
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
571
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
573 572
 			if ($matches[2] != '...') $result['humidity'] = intval($matches[3]);
574
-			if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1);
575
-		        $body_parse = substr($body_parse,strlen($matches[0]));
576
-		    } 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)) {
577
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
578
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
579
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
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)) {
576
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
577
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
578
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
580 579
 			if ($matches[4] != '...') $result['humidity'] = intval($matches[4]);
581
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
582
-		        $body_parse = substr($body_parse,strlen($matches[0]));
580
+			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1);
581
+		        $body_parse = substr($body_parse, strlen($matches[0]));
583 582
 		    }
584 583
 		    $result['comment'] = trim($body_parse);
585 584
 		}
@@ -587,42 +586,42 @@  discard block
 block discarded – undo
587 586
 
588 587
 	    }
589 588
 	//}
590
-	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
591
-	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
589
+	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'], 4);
590
+	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'], 4);
592 591
 	if ($debug) print_r($result);
593 592
 	return $result;
594 593
     }
595 594
     
596 595
     public function connect() {
597
-	global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport;
596
+	global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass, $globalName, $globalServerAPRShost, $globalServerAPRSport;
598 597
 	$aprs_connect = 0;
599 598
 	$aprs_keep = 120;
600 599
 	$aprs_last_tx = time();
601 600
 	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
602
-	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
601
+	else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName);
603 602
 	if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid;
604
-	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
603
+	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8);
605 604
 	if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass;
606 605
 	else $aprs_pass = '-1';
607 606
 	
608
-	$aprs_filter  = '';
607
+	$aprs_filter = '';
609 608
 	$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
610 609
 	$Common = new Common();
611
-	$s = $Common->create_socket($globalServerAPRShost,$globalServerAPRSport,$errno,$errstr);
610
+	$s = $Common->create_socket($globalServerAPRShost, $globalServerAPRSport, $errno, $errstr);
612 611
 	if ($s !== false) {
613 612
 		echo 'Connected to APRS server! '."\n";
614 613
 		$authstart = time();
615 614
 		$this->socket = $s;
616
-		$send = socket_send( $this->socket  , $aprs_login , strlen($aprs_login) , 0 );
617
-		socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1);
618
-		while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) {
615
+		$send = socket_send($this->socket, $aprs_login, strlen($aprs_login), 0);
616
+		socket_set_option($this->socket, SOL_SOCKET, SO_KEEPALIVE, 1);
617
+		while ($msgin = socket_read($this->socket, 1000, PHP_NORMAL_READ)) {
619 618
 			if (strpos($msgin, "$aprs_ssid verified") !== FALSE) {
620 619
 			    echo 'APRS user verified !'."\n";
621 620
 			    $this->connected = true;
622 621
 			    return true;
623 622
 			    break;
624 623
 			}
625
-			if (time()-$authstart > 5) {
624
+			if (time() - $authstart > 5) {
626 625
 			    echo 'APRS timeout'."\n";
627 626
 			    break;
628 627
 			}
@@ -637,7 +636,7 @@  discard block
 block discarded – undo
637 636
     public function send($data) {
638 637
 	global $globalDebug;
639 638
 	if ($this->connected === false) $this->connect();
640
-	$send = socket_send( $this->socket  , $data , strlen($data),0);
639
+	$send = socket_send($this->socket, $data, strlen($data), 0);
641 640
 	if ($send === FALSE) {
642 641
 		if ($globalDebug) echo 'Reconnect...';
643 642
 		socket_close($this->socket);
@@ -647,17 +646,17 @@  discard block
 block discarded – undo
647 646
 }
648 647
 
649 648
 class APRSSpotter extends APRS {
650
-	public function addLiveSpotterData($id,$ident,$aircraft_icao,$departure_airport,$arrival_airport,$latitude,$longitude,$waypoints,$altitude,$altitude_real,$heading,$speed,$datetime,$departure_airport_time,$arrival_airport_time,$squawk,$route_stop,$hex,$putinarchive,$registration,$pilot_id,$pilot_name, $verticalrate, $noarchive, $ground,$format_source,$source_name,$over_country) {
649
+	public function addLiveSpotterData($id, $ident, $aircraft_icao, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $speed, $datetime, $departure_airport_time, $arrival_airport_time, $squawk, $route_stop, $hex, $putinarchive, $registration, $pilot_id, $pilot_name, $verticalrate, $noarchive, $ground, $format_source, $source_name, $over_country) {
651 650
 		$Common = new Common();
652 651
 		date_default_timezone_set('UTC');
653 652
 		if ($latitude != '' && $longitude != '') {
654 653
 			$lat = $latitude;
655 654
 			$long = $longitude;
656
-			$latitude = $Common->convertDM($latitude,'latitude');
657
-			$longitude = $Common->convertDM($longitude,'longitude');
658
-			$coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW'];
659
-			$w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000));
660
-			$w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000));
655
+			$latitude = $Common->convertDM($latitude, 'latitude');
656
+			$longitude = $Common->convertDM($longitude, 'longitude');
657
+			$coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW'];
658
+			$w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000));
659
+			$w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000));
661 660
 			$w = $w1.$w2;
662 661
 			//$w = '00';
663 662
 			$custom = '';
@@ -684,26 +683,26 @@  discard block
 block discarded – undo
684 683
 			$geoid= round($GeoidClass->get($lat,$long)*3.28084,2);
685 684
 			$altitude_real = round($altitude_real + $geoid);
686 685
 			*/
687
-			$this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.'   *'.date('His',strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude_real,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
686
+			$this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.'   *'.date('His', strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude_real, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
688 687
 		}
689 688
 	}
690 689
 }
691 690
 class APRSMarine extends APRS {
692
-	public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed,$datetime, $putinarchive,$mmsi,$type,$typeid,$imo,$callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source,$source_name,$over_country) {
691
+	public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed, $datetime, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country) {
693 692
 		$Common = new Common();
694 693
 		date_default_timezone_set('UTC');
695 694
 		if ($latitude != '' && $longitude != '') {
696
-			$latitude = $Common->convertDM($latitude,'latitude');
697
-			$longitude = $Common->convertDM($longitude,'longitude');
698
-			$coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW'];
699
-			$w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000));
700
-			$w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000));
695
+			$latitude = $Common->convertDM($latitude, 'latitude');
696
+			$longitude = $Common->convertDM($longitude, 'longitude');
697
+			$coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW'];
698
+			$w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000));
699
+			$w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000));
701 700
 			$w = $w1.$w2;
702 701
 			//$w = '00';
703 702
 			$custom = '';
704 703
 			if ($ident != '') {
705 704
 				if ($custom != '') $custom .= '/';
706
-				$custom .= 'CS='.str_replace(' ','_',$ident);
705
+				$custom .= 'CS='.str_replace(' ', '_', $ident);
707 706
 			}
708 707
 			if ($typeid != '') {
709 708
 				if ($custom != '') $custom .= '/';
@@ -723,11 +722,11 @@  discard block
 block discarded – undo
723 722
 			}
724 723
 			if ($arrival_code != '') {
725 724
 				if ($custom != '') $custom .= '/';
726
-				$custom .= 'AC='.str_replace(' ','_',$arrival_code);
725
+				$custom .= 'AC='.str_replace(' ', '_', $arrival_code);
727 726
 			}
728 727
 			if ($custom != '') $custom = ' '.$custom;
729 728
 			$altitude = 0;
730
-			$this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
729
+			$this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His', strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
731 730
 		}
732 731
 	}
733 732
 }
Please login to merge, or discard this patch.
require/class.ATC.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
 	}
11 11
 
12 12
 	/**
13
-	* Get SQL query part for filter used
14
-	* @param Array $filter the filter
15
-	* @return Array the SQL part
16
-	*/
13
+	 * Get SQL query part for filter used
14
+	 * @param Array $filter the filter
15
+	 * @return Array the SQL part
16
+	 */
17 17
 	public function getFilter($filter = array(),$where = false,$and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
19 19
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -14,22 +14,22 @@  discard block
 block discarded – undo
14 14
 	* @param Array $filter the filter
15 15
 	* @return Array the SQL part
16 16
 	*/
17
-	public function getFilter($filter = array(),$where = false,$and = false) {
17
+	public function getFilter($filter = array(), $where = false, $and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
19 19
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
20 20
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
21
-				foreach($globalStatsFilters[$globalFilterName] as $source) {
21
+				foreach ($globalStatsFilters[$globalFilterName] as $source) {
22 22
 					if (isset($source['source'])) $filter['source'][] = $source['source'];
23 23
 				}
24 24
 			} else {
25 25
 				$filter = $globalStatsFilters[$globalFilterName];
26 26
 			}
27 27
 		}
28
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
28
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
29 29
 		$filter_query_join = '';
30 30
 		$filter_query_where = '';
31 31
 		if (isset($filter['source']) && !empty($filter['source'])) {
32
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
32
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
33 33
 		}
34 34
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
35 35
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		try {
45 45
 			$sth = $this->db->prepare($query);
46 46
 			$sth->execute($query_values);
47
-		} catch(PDOException $e) {
47
+		} catch (PDOException $e) {
48 48
 			return "error : ".$e->getMessage();
49 49
 		}
50 50
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -52,66 +52,66 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	public function getById($id) {
55
-		$filter_query = $this->getFilter(array(),true);
55
+		$filter_query = $this->getFilter(array(), true);
56 56
 		$query = "SELECT * FROM atc".$filter_query." atc_id = :id";
57 57
 		$query_values = array(':id' => $id);
58 58
 		try {
59 59
 			$sth = $this->db->prepare($query);
60 60
 			$sth->execute($query_values);
61
-		} catch(PDOException $e) {
61
+		} catch (PDOException $e) {
62 62
 			return "error : ".$e->getMessage();
63 63
 		}
64 64
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
65 65
 		return $all;
66 66
 	}
67 67
 
68
-	public function getByIdent($ident,$format_source = '') {
69
-		$filter_query = $this->getFilter(array(),true);
68
+	public function getByIdent($ident, $format_source = '') {
69
+		$filter_query = $this->getFilter(array(), true);
70 70
 		if ($format_source == '') {
71 71
 			$query = "SELECT * FROM atc".$filter_query." ident = :ident";
72 72
 			$query_values = array(':ident' => $ident);
73 73
 		} else {
74 74
 			$query = "SELECT * FROM atc".$filter_query." ident = :ident AND format_source = :format_source";
75
-			$query_values = array(':ident' => $ident,':format_source' => $format_source);
75
+			$query_values = array(':ident' => $ident, ':format_source' => $format_source);
76 76
 		}
77 77
 		try {
78 78
 			$sth = $this->db->prepare($query);
79 79
 			$sth->execute($query_values);
80
-		} catch(PDOException $e) {
80
+		} catch (PDOException $e) {
81 81
 			return "error : ".$e->getMessage();
82 82
 		}
83 83
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
84 84
 		return $all;
85 85
 	}
86 86
 
87
-	public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
88
-		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
89
-		$info = str_replace('^','<br />',$info);
90
-		$info = str_replace('&amp;sect;','',$info);
91
-		$info = str_replace('"','',$info);
87
+	public function add($ident, $frequency, $latitude, $longitude, $range, $info, $date, $type = '', $ivao_id = '', $ivao_name = '', $format_source = '', $source_name = '') {
88
+		$info = preg_replace('/[^(\x20-\x7F)]*/', '', $info);
89
+		$info = str_replace('^', '<br />', $info);
90
+		$info = str_replace('&amp;sect;', '', $info);
91
+		$info = str_replace('"', '', $info);
92 92
 		if ($type == '') $type = NULL;
93 93
 		$query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
94
-		$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
94
+		$query_values = array(':ident' => $ident, ':frequency' => $frequency, ':latitude' => $latitude, ':longitude' => $longitude, ':range' => $range, ':info' => $info, ':date' => $date, ':ivao_id' => $ivao_id, ':ivao_name' => $ivao_name, ':type' => $type, ':format_source' => $format_source, ':source_name' => $source_name);
95 95
 		try {
96 96
 			$sth = $this->db->prepare($query);
97 97
 			$sth->execute($query_values);
98
-		} catch(PDOException $e) {
98
+		} catch (PDOException $e) {
99 99
 			return "error : ".$e->getMessage();
100 100
 		}
101 101
 	}
102 102
 
103
-	public function update($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
104
-		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
105
-		$info = str_replace('^','<br />',$info);
106
-		$info = str_replace('&amp;sect;','',$info);
107
-		$info = str_replace('"','',$info);
103
+	public function update($ident, $frequency, $latitude, $longitude, $range, $info, $date, $type = '', $ivao_id = '', $ivao_name = '', $format_source = '', $source_name = '') {
104
+		$info = preg_replace('/[^(\x20-\x7F)]*/', '', $info);
105
+		$info = str_replace('^', '<br />', $info);
106
+		$info = str_replace('&amp;sect;', '', $info);
107
+		$info = str_replace('"', '', $info);
108 108
 		if ($type == '') $type = NULL;
109 109
 		$query = "UPDATE atc SET frequency = :frequency,latitude = :latitude,longitude = :longitude,atc_range = :range,info = :info,atc_lastseen = :date,type = :type,ivao_id = :ivao_id,ivao_name = :ivao_name WHERE ident = :ident AND format_source = :format_source AND source_name = :source_name";
110
-		$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
110
+		$query_values = array(':ident' => $ident, ':frequency' => $frequency, ':latitude' => $latitude, ':longitude' => $longitude, ':range' => $range, ':info' => $info, ':date' => $date, ':ivao_id' => $ivao_id, ':ivao_name' => $ivao_name, ':type' => $type, ':format_source' => $format_source, ':source_name' => $source_name);
111 111
 		try {
112 112
 			$sth = $this->db->prepare($query);
113 113
 			$sth->execute($query_values);
114
-		} catch(PDOException $e) {
114
+		} catch (PDOException $e) {
115 115
 			return "error : ".$e->getMessage();
116 116
 		}
117 117
 	}
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
 		try {
123 123
 			$sth = $this->db->prepare($query);
124 124
 			$sth->execute($query_values);
125
-		} catch(PDOException $e) {
125
+		} catch (PDOException $e) {
126 126
 			return "error : ".$e->getMessage();
127 127
 		}
128 128
 	}
129 129
 
130
-	public function deleteByIdent($ident,$format_source) {
130
+	public function deleteByIdent($ident, $format_source) {
131 131
 		$query = "DELETE FROM atc WHERE ident = :ident AND format_source = :format_source";
132
-		$query_values = array(':ident' => $ident,':format_source' => $format_source);
132
+		$query_values = array(':ident' => $ident, ':format_source' => $format_source);
133 133
 		try {
134 134
 			$sth = $this->db->prepare($query);
135 135
 			$sth->execute($query_values);
136
-		} catch(PDOException $e) {
136
+		} catch (PDOException $e) {
137 137
 			return "error : ".$e->getMessage();
138 138
 		}
139 139
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		try {
145 145
 			$sth = $this->db->prepare($query);
146 146
 			$sth->execute($query_values);
147
-		} catch(PDOException $e) {
147
+		} catch (PDOException $e) {
148 148
 			return "error : ".$e->getMessage();
149 149
 		}
150 150
 	}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		try {
160 160
 			$sth = $this->db->prepare($query);
161 161
 			$sth->execute();
162
-		} catch(PDOException $e) {
162
+		} catch (PDOException $e) {
163 163
 			return "error";
164 164
 		}
165 165
 		return "success";
Please login to merge, or discard this patch.
Braces   +20 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@  discard block
 block discarded – undo
7 7
 	public function __construct($dbc = null) {
8 8
 		$Connection = new Connection($dbc);
9 9
 		$this->db = $Connection->db;
10
-		if ($this->db === null) die('Error: No DB connection. (ATC)');
10
+		if ($this->db === null) {
11
+			die('Error: No DB connection. (ATC)');
12
+		}
11 13
 	}
12 14
 
13 15
 	/**
@@ -20,20 +22,27 @@  discard block
 block discarded – undo
20 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
21 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
22 24
 				foreach($globalStatsFilters[$globalFilterName] as $source) {
23
-					if (isset($source['source'])) $filter['source'][] = $source['source'];
25
+					if (isset($source['source'])) {
26
+						$filter['source'][] = $source['source'];
27
+					}
24 28
 				}
25 29
 			} else {
26 30
 				$filter = $globalStatsFilters[$globalFilterName];
27 31
 			}
28 32
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) {
34
+			$filter = array_merge($filter,$globalFilter);
35
+		}
30 36
 		$filter_query_join = '';
31 37
 		$filter_query_where = '';
32 38
 		if (isset($filter['source']) && !empty($filter['source'])) {
33 39
 			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
34 40
 		}
35
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
36
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
41
+		if ($filter_query_where == '' && $where) {
42
+			$filter_query_where = ' WHERE';
43
+		} elseif ($filter_query_where != '' && $and) {
44
+			$filter_query_where .= ' AND';
45
+		}
37 46
 		$filter_query = $filter_query_join.$filter_query_where;
38 47
 		return $filter_query;
39 48
 	}
@@ -90,7 +99,9 @@  discard block
 block discarded – undo
90 99
 		$info = str_replace('^','<br />',$info);
91 100
 		$info = str_replace('&amp;sect;','',$info);
92 101
 		$info = str_replace('"','',$info);
93
-		if ($type == '') $type = NULL;
102
+		if ($type == '') {
103
+			$type = NULL;
104
+		}
94 105
 		$query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
95 106
 		$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
96 107
 		try {
@@ -106,7 +117,9 @@  discard block
 block discarded – undo
106 117
 		$info = str_replace('^','<br />',$info);
107 118
 		$info = str_replace('&amp;sect;','',$info);
108 119
 		$info = str_replace('"','',$info);
109
-		if ($type == '') $type = NULL;
120
+		if ($type == '') {
121
+			$type = NULL;
122
+		}
110 123
 		$query = "UPDATE atc SET frequency = :frequency,latitude = :latitude,longitude = :longitude,atc_range = :range,info = :info,atc_lastseen = :date,type = :type,ivao_id = :ivao_id,ivao_name = :ivao_name WHERE ident = :ident AND format_source = :format_source AND source_name = :source_name";
111 124
 		$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
112 125
 		try {
Please login to merge, or discard this patch.