Completed
Push — master ( 7dfb92...6193f6 )
by Yannick
35:52
created
archive-geojson.php 2 patches
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // This script can be slow...
3 3
 set_time_limit(0);
4
-ini_set('max_execution_time',6000);
4
+ini_set('max_execution_time', 6000);
5 5
 require_once('require/class.Connection.php');
6 6
 require_once('require/class.Common.php');
7 7
 
@@ -63,24 +63,24 @@  discard block
 block discarded – undo
63 63
 $min = false;
64 64
 $allhistory = false;
65 65
 $filter['source'] = array();
66
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
69
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
71
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
72
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
66
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
67
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
68
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
69
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
70
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
71
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
72
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
73
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
74
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
75
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
76
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
77 77
 
78 78
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
79 79
 	$min = true;
80 80
 } else $min = false;
81 81
 
82 82
 if (isset($_GET['ident'])) {
83
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
83
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
84 84
 	$from_archive = true;
85 85
 	if ($tracker) {
86 86
 		$spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	$allhistory = true;
95 95
 }
96 96
 elseif (isset($_GET['flightaware_id'])) {
97
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
97
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
98 98
 	$from_archive = true;
99 99
 	if ($tracker) {
100 100
 		$spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id);
@@ -109,26 +109,26 @@  discard block
 block discarded – undo
109 109
 }
110 110
 elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) {
111 111
 	$from_archive = true;
112
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
112
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
113 113
 	if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate;
114 114
 	else $begindate = $begindate - 3000;
115
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
116
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
117
-	$part = filter_input(INPUT_GET,'part',FILTER_SANITIZE_NUMBER_INT);
115
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
116
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
117
+	$part = filter_input(INPUT_GET, 'part', FILTER_SANITIZE_NUMBER_INT);
118 118
 	if ($part == '') $part = 0;
119 119
 	
120 120
 	if ($begindate != '' && $enddate != '') {
121
-		$begindate = date('Y-m-d H:i:s',$begindate);
122
-		$enddate = date('Y-m-d H:i:s',$enddate);
121
+		$begindate = date('Y-m-d H:i:s', $begindate);
122
+		$enddate = date('Y-m-d H:i:s', $enddate);
123 123
 		//$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
124 124
 		if ($tracker) {
125
-			$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter);
125
+			$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter);
126 126
 		}
127 127
 		elseif ($marine) {
128
-			$spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter);
128
+			$spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter);
129 129
 		}
130 130
 		else {
131
-			$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter,$part);
131
+			$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter, $part);
132 132
 		}
133 133
 	}
134 134
 }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	if ($flightcnt == '') $flightcnt = 0;
140 140
 } else $flightcnt = 0;
141 141
 
142
-$sqltime = round(microtime(true)-$begintime,2);
142
+$sqltime = round(microtime(true) - $begintime, 2);
143 143
 
144 144
 $pfi = '';
145 145
 //var_dump($spotter_array);
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 $begin = true;
155 155
 if (!empty($spotter_array) && is_array($spotter_array)) {
156 156
 	$output .= '"features": [';
157
-	foreach($spotter_array as $spotter_item) {
157
+	foreach ($spotter_array as $spotter_item) {
158 158
 		$j++;
159 159
 		date_default_timezone_set('UTC');
160 160
 		if ($tracker) {
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		if ($begin) {
179 179
 			if ($j > 1) {
180 180
 				if (isset($output_time)) {
181
-					$output_time  = substr($output_time, 0, -1);
181
+					$output_time = substr($output_time, 0, -1);
182 182
 					$output .= '"time": ['.$output_time.']';
183 183
 				}
184 184
 				$output .= '},';
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				$output .= '"type": "LineString",';
188 188
 				$output .= '"coordinates": [';
189 189
 				if (isset($output_history)) {
190
-					$output_history  = substr($output_history, 0, -1);
190
+					$output_history = substr($output_history, 0, -1);
191 191
 					$output .= $output_history;
192 192
 				}
193 193
 				$output .= ']}},';
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 			$output .= '"fi": "'.$pfi.'",';
219 219
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
220 220
 			if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
221
-				$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
221
+				$output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
222 222
 				//"
223 223
 			} else {
224 224
 				$output .= '"c": "NA",';
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 	if ($j > 1) {
354 354
 		if (isset($output_time)) {
355
-			$output_time  = substr($output_time, 0, -1);
355
+			$output_time = substr($output_time, 0, -1);
356 356
 			$output .= '"time": ['.$output_time.']';
357 357
 		}
358 358
 		$output .= '},';
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 		$output .= '"type": "LineString",';
362 362
 		$output .= '"coordinates": [';
363 363
 		if (isset($output_history)) {
364
-			$output_history  = substr($output_history, 0, -1);
364
+			$output_history = substr($output_history, 0, -1);
365 365
 			$output .= $output_history;
366 366
 		}
367 367
 		$output .= ']';
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	$output  = substr($output, 0, -1);
373 373
 	$output .= ']';
374 374
 	$output .= ',"initial_sqltime": "'.$sqltime.'",';
375
-	$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
375
+	$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
376 376
 	if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
377 377
 	$output .= '"fc": "'.$flightcnt.'"';
378 378
 } else {
Please login to merge, or discard this patch.
Braces   +229 added lines, -142 removed lines patch added patch discarded remove patch
@@ -25,12 +25,10 @@  discard block
 block discarded – undo
25 25
 if ($tracker) {
26 26
 	require_once('require/class.Tracker.php');
27 27
 	require_once('require/class.TrackerArchive.php');
28
-}
29
-elseif ($marine) {
28
+} elseif ($marine) {
30 29
 	require_once('require/class.Marine.php');
31 30
 	require_once('require/class.MarineArchive.php');
32
-}
33
-else {
31
+} else {
34 32
 	require_once('require/class.Spotter.php');
35 33
 	require_once('require/class.SpotterArchive.php');
36 34
 }
@@ -38,12 +36,10 @@  discard block
 block discarded – undo
38 36
 if ($tracker) {
39 37
 	$Tracker = new Tracker();
40 38
 	$TrackerArchive = new TrackerArchive();
41
-}
42
-elseif ($marine) {
39
+} elseif ($marine) {
43 40
 	$Marine = new Marine();
44 41
 	$MarineArchive = new MarineArchive();
45
-}
46
-else {
42
+} else {
47 43
 	$Spotter = new Spotter();
48 44
 	$SpotterArchive = new SpotterArchive();
49 45
 }
@@ -56,66 +52,92 @@  discard block
 block discarded – undo
56 52
 }
57 53
 header('Content-Type: text/javascript');
58 54
 
59
-if (!isset($globalJsonCompress)) $compress = true;
60
-else $compress = $globalJsonCompress;
55
+if (!isset($globalJsonCompress)) {
56
+	$compress = true;
57
+} else {
58
+	$compress = $globalJsonCompress;
59
+}
61 60
 
62 61
 $from_archive = false;
63 62
 $min = false;
64 63
 $allhistory = false;
65 64
 $filter['source'] = array();
66
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
69
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
71
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
72
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
65
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
66
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
67
+}
68
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
69
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
70
+}
71
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
72
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
73
+}
74
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
75
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
76
+}
77
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
78
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
79
+}
80
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
81
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
+}
83
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
84
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
85
+}
86
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
87
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
88
+}
89
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
90
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
91
+}
92
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
93
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
94
+}
95
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
96
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
97
+}
77 98
 
78 99
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
79 100
 	$min = true;
80
-} else $min = false;
101
+} else {
102
+	$min = false;
103
+}
81 104
 
82 105
 if (isset($_GET['ident'])) {
83 106
 	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
84 107
 	$from_archive = true;
85 108
 	if ($tracker) {
86 109
 		$spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident);
87
-	}
88
-	elseif ($marine) {
110
+	} elseif ($marine) {
89 111
 		$spotter_array = $MarineArchive->getLastArchiveMarineDataByIdent($ident);
90
-	}
91
-	else {
112
+	} else {
92 113
 		$spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident);
93 114
 	}
94 115
 	$allhistory = true;
95
-}
96
-elseif (isset($_GET['flightaware_id'])) {
116
+} elseif (isset($_GET['flightaware_id'])) {
97 117
 	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
98 118
 	$from_archive = true;
99 119
 	if ($tracker) {
100 120
 		$spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id);
101
-	}
102
-	elseif ($marine) {
121
+	} elseif ($marine) {
103 122
 		$spotter_array = $MarineArchive->getLastArchiveMarineDataById($flightaware_id);
104
-	}
105
-	else {
123
+	} else {
106 124
 		$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
107 125
 	}
108 126
 	$allhistory = true;
109
-}
110
-elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) {
127
+} elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) {
111 128
 	$from_archive = true;
112 129
 	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
113
-	if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate;
114
-	else $begindate = $begindate - 3000;
130
+	if (isset($globalAircraftMaxUpdate)) {
131
+		$begindate = $begindate - $globalAircraftMaxUpdate;
132
+	} else {
133
+		$begindate = $begindate - 3000;
134
+	}
115 135
 	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
116 136
 	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
117 137
 	$part = filter_input(INPUT_GET,'part',FILTER_SANITIZE_NUMBER_INT);
118
-	if ($part == '') $part = 0;
138
+	if ($part == '') {
139
+		$part = 0;
140
+	}
119 141
 	
120 142
 	if ($begindate != '' && $enddate != '') {
121 143
 		$begindate = date('Y-m-d H:i:s',$begindate);
@@ -123,11 +145,9 @@  discard block
 block discarded – undo
123 145
 		//$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
124 146
 		if ($tracker) {
125 147
 			$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter);
126
-		}
127
-		elseif ($marine) {
148
+		} elseif ($marine) {
128 149
 			$spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter);
129
-		}
130
-		else {
150
+		} else {
131 151
 			$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter,$part);
132 152
 		}
133 153
 	}
@@ -136,8 +156,12 @@  discard block
 block discarded – undo
136 156
 if (!empty($spotter_array)) {
137 157
 	//$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
138 158
 	$flightcnt = 0;
139
-	if ($flightcnt == '') $flightcnt = 0;
140
-} else $flightcnt = 0;
159
+	if ($flightcnt == '') {
160
+		$flightcnt = 0;
161
+	}
162
+	} else {
163
+	$flightcnt = 0;
164
+}
141 165
 
142 166
 $sqltime = round(microtime(true)-$begintime,2);
143 167
 
@@ -147,8 +171,11 @@  discard block
 block discarded – undo
147 171
 $aircrafts_shadow = array();
148 172
 $output = '{';
149 173
 $output .= '"type": "FeatureCollection",';
150
-if ($min) $output .= '"minimal": "true",';
151
-else $output .= '"minimal": "false",';
174
+if ($min) {
175
+	$output .= '"minimal": "true",';
176
+} else {
177
+	$output .= '"minimal": "false",';
178
+}
152 179
 $output .= '"fc": "'.$flightcnt.'",';
153 180
 $output .= '"sqt": "'.$sqltime.'",';
154 181
 $begin = true;
@@ -161,15 +188,17 @@  discard block
 block discarded – undo
161 188
 			if ($pfi != $spotter_item['famtrackid']) {
162 189
 				$pfi = $spotter_item['famtrackid'];
163 190
 				$begin = true;
164
-			} else $spotter_history_array = 0;
165
-		}
166
-		elseif ($marine) {
191
+			} else {
192
+				$spotter_history_array = 0;
193
+			}
194
+		} elseif ($marine) {
167 195
 			if ($pfi != $spotter_item['fammarine_d']) {
168 196
 				$pfi = $spotter_item['fammarine_id'];
169 197
 				$begin = true;
170
-			} else $spotter_history_array = 0;
171
-		}
172
-		else {
198
+			} else {
199
+				$spotter_history_array = 0;
200
+			}
201
+		} else {
173 202
 			if ($pfi != $spotter_item['flightaware_id']) {
174 203
 				$pfi = $spotter_item['flightaware_id'];
175 204
 				$begin = true;
@@ -206,7 +235,9 @@  discard block
 block discarded – undo
206 235
 			$output_history .= '['.$spotter_item['longitude'].', '.$spotter_item['latitude'].'],';
207 236
 			$output_time .= (strtotime($spotter_item['date'])*1000).',';
208 237
 			$previousts = strtotime($spotter_item['date']);
209
-			if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) $end = true;
238
+			if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) {
239
+				$end = true;
240
+			}
210 241
 		}
211 242
 
212 243
 		if ($begin) {
@@ -216,7 +247,9 @@  discard block
 block discarded – undo
216 247
 			$output .= '"type": "Feature",';
217 248
 			$output .= '"properties": {';
218 249
 			$output .= '"fi": "'.$pfi.'",';
219
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
250
+			if (isset($begindate)) {
251
+				$output .= '"archive_date": "'.$begindate.'",';
252
+			}
220 253
 			if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
221 254
 				$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
222 255
 				//"
@@ -224,14 +257,20 @@  discard block
 block discarded – undo
224 257
 				$output .= '"c": "NA",';
225 258
 			}
226 259
 			if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) {
227
-				if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
228
-				else {
260
+				if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
261
+					$spotter_item['aircraft_shadow'] = '';
262
+				} else {
229 263
 					$aircraft_icao = $spotter_item['aircraft_icao'];
230 264
 					$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
231
-					if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
232
-					elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
233
-					elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
234
-					else $spotter_item['aircraft_shadow'] = '';
265
+					if (count($aircraft_info) > 0) {
266
+						$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
267
+					} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
268
+						$spotter_item['aircraft_shadow'] = 'PA18.png';
269
+					} elseif ($aircraft_icao == 'PARAGLIDER') {
270
+						$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
271
+					} else {
272
+						$spotter_item['aircraft_shadow'] = '';
273
+					}
235 274
 					$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
236 275
 				}
237 276
 			}
@@ -239,93 +278,139 @@  discard block
 block discarded – undo
239 278
 			if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
240 279
 				if ($tracker) {
241 280
 					if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
242
-						if ($compress) $output .= '"as": "ambulance.png",';
243
-						else $output .= '"aircraft_shadow": "ambulance.png",';
244
-					}
245
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
246
-						if ($compress) $output .= '"as": "police.png",';
247
-						else $output .= '"aircraft_shadow": "police.png",';
248
-					}
249
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
250
-						if ($compress) $output .= '"as": "ship.png",';
251
-						else $output .= '"aircraft_shadow": "ship.png",';
252
-					}
253
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
254
-						if ($compress) $output .= '"as": "ship.png",';
255
-						else $output .= '"aircraft_shadow": "ship.png",';
256
-					}
257
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
258
-						if ($compress) $output .= '"as": "ship.png",';
259
-						else $output .= '"aircraft_shadow": "ship.png",';
281
+						if ($compress) {
282
+							$output .= '"as": "ambulance.png",';
283
+						} else {
284
+							$output .= '"aircraft_shadow": "ambulance.png",';
285
+						}
286
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
287
+						if ($compress) {
288
+							$output .= '"as": "police.png",';
289
+						} else {
290
+							$output .= '"aircraft_shadow": "police.png",';
291
+						}
292
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
293
+						if ($compress) {
294
+							$output .= '"as": "ship.png",';
295
+						} else {
296
+							$output .= '"aircraft_shadow": "ship.png",';
297
+						}
298
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
299
+						if ($compress) {
300
+							$output .= '"as": "ship.png",';
301
+						} else {
302
+							$output .= '"aircraft_shadow": "ship.png",';
303
+						}
304
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
305
+						if ($compress) {
306
+							$output .= '"as": "ship.png",';
307
+						} else {
308
+							$output .= '"aircraft_shadow": "ship.png",';
309
+						}
310
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
311
+						if ($compress) {
312
+							$output .= '"as": "truck.png",';
313
+						} else {
314
+							$output .= '"aircraft_shadow": "truck.png",';
315
+						}
316
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
317
+						if ($compress) {
318
+							$output .= '"as": "truck.png",';
319
+						} else {
320
+							$output .= '"aircraft_shadow": "truck.png",';
321
+						}
322
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
323
+						if ($compress) {
324
+							$output .= '"as": "aircraft.png",';
325
+						} else {
326
+							$output .= '"aircraft_shadow": "aircraft.png",';
327
+						}
328
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
329
+						if ($compress) {
330
+							$output .= '"as": "aircraft.png",';
331
+						} else {
332
+							$output .= '"aircraft_shadow": "aircraft.png",';
333
+						}
334
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
335
+						if ($compress) {
336
+							$output .= '"as": "helico.png",';
337
+						} else {
338
+							$output .= '"aircraft_shadow": "helico.png",';
339
+						}
340
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
341
+						if ($compress) {
342
+							$output .= '"as": "rail.png",';
343
+						} else {
344
+							$output .= '"aircraft_shadow": "rail.png",';
345
+						}
346
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
347
+						if ($compress) {
348
+							$output .= '"as": "firetruck.png",';
349
+						} else {
350
+							$output .= '"aircraft_shadow": "firetruck.png",';
351
+						}
352
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
353
+						if ($compress) {
354
+							$output .= '"as": "bus.png",';
355
+						} else {
356
+							$output .= '"aircraft_shadow": "bus.png",';
357
+						}
358
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
359
+						if ($compress) {
360
+							$output .= '"as": "phone.png",';
361
+						} else {
362
+							$output .= '"aircraft_shadow": "phone.png",';
363
+						}
364
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
365
+						if ($compress) {
366
+							$output .= '"as": "jogger.png",';
367
+						} else {
368
+							$output .= '"aircraft_shadow": "jogger.png",';
369
+						}
370
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
371
+						if ($compress) {
372
+							$output .= '"as": "bike.png",';
373
+						} else {
374
+							$output .= '"aircraft_shadow": "bike.png",';
375
+						}
376
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
377
+						if ($compress) {
378
+							$output .= '"as": "motorcycle.png",';
379
+						} else {
380
+							$output .= '"aircraft_shadow": "motorcycle.png",';
381
+						}
382
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
383
+						if ($compress) {
384
+							$output .= '"as": "balloon.png",';
385
+						} else {
386
+							$output .= '"aircraft_shadow": "balloon.png",';
387
+						}
388
+					} else {
389
+						if ($compress) {
390
+							$output .= '"as": "car.png",';
391
+						} else {
392
+							$output .= '"aircraft_shadow": "car.png",';
393
+						}
260 394
 					}
261
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
262
-						if ($compress) $output .= '"as": "truck.png",';
263
-						else $output .= '"aircraft_shadow": "truck.png",';
395
+				} elseif ($marine) {
396
+					if ($compress) {
397
+						$output .= '"as": "ship.png",';
398
+					} else {
399
+						$output .= '"aircraft_shadow": "ship.png",';
264 400
 					}
265
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
266
-						if ($compress) $output .= '"as": "truck.png",';
267
-						else $output .= '"aircraft_shadow": "truck.png",';
268
-					}
269
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
270
-						if ($compress) $output .= '"as": "aircraft.png",';
271
-						else $output .= '"aircraft_shadow": "aircraft.png",';
272
-					}
273
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
274
-						if ($compress) $output .= '"as": "aircraft.png",';
275
-						else $output .= '"aircraft_shadow": "aircraft.png",';
276
-					}
277
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
278
-						if ($compress) $output .= '"as": "helico.png",';
279
-						else $output .= '"aircraft_shadow": "helico.png",';
280
-					}
281
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
282
-						if ($compress) $output .= '"as": "rail.png",';
283
-						else $output .= '"aircraft_shadow": "rail.png",';
284
-					}
285
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
286
-						if ($compress) $output .= '"as": "firetruck.png",';
287
-						else $output .= '"aircraft_shadow": "firetruck.png",';
288
-					}
289
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
290
-						if ($compress) $output .= '"as": "bus.png",';
291
-						else $output .= '"aircraft_shadow": "bus.png",';
292
-					}
293
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
294
-						if ($compress) $output .= '"as": "phone.png",';
295
-						else $output .= '"aircraft_shadow": "phone.png",';
296
-					}
297
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
298
-						if ($compress) $output .= '"as": "jogger.png",';
299
-						else $output .= '"aircraft_shadow": "jogger.png",';
300
-					}
301
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
302
-						if ($compress) $output .= '"as": "bike.png",';
303
-						else $output .= '"aircraft_shadow": "bike.png",';
304
-					}
305
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
306
-						if ($compress) $output .= '"as": "motorcycle.png",';
307
-						else $output .= '"aircraft_shadow": "motorcycle.png",';
308
-					}
309
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
310
-						if ($compress) $output .= '"as": "balloon.png",';
311
-						else $output .= '"aircraft_shadow": "balloon.png",';
312
-					}
313
-					else {
314
-						if ($compress) $output .= '"as": "car.png",';
315
-						else $output .= '"aircraft_shadow": "car.png",';
401
+				} else {
402
+					if ($compress) {
403
+						$output .= '"as": "default.png",';
404
+					} else {
405
+						$output .= '"aircraft_shadow": "default.png",';
316 406
 					}
317 407
 				}
318
-				elseif ($marine) {
319
-					if ($compress) $output .= '"as": "ship.png",';
320
-					else $output .= '"aircraft_shadow": "ship.png",';
321
-				}
322
-				else {
323
-					if ($compress) $output .= '"as": "default.png",';
324
-					else $output .= '"aircraft_shadow": "default.png",';
325
-				}
326 408
 			} else {
327
-				if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
328
-				else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
409
+				if ($compress) {
410
+					$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
411
+				} else {
412
+					$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
413
+				}
329 414
 			}
330 415
 
331 416
 			if (isset($spotter_item['date_iso_8601'])) {
@@ -373,7 +458,9 @@  discard block
 block discarded – undo
373 458
 	$output .= ']';
374 459
 	$output .= ',"initial_sqltime": "'.$sqltime.'",';
375 460
 	$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
376
-	if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
461
+	if (isset($begindate)) {
462
+		$output .= '"archive_date": "'.$begindate.'",';
463
+	}
377 464
 	$output .= '"fc": "'.$flightcnt.'"';
378 465
 } else {
379 466
 	$output .= '"features": ';
Please login to merge, or discard this patch.
ident-detailed.php 1 patch
Braces   +25 added lines, -9 removed lines patch added patch discarded remove patch
@@ -123,15 +123,21 @@  discard block
 block discarded – undo
123 123
 	{
124 124
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']);
125 125
 		$ident = $spotter_array[0]['ident'];
126
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
127
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
126
+		if (isset($spotter_array[0]['latitude'])) {
127
+			$latitude = $spotter_array[0]['latitude'];
128
+		}
129
+		if (isset($spotter_array[0]['longitude'])) {
130
+			$longitude = $spotter_array[0]['longitude'];
131
+		}
128 132
 		require_once('header.php');
129 133
 		if (isset($globalArchive) && $globalArchive && $type == 'aircraft') {
130 134
 			// Requirement for altitude graph
131 135
 			$all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']);
132 136
 			if (isset($globalTimezone)) {
133 137
 				date_default_timezone_set($globalTimezone);
134
-			} else date_default_timezone_set('UTC');
138
+			} else {
139
+				date_default_timezone_set('UTC');
140
+			}
135 141
 			if (is_array($all_data) && count($all_data) > 1) {
136 142
 				print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
137 143
 				print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
@@ -205,18 +211,28 @@  discard block
 block discarded – undo
205 211
 		print '<br/><br/><br/>';
206 212
 		print '<h1>'.$spotter_array[0]['ident'].'</h1>';
207 213
 		print '<div><span class="label">'._("Ident").'</span>'.$spotter_array[0]['ident'].'</div>';
208
-		if (isset($spotter_array[0]['blocked']) && $spotter_array[0]['blocked'] === true) print '<div>'._("Callsign is in blocked FAA list").'</div>';
214
+		if (isset($spotter_array[0]['blocked']) && $spotter_array[0]['blocked'] === true) {
215
+			print '<div>'._("Callsign is in blocked FAA list").'</div>';
216
+		}
209 217
 		if (isset($spotter_array[0]['airline_icao'])) {
210 218
 			print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>'; 
211 219
 		}
212
-		if ($type == 'aircraft') print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>';
220
+		if ($type == 'aircraft') {
221
+			print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>';
222
+		}
213 223
 		print '</div>';
214 224
 	
215
-		if ($type == 'aircraft') include('ident-sub-menu.php');
225
+		if ($type == 'aircraft') {
226
+			include('ident-sub-menu.php');
227
+		}
216 228
 		print '<div class="table column">';
217
-		if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
218
-		elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
219
-		elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
229
+		if ($type == 'aircraft') {
230
+			print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
231
+		} elseif ($type == 'marine') {
232
+			print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
233
+		} elseif ($type == 'tracker') {
234
+			print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
235
+		}
220 236
 
221 237
 		include('table-output.php'); 
222 238
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
js/map-aircraft.2d.js.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 if (!isset($globalJsonCompress)) $compress = true;
7 7
 else $compress = $globalJsonCompress;
8 8
 
9
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
10
-if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
9
+if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
10
+if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
11 11
 ?>
12 12
 <?php
13 13
 if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			if (typeof props != 'undefined') {
227 227
 				var thedate = new Date(props);
228 228
 				$("#thedate").html(thedate.toUTCString());
229
-			//	$("#archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>');
229
+			//	$("#archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>');
230 230
 			}
231 231
 		}
232 232
 	}
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 <?php
374 374
 		} else {
375 375
 ?>
376
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
376
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
377 377
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
378 378
 <?php
379 379
 		}
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 							/*
391 391
 							shadowUrl: iconURLShadowpath,
392 392
 							shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
393
-							shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
393
+							shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
394 394
 							*/
395 395
 						})
396 396
 					})
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 <?php
425 425
 		} else {
426 426
 ?>
427
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
427
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
428 428
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
429 429
 <?php
430 430
 		}
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 <?php
473 473
 		} else {
474 474
 ?>
475
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
475
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
476 476
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
477 477
 <?php
478 478
 		}
Please login to merge, or discard this patch.
Braces   +60 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,16 +3,27 @@  discard block
 block discarded – undo
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5 5
 // Compressed GeoJson is used if true
6
-if (!isset($globalJsonCompress)) $compress = true;
7
-else $compress = $globalJsonCompress;
6
+if (!isset($globalJsonCompress)) {
7
+	$compress = true;
8
+} else {
9
+	$compress = $globalJsonCompress;
10
+}
8 11
 
9
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
10
-if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
12
+if (isset($_GET['ident'])) {
13
+	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+}
15
+if (isset($_GET['flightaware_id'])) {
16
+	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
17
+}
11 18
 ?>
12 19
 <?php
13
-if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
14
-elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor;
15
-else $IconColor = '1a3151';
20
+if (isset($_COOKIE['IconColor'])) {
21
+	$IconColor = $_COOKIE['IconColor'];
22
+} elseif (isset($globalAircraftIconColor)) {
23
+	$IconColor = $globalAircraftIconColor;
24
+} else {
25
+	$IconColor = '1a3151';
26
+}
16 27
 ?>
17 28
 <?php
18 29
 if (isset($globalDebug) && $globalDebug === TRUE) {
@@ -90,9 +101,12 @@  discard block
 block discarded – undo
90 101
 
91 102
 function update_airportsLayer() {
92 103
 <?php
93
-	if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom'];
94
-	else $getZoom = '7';
95
-?>
104
+	if (isset($_COOKIE['AirportZoom'])) {
105
+		$getZoom = $_COOKIE['AirportZoom'];
106
+	} else {
107
+		$getZoom = '7';
108
+	}
109
+	?>
96 110
 	if (typeof airportsLayer != 'undefined') {
97 111
 		if (map.hasLayer(airportsLayer) == true) {
98 112
 			map.removeLayer(airportsLayer);
@@ -373,7 +387,12 @@  discard block
 block discarded – undo
373 387
 <?php
374 388
 		} else {
375 389
 ?>
376
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
390
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
391
+	print $archiveupdatetime*1000;
392
+} else {
393
+	print $globalMapRefresh*1000+20000;
394
+}
395
+?>+feature.properties.sqt*1000);
377 396
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
378 397
 <?php
379 398
 		}
@@ -424,7 +443,12 @@  discard block
 block discarded – undo
424 443
 <?php
425 444
 		} else {
426 445
 ?>
427
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
446
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
447
+	print $archiveupdatetime*1000;
448
+} else {
449
+	print $globalMapRefresh*1000+20000;
450
+}
451
+?>+feature.properties.sqt*1000);
428 452
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
429 453
 <?php
430 454
 		}
@@ -472,7 +496,12 @@  discard block
 block discarded – undo
472 496
 <?php
473 497
 		} else {
474 498
 ?>
475
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
499
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
500
+	print $archiveupdatetime*1000;
501
+} else {
502
+	print $globalMapRefresh*1000+20000;
503
+}
504
+?>+feature.properties.sqt*1000);
476 505
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
477 506
 <?php
478 507
 		}
@@ -975,7 +1004,12 @@  discard block
 block discarded – undo
975 1004
 		update_archiveLayer(0);
976 1005
 	} else {
977 1006
 		//then load it again every 30 seconds
978
-		reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
1007
+		reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
1008
+	print $globalMapRefresh*1000;
1009
+} else {
1010
+	print '30000';
1011
+}
1012
+?>);
979 1013
 		var currentdate = new Date();
980 1014
 		var currentyear = new Date().getFullYear();
981 1015
 		var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0));
@@ -987,7 +1021,12 @@  discard block
 block discarded – undo
987 1021
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
988 1022
 ?>
989 1023
 		update_polarLayer();
990
-		setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
1024
+		setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) {
1025
+	print $globalMapRefresh*1000*2;
1026
+} else {
1027
+	print '60000';
1028
+}
1029
+?>);
991 1030
 <?php
992 1031
 		}
993 1032
 ?>
@@ -1000,7 +1039,12 @@  discard block
 block discarded – undo
1000 1039
 	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
1001 1040
 ?>
1002 1041
 	update_atcLayer();
1003
-	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
1042
+	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) {
1043
+	print $globalMapRefresh*1000*2;
1044
+} else {
1045
+	print '60000';
1046
+}
1047
+?>);
1004 1048
 <?php
1005 1049
 	}
1006 1050
 ?>
Please login to merge, or discard this patch.
js/map-tracker.2d.js.php 1 patch
Braces   +39 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,10 +5,15 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
10 13
 $archive = false;
11
-if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') $archive = true;
14
+if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
15
+	$archive = true;
16
+}
12 17
 ?>
13 18
 
14 19
 
@@ -166,9 +171,13 @@  discard block
 block discarded – undo
166 171
 		    if (callsign != ""){ markerTrackerLabel += callsign; }
167 172
 		    if (type != ""){ markerTrackerLabel += ' - '+type; }
168 173
 <?php
169
-	if (isset($_COOKIE['TrackerIconColor'])) $IconColor = $_COOKIE['TrackerIconColor'];
170
-	elseif (isset($globalTrackerIconColor)) $IconColor = $globalTrackerIconColor;
171
-	else $IconColor = '1a3151';
174
+	if (isset($_COOKIE['TrackerIconColor'])) {
175
+		$IconColor = $_COOKIE['TrackerIconColor'];
176
+	} elseif (isset($globalTrackerIconColor)) {
177
+		$IconColor = $globalTrackerIconColor;
178
+	} else {
179
+		$IconColor = '1a3151';
180
+	}
172 181
 	if (!isset($ident) && !isset($famtrackid)) {
173 182
 ?>
174 183
 		    //info_tracker_update(feature.properties.fc);
@@ -202,7 +211,12 @@  discard block
 block discarded – undo
202 211
 <?php
203 212
 		} else {
204 213
 ?>
205
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
214
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
215
+	print $archiveupdatetime*1000;
216
+} else {
217
+	print $globalMapRefresh*1000+20000;
218
+}
219
+?>+feature.properties.sqt*1000);
206 220
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
207 221
 <?php
208 222
 		}
@@ -259,7 +273,12 @@  discard block
 block discarded – undo
259 273
 <?php
260 274
 		} else {
261 275
 ?>
262
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
276
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
277
+	print $archiveupdatetime*1000;
278
+} else {
279
+	print $globalMapRefresh*1000+20000;
280
+}
281
+?>+feature.properties.sqt*1000);
263 282
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
264 283
 <?php
265 284
 		}
@@ -315,7 +334,12 @@  discard block
 block discarded – undo
315 334
 <?php
316 335
 		} else {
317 336
 ?>
318
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
337
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
338
+	print $archiveupdatetime*1000;
339
+} else {
340
+	print $globalMapRefresh*1000+20000;
341
+}
342
+?>+feature.properties.sqt*1000);
319 343
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
320 344
 <?php
321 345
 		}
@@ -762,7 +786,12 @@  discard block
 block discarded – undo
762 786
 getLiveTrackerData(0);
763 787
 //then load it again every 30 seconds
764 788
 reloadTrackerPage = setInterval(
765
-    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
789
+    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) {
790
+	print $globalMapRefresh*1000;
791
+} else {
792
+	print '30000';
793
+}
794
+?>);
766 795
 <?php
767 796
 	}
768 797
 ?>
Please login to merge, or discard this patch.
js/map-marine.2d.js.php 1 patch
Braces   +36 added lines, -9 removed lines patch added patch discarded remove patch
@@ -5,11 +5,18 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
10
-if (isset($_COOKIE['MarineIconColor'])) $MarineIconColor = $_COOKIE['MarineIconColor'];
11
-elseif (isset($globalMarineIconColor)) $MarineIconColor = $globalMarineIconColor;
12
-else $MarineIconColor = '1a3151';
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
13
+if (isset($_COOKIE['MarineIconColor'])) {
14
+	$MarineIconColor = $_COOKIE['MarineIconColor'];
15
+} elseif (isset($globalMarineIconColor)) {
16
+	$MarineIconColor = $globalMarineIconColor;
17
+} else {
18
+	$MarineIconColor = '1a3151';
19
+}
13 20
 
14 21
 ?>
15 22
 
@@ -175,7 +182,12 @@  discard block
 block discarded – undo
175 182
 <?php
176 183
 		} else {
177 184
 ?>
178
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
185
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
186
+	print $archiveupdatetime*1000;
187
+} else {
188
+	print $globalMapRefresh*1000+20000;
189
+}
190
+?>+feature.properties.sqt*1000);
179 191
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
180 192
 <?php
181 193
 		}
@@ -232,7 +244,12 @@  discard block
 block discarded – undo
232 244
 <?php
233 245
 		} else {
234 246
 ?>
235
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
247
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
248
+	print $archiveupdatetime*1000;
249
+} else {
250
+	print $globalMapRefresh*1000+20000;
251
+}
252
+?>+feature.properties.sqt*1000);
236 253
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
237 254
 <?php
238 255
 		}
@@ -288,7 +305,12 @@  discard block
 block discarded – undo
288 305
 <?php
289 306
 		} else {
290 307
 ?>
291
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
308
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
309
+	print $archiveupdatetime*1000;
310
+} else {
311
+	print $globalMapRefresh*1000+20000;
312
+}
313
+?>+feature.properties.sqt*1000);
292 314
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
293 315
 <?php
294 316
 		}
@@ -696,7 +718,12 @@  discard block
 block discarded – undo
696 718
 } else {
697 719
 	//then load it again every 30 seconds
698 720
 	reloadMarinePage = setInterval(
699
-	function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
721
+	function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
722
+	print $globalMapRefresh*1000;
723
+} else {
724
+	print '30000';
725
+}
726
+?>);
700 727
 }
701 728
 
702 729
 function MarineiconColor(color) {
Please login to merge, or discard this patch.
js/map.2d.js.php 1 patch
Braces   +122 added lines, -28 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
 
12 17
 /*
13 18
 if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
@@ -97,7 +102,17 @@  discard block
 block discarded – undo
97 102
 	}
98 103
 
99 104
 	//create the map
100
-	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);
105
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
106
+	print $latitude;
107
+} else {
108
+	print $globalCenterLatitude;
109
+}
110
+?>,<?php if (isset($longitude)) {
111
+	print $longitude;
112
+} else {
113
+	print $globalCenterLongitude;
114
+}
115
+?>], zoom);
101 116
 <?php
102 117
 	} else {
103 118
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
@@ -123,9 +138,21 @@  discard block
 block discarded – undo
123 138
 	     || navigator.userAgent.match(/BlackBerry/i)
124 139
 	     || navigator.userAgent.match(/Windows Phone/i))
125 140
 	{
126
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
141
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) {
142
+	print $viewzoom-1;
143
+} elseif (isset($viewzoom)) {
144
+	print $viewzoom;
145
+} else {
146
+	print '8';
147
+}
148
+?>;
127 149
 	} else {
128
-		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
150
+		var zoom = <?php if (isset($viewzoom)) {
151
+	print $viewzoom;
152
+} else {
153
+	print '9';
154
+}
155
+?>;
129 156
 	}
130 157
 
131 158
 	//create the map
@@ -151,16 +178,27 @@  discard block
 block discarded – undo
151 178
 	bounds = L.latLngBounds(southWest,northEast);
152 179
 	//a few title layers
153 180
 <?php
154
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
155
-	else $MapType = $globalMapProvider;
181
+	if (isset($_COOKIE['MapType'])) {
182
+		$MapType = $_COOKIE['MapType'];
183
+	} else {
184
+		$MapType = $globalMapProvider;
185
+	}
156 186
 
157 187
 	if ($MapType == 'Mapbox') {
158
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
159
-		else $MapBoxId = $_COOKIE['MapTypeId'];
160
-?>
188
+		if ($_COOKIE['MapTypeId'] == 'default') {
189
+			$MapBoxId = $globalMapboxId;
190
+		} else {
191
+			$MapBoxId = $_COOKIE['MapTypeId'];
192
+		}
193
+		?>
161 194
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
162 195
 	    maxZoom: 18,
163
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
196
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
197
+	print 'false';
198
+} else {
199
+	print 'true';
200
+}
201
+?>,
164 202
 	    attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
165 203
 	    id: '<?php print $MapBoxId; ?>',
166 204
 	    token: '<?php print $globalMapboxToken; ?>'
@@ -179,7 +217,12 @@  discard block
 block discarded – undo
179 217
 ?>
180 218
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
181 219
 	    maxZoom: 18,
182
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
220
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
221
+	print 'false';
222
+} else {
223
+	print 'true';
224
+}
225
+?>,
183 226
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
184 227
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
185 228
 	}).addTo(map);
@@ -188,7 +231,12 @@  discard block
 block discarded – undo
188 231
 ?>
189 232
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
190 233
 	    maxZoom: 18,
191
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
234
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
235
+	print 'false';
236
+} else {
237
+	print 'true';
238
+}
239
+?>,
192 240
 	    attribution: 'Tiles &copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
193 241
 	}).addTo(map);
194 242
 <?php
@@ -196,7 +244,12 @@  discard block
 block discarded – undo
196 244
 ?>
197 245
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
198 246
 	    maxZoom: 18,
199
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
247
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
248
+	print 'false';
249
+} else {
250
+	print 'true';
251
+}
252
+?>,
200 253
 	    attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
201 254
 	}).addTo(map);
202 255
 <?php
@@ -204,7 +257,12 @@  discard block
 block discarded – undo
204 257
 ?>
205 258
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', {
206 259
 	    maxZoom: 18,
207
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
260
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
261
+	print 'false';
262
+} else {
263
+	print 'true';
264
+}
265
+?>,
208 266
 	    attribution: 'Tiles &copy; Esri &mdash; National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
209 267
 	}).addTo(map);
210 268
 <?php
@@ -249,20 +307,26 @@  discard block
 block discarded – undo
249 307
 	map.addLayer(yandexLayer);
250 308
 <?php
251 309
 	} elseif ($MapType == 'Bing-Aerial') {
252
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
253
-?>
310
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
311
+			setcookie('MapType','OpenStreetMap');
312
+		}
313
+		?>
254 314
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
255 315
 	map.addLayer(bingLayer);
256 316
 <?php
257 317
 	} elseif ($MapType == 'Bing-Hybrid') {
258
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
259
-?>
318
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
319
+			setcookie('MapType','OpenStreetMap');
320
+		}
321
+		?>
260 322
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
261 323
 	map.addLayer(bingLayer);
262 324
 <?php
263 325
 	} elseif ($MapType == 'Bing-Road') {
264
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
265
-?>
326
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
327
+			setcookie('MapType','OpenStreetMap');
328
+		}
329
+		?>
266 330
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
267 331
 	map.addLayer(bingLayer);
268 332
 <?php
@@ -291,7 +355,12 @@  discard block
 block discarded – undo
291 355
 	    maxZoom: 5,
292 356
 	    tms : true,
293 357
 	    zindex : 3,
294
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
358
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
359
+	print 'false';
360
+} else {
361
+	print 'true';
362
+}
363
+?>,
295 364
 	    attribution: 'Natural Earth'
296 365
 	}).addTo(map);
297 366
 <?php
@@ -299,9 +368,24 @@  discard block
 block discarded – undo
299 368
 		$customid = $MapType;
300 369
 ?>
301 370
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
302
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
303
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
304
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
371
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
372
+	print $globalMapCustomLayer[$customid]['maxZoom'];
373
+} else {
374
+	print '18';
375
+}
376
+?>,
377
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
378
+	print $globalMapCustomLayer[$customid]['minZoom'];
379
+} else {
380
+	print '0';
381
+}
382
+?>,
383
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
384
+	print 'false';
385
+} else {
386
+	print 'true';
387
+}
388
+?>,
305 389
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
306 390
 	}).addTo(map);
307 391
 
@@ -341,7 +425,12 @@  discard block
 block discarded – undo
341 425
 		}
342 426
 	} elseif ($globalBounding == 'circle') {
343 427
 ?>
344
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
428
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
429
+	print $globalBoundingCircleSize;
430
+} else {
431
+	print '70000';
432
+}
433
+?>,{
345 434
 	    color: '#92C7D1',
346 435
 	    fillColor: '#92C7D1',
347 436
 	    fillOpacity: 0.3,
@@ -431,7 +520,12 @@  discard block
 block discarded – undo
431 520
 	});
432 521
 	if (archive === false) {
433 522
 		update_locationsLayer();
434
-		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
523
+		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) {
524
+	print $globalMapRefresh*1000*2;
525
+} else {
526
+	print '60000';
527
+}
528
+?>);
435 529
 	}
436 530
 <?php
437 531
     // Add support for custom json via $globalMapJson
Please login to merge, or discard this patch.
live-czml.php 2 patches
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
     $s3 = sin($bank/2);
60 60
     $c1c2 = $c1*$c2;
61 61
     $s1s2 = $s1*$s2;
62
-    $w =$c1c2*$c3 - $s1s2*$s3;
63
-    $x =$c1c2*$s3 + $s1s2*$c3;
64
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
65
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
66
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
62
+    $w = $c1c2*$c3 - $s1s2*$s3;
63
+    $x = $c1c2*$s3 + $s1s2*$c3;
64
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
65
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
66
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
67 67
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
68 68
 
69 69
 }
@@ -84,17 +84,17 @@  discard block
 block discarded – undo
84 84
 $min = false;
85 85
 $allhistory = false;
86 86
 $filter['source'] = array();
87
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
88
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
89
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
90
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
91
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
92
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
93
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
94
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
95
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
96
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
97
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
87
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
88
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
89
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
90
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
91
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
92
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
93
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
94
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
95
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
96
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
97
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
98 98
 /*
99 99
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
100 100
 	$min = true;
@@ -141,17 +141,17 @@  discard block
 block discarded – undo
141 141
 	$from_archive = true;
142 142
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
143 143
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
144
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
145
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
146
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
147
-	$begindate = date('Y-m-d H:i:s',$begindate);
148
-	$enddate = date('Y-m-d H:i:s',$enddate);
144
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
145
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
146
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
147
+	$begindate = date('Y-m-d H:i:s', $begindate);
148
+	$enddate = date('Y-m-d H:i:s', $enddate);
149 149
 	if ($tracker) {
150
-		$spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate,$enddate,$filter);
150
+		$spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate, $enddate, $filter);
151 151
 	} elseif ($marine) {
152
-		$spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate,$enddate,$filter);
152
+		$spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate, $enddate, $filter);
153 153
 	} else {
154
-		$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
154
+		$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
155 155
 	}
156 156
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
157 157
 	$from_archive = true;
@@ -168,36 +168,36 @@  discard block
 block discarded – undo
168 168
 	}
169 169
 	$enddate = $_COOKIE['archive_end'];
170 170
 	$enddateinitial = $_COOKIE['archive_end'];
171
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
172
-	$begindate = date('Y-m-d H:i:s',$begindate);
173
-	$enddate = date('Y-m-d H:i:s',$enddate);
171
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
172
+	$begindate = date('Y-m-d H:i:s', $begindate);
173
+	$enddate = date('Y-m-d H:i:s', $enddate);
174 174
 	//echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
175 175
 	if ($tracker) {
176
-		$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter);
176
+		$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter);
177 177
 	} elseif ($marine) {
178
-		$spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter);
178
+		$spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter);
179 179
 	} else {
180
-		$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
180
+		$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
181 181
 	}
182 182
 } elseif ($tracker) {
183 183
 	$coord = array();
184 184
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
185
-		$coord = explode(',',$_GET['coord']);
186
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
185
+		$coord = explode(',', $_GET['coord']);
186
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
187 187
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
188 188
 			$coord = array();
189 189
 		}
190 190
 	}
191 191
 	$previous_filter = $filter;
192 192
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackTracker']) && $_COOKIE['MapTrackTracker'] != '')) {
193
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackTracker']));
194
-		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true);
193
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrackTracker']));
194
+		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true);
195 195
 	/*
196 196
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) {
197 197
 		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true,$_COOKIE['MapTrack']);
198 198
 	*/
199 199
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
200
-		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true);
200
+		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true);
201 201
 	} else {
202 202
 		$spotter_array = array();
203 203
 	}
@@ -205,22 +205,22 @@  discard block
 block discarded – undo
205 205
 } elseif ($marine) {
206 206
 	$coord = array();
207 207
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
208
-		$coord = explode(',',$_GET['coord']);
209
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
208
+		$coord = explode(',', $_GET['coord']);
209
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
210 210
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
211 211
 			$coord = array();
212 212
 		}
213 213
 	}
214 214
 	$previous_filter = $filter;
215 215
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) {
216
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine']));
217
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true);
216
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrackMarine']));
217
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true);
218 218
 	/*
219 219
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) {
220 220
 		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true,$_COOKIE['MapTrack']);
221 221
 	*/
222 222
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
223
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true);
223
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true);
224 224
 	} else {
225 225
 		$spotter_array = array();
226 226
 	}
@@ -228,20 +228,20 @@  discard block
 block discarded – undo
228 228
 } else {
229 229
 	$coord = array();
230 230
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
231
-		$coord = explode(',',$_GET['coord']);
232
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
231
+		$coord = explode(',', $_GET['coord']);
232
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
233 233
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
234 234
 			$coord = array();
235 235
 		}
236 236
 	}
237 237
 	$previous_filter = $filter;
238 238
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) {
239
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrack']));
240
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
239
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrack']));
240
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
241 241
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) {
242
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true,$_COOKIE['MapTrack']);
242
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true, $_COOKIE['MapTrack']);
243 243
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
244
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
244
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
245 245
 	} else {
246 246
 		$spotter_array = array();
247 247
 	}
@@ -251,19 +251,19 @@  discard block
 block discarded – undo
251 251
 if (!empty($spotter_array) && isset($coord)) {
252 252
 	if ($tracker) {
253 253
 		if (isset($_GET['archive'])) {
254
-			$flightcnt = $TrackerLive->getLiveTrackerCount($begindate,$enddate,$filter);
254
+			$flightcnt = $TrackerLive->getLiveTrackerCount($begindate, $enddate, $filter);
255 255
 		} else {
256 256
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
257 257
 		}
258 258
 	} elseif ($marine) {
259 259
 		if (isset($_GET['archive'])) {
260
-			$flightcnt = $MarineLive->getLiveMarineCount($begindate,$enddate,$filter);
260
+			$flightcnt = $MarineLive->getLiveMarineCount($begindate, $enddate, $filter);
261 261
 		} else {
262 262
 			$flightcnt = $MarineLive->getLiveMarineCount($filter);
263 263
 		}
264 264
 	} else {
265 265
 		if (isset($_GET['archive'])) {
266
-			$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
266
+			$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
267 267
 		} else {
268 268
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
269 269
 		}
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
 	if ($flightcnt == '') $flightcnt = 0;
272 272
 } else $flightcnt = 0;
273 273
 
274
-$sqltime = round(microtime(true)-$begintime,2);
274
+$sqltime = round(microtime(true) - $begintime, 2);
275 275
 $minitime = time();
276 276
 $minitracktime_begin = time();
277 277
 $minitracktime = $minitracktime_begin;
278 278
 $maxitime = 0;
279
-$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT);
279
+$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT);
280 280
 $modelsdb = array();
281 281
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
282
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
283
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
284
-			if (isset($row[1]) ){
282
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
283
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
284
+			if (isset($row[1])) {
285 285
 				$model = $row[0];
286 286
 				$modelsdb[$model] = $row[1];
287 287
 			}
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 }
292 292
 $modelsdb2 = array();
293 293
 if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) {
294
-	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) {
295
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
296
-			if (isset($row[1]) ){
294
+	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) {
295
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
296
+			if (isset($row[1])) {
297 297
 				$model = $row[0];
298 298
 				$glb = $row[1];
299 299
 				if (isset($row[2])) {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 if (!empty($spotter_array) && is_array($spotter_array))
340 340
 {
341 341
 	$nblatlong = 0;
342
-	foreach($spotter_array as $spotter_item)
342
+	foreach ($spotter_array as $spotter_item)
343 343
 	{
344 344
 		$j++;
345 345
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -393,13 +393,13 @@  discard block
 block discarded – undo
393 393
 			}
394 394
 			if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
395 395
 			if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",';
396
-			if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",';
396
+			if (isset($spotter_item['ident'])) $output .= '"ident": "'.$spotter_item['ident'].'",';
397 397
 			if ($tracker) {
398 398
 				if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",';
399
-				$output.= '"type": "tracker"';
399
+				$output .= '"type": "tracker"';
400 400
 			} elseif ($marine) {
401 401
 				if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",';
402
-				$output.= '"type": "marine"';
402
+				$output .= '"type": "marine"';
403 403
 			} else {
404 404
 				if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) {
405 405
 					$aircraft_icao = $spotter_item['aircraft_icao'];
@@ -413,14 +413,14 @@  discard block
 block discarded – undo
413 413
 						if (isset($airline_icao)) {
414 414
 							$imagefile = $aircraft_icao.'-'.$airline_icao.'.png';
415 415
 							if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) {
416
-								$output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
416
+								$output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
417 417
 							}
418 418
 						}
419 419
 					}
420 420
 					//if ($ident != '') $output.= '"ident": "'.$ident.'",';
421 421
 				}
422
-				$output.= '"gltf2": %gltf2%,';
423
-				$output.= '"type": "flight"';
422
+				$output .= '"gltf2": %gltf2%,';
423
+				$output .= '"type": "flight"';
424 424
 			}
425 425
 			$output .= '},';
426 426
 
@@ -791,8 +791,8 @@  discard block
 block discarded – undo
791 791
 					$output .= '},';
792 792
 				}
793 793
 			}
794
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
795
-			else $output = str_replace('%onground%','false',$output);
794
+			if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output);
795
+			else $output = str_replace('%onground%', 'false', $output);
796 796
 
797 797
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
798 798
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
809 809
 			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
810 810
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
811
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
811
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
812 812
 			$output .= $spotter_item['longitude'].', ';
813 813
 			$output .= $spotter_item['latitude'];
814 814
 			$prevlong = $spotter_item['longitude'];
@@ -836,8 +836,8 @@  discard block
 block discarded – undo
836 836
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
837 837
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
838 838
 		} else {
839
-			$nblatlong = $nblatlong+1;
840
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
839
+			$nblatlong = $nblatlong + 1;
840
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
841 841
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
842 842
 			if ($spotter_item['ground_speed'] == 0) {
843 843
 				$output .= $prevlong.', ';
@@ -878,26 +878,26 @@  discard block
 block discarded – undo
878 878
 $output .= ']';
879 879
 if (isset($globalArchive) && $globalArchive === TRUE) {
880 880
 	if (isset($begindateinitial)) {
881
-		$output = str_replace('%minitime%',date("c",$begindateinitial),$output);
882
-	} elseif ((time()-$globalLiveInterval) > $minitime) {
883
-		if (time()-$globalLiveInterval > $maxitime) {
884
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
881
+		$output = str_replace('%minitime%', date("c", $begindateinitial), $output);
882
+	} elseif ((time() - $globalLiveInterval) > $minitime) {
883
+		if (time() - $globalLiveInterval > $maxitime) {
884
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
885 885
 		} else {
886
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
886
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
887 887
 		}
888 888
 	}
889
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
889
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
890 890
 } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
891
-	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
891
+	$output = str_replace('%minitime%', date("c", $minitracktime), $output);
892 892
 } else {
893
-	$output = str_replace('%minitime%',date("c",$minitime),$output);
893
+	$output = str_replace('%minitime%', date("c", $minitime), $output);
894 894
 }
895 895
 if (isset($enddateinitial)) {
896
-	$output = str_replace('%maxitime%',date("c",$enddateinitial),$output);
896
+	$output = str_replace('%maxitime%', date("c", $enddateinitial), $output);
897 897
 } else {
898
-	$output = str_replace('%maxitime%',date("c",$maxitime),$output);
898
+	$output = str_replace('%maxitime%', date("c", $maxitime), $output);
899 899
 }
900
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
901
-else $output = str_replace('%gltf2%','false',$output);
900
+if ($gltf2) $output = str_replace('%gltf2%', 'true', $output);
901
+else $output = str_replace('%gltf2%', 'false', $output);
902 902
 print $output;
903 903
 ?>
Please login to merge, or discard this patch.
Braces   +132 added lines, -48 removed lines patch added patch discarded remove patch
@@ -19,8 +19,12 @@  discard block
 block discarded – undo
19 19
 }
20 20
 $tracker = false;
21 21
 $marine = false;
22
-if (isset($_GET['tracker'])) $tracker = true;
23
-if (isset($_GET['marine'])) $marine = true;
22
+if (isset($_GET['tracker'])) {
23
+	$tracker = true;
24
+}
25
+if (isset($_GET['marine'])) {
26
+	$marine = true;
27
+}
24 28
 if ($tracker) {
25 29
 	require_once('require/class.Tracker.php');
26 30
 	require_once('require/class.TrackerLive.php');
@@ -77,24 +81,49 @@  discard block
 block discarded – undo
77 81
 }
78 82
 header('Content-Type: text/javascript');
79 83
 
80
-if (!isset($globalJsonCompress)) $compress = true;
81
-else $compress = $globalJsonCompress;
84
+if (!isset($globalJsonCompress)) {
85
+	$compress = true;
86
+} else {
87
+	$compress = $globalJsonCompress;
88
+}
82 89
 
83 90
 $from_archive = false;
84 91
 $min = false;
85 92
 $allhistory = false;
86 93
 $filter['source'] = array();
87
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
88
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
89
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
90
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
91
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
92
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
93
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
94
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
95
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
96
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
97
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
94
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
95
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
96
+}
97
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
98
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
99
+}
100
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
101
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
102
+}
103
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
104
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
105
+}
106
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
107
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
108
+}
109
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
110
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
111
+}
112
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
113
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
114
+}
115
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
116
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
117
+}
118
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
119
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
120
+}
121
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
122
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
123
+}
124
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
125
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
126
+}
98 127
 /*
99 128
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
100 129
 	$min = true;
@@ -268,8 +297,12 @@  discard block
 block discarded – undo
268 297
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
269 298
 		}
270 299
 	}
271
-	if ($flightcnt == '') $flightcnt = 0;
272
-} else $flightcnt = 0;
300
+	if ($flightcnt == '') {
301
+		$flightcnt = 0;
302
+	}
303
+	} else {
304
+	$flightcnt = 0;
305
+}
273 306
 
274 307
 $sqltime = round(microtime(true)-$begintime,2);
275 308
 $minitime = time();
@@ -315,7 +348,9 @@  discard block
 block discarded – undo
315 348
 $gltf2 = false;
316 349
 $scale = 1.0;
317 350
 $minimumpixelsize = 20;
318
-if (isset($archivespeed)) $speed = $archivespeed;
351
+if (isset($archivespeed)) {
352
+	$speed = $archivespeed;
353
+}
319 354
 $output = '[';
320 355
 if ($tracker) {
321 356
 	$output .= '{"id" : "document", "name" : "tracker","version" : "1.0"';
@@ -351,9 +386,13 @@  discard block
 block discarded – undo
351 386
 			$image = "images/placeholder_thumb.png";
352 387
 		}
353 388
 
354
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
355
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
356
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
389
+                if (isset($spotter_item['flightaware_id'])) {
390
+                	$id = $spotter_item['flightaware_id'];
391
+                } elseif (isset($spotter_item['famtrackid'])) {
392
+                	$id = $spotter_item['famtrackid'];
393
+                } elseif (isset($spotter_item['fammarine_id'])) {
394
+                	$id = $spotter_item['fammarine_id'];
395
+                }
357 396
                 if ($prev_flightaware_id != $id) {
358 397
 			if ($prev_flightaware_id != '') {
359 398
 				/*
@@ -391,14 +430,24 @@  discard block
 block discarded – undo
391 430
 			if (isset($spotter_item['squawk'])) {
392 431
 				$output .= '"squawk": "'.$spotter_item['squawk'].'",';
393 432
 			}
394
-			if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
395
-			if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",';
396
-			if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",';
433
+			if (isset($spotter_item['registration'])) {
434
+				$output .= '"registration": "'.$spotter_item['registration'].'",';
435
+			}
436
+			if (isset($spotter_item['format_source'])) {
437
+				$output .= '"format": "'.$spotter_item['format_source'].'",';
438
+			}
439
+			if (isset($spotter_item['ident'])) {
440
+				$output.= '"ident": "'.$spotter_item['ident'].'",';
441
+			}
397 442
 			if ($tracker) {
398
-				if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",';
443
+				if (isset($spotter_item['type'])) {
444
+					$output .= '"tracker_type": "'.$spotter_item['type'].'",';
445
+				}
399 446
 				$output.= '"type": "tracker"';
400 447
 			} elseif ($marine) {
401
-				if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",';
448
+				if (isset($spotter_item['type'])) {
449
+					$output .= '"marine_type": "'.$spotter_item['type'].'",';
450
+				}
402 451
 				$output.= '"type": "marine"';
403 452
 			} else {
404 453
 				if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) {
@@ -449,7 +498,9 @@  discard block
 block discarded – undo
449 498
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
450 499
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
451 500
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
452
-						} else $aircraft_shadow = '';
501
+						} else {
502
+							$aircraft_shadow = '';
503
+						}
453 504
 	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
454 505
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
455 506
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
@@ -457,7 +508,9 @@  discard block
 block discarded – undo
457 508
 						}
458 509
 						$output .= '},';
459 510
 					}
460
-				} else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
511
+				} else {
512
+					$output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
513
+				}
461 514
 			} elseif ($one3dmodel) {
462 515
 				if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') {
463 516
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.'';
@@ -497,7 +550,9 @@  discard block
 block discarded – undo
497 550
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
498 551
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
499 552
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
500
-						} else $aircraft_shadow = '';
553
+						} else {
554
+							$aircraft_shadow = '';
555
+						}
501 556
 						if ($aircraft_shadow != '') {
502 557
 							if (isset($modelsdb2[$aircraft_shadow])) {
503 558
 								$output .= '"model": {"gltf" : "'.$globalURL.'/models/gltf2/'.$modelsdb2[$aircraft_shadow]['glb'].'","scale" : '.$scale.',"minimumPixelSize": '.$modelsdb2[$aircraft_shadow]['size'];
@@ -652,7 +707,9 @@  discard block
 block discarded – undo
652 707
 								}
653 708
 								$output .= '},';
654 709
 								//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
655
-								if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
710
+								if ($spotter_item['aircraft_icao'] != '') {
711
+									$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
712
+								}
656 713
 								$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
657 714
 							}
658 715
 						} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -674,7 +731,9 @@  discard block
 block discarded – undo
674 731
 							}
675 732
 							$output .= '},';
676 733
 							//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
677
-							if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
734
+							if ($spotter_item['aircraft_icao'] != '') {
735
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
736
+							}
678 737
 							$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
679 738
 						}
680 739
 					} else {
@@ -687,7 +746,9 @@  discard block
 block discarded – undo
687 746
 						}
688 747
 						$output .= '},';
689 748
 						//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
690
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
749
+						if ($spotter_item['aircraft_icao'] != '') {
750
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
751
+						}
691 752
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
692 753
 					}
693 754
 				} elseif ($tracker && isset($spotter_item['type'])) {
@@ -791,8 +852,11 @@  discard block
 block discarded – undo
791 852
 					$output .= '},';
792 853
 				}
793 854
 			}
794
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
795
-			else $output = str_replace('%onground%','false',$output);
855
+			if (isset($onground) && $onground) {
856
+				$output = str_replace('%onground%','true',$output);
857
+			} else {
858
+				$output = str_replace('%onground%','false',$output);
859
+			}
796 860
 
797 861
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
798 862
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -805,9 +869,15 @@  discard block
 block discarded – undo
805 869
 	//		$output .= '"interpolationDegree" : 5,';
806 870
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
807 871
 			$output .= '"cartographicDegrees": [';
808
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
809
-			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
810
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
872
+			if ($minitime > strtotime($spotter_item['date'])) {
873
+				$minitime = strtotime($spotter_item['date']);
874
+			}
875
+			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) {
876
+				$minitracktime = strtotime($spotter_item['date']);
877
+			}
878
+			if ($maxitime < strtotime($spotter_item['date'])) {
879
+				$maxitime = strtotime($spotter_item['date']);
880
+			}
811 881
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
812 882
 			$output .= $spotter_item['longitude'].', ';
813 883
 			$output .= $spotter_item['latitude'];
@@ -830,7 +900,9 @@  discard block
 block discarded – undo
830 900
 					$output .= ', '.round($spotter_item['altitude']*30.48);
831 901
 					$prevalt = round($spotter_item['altitude']*30.48);
832 902
 				}
833
-			} else $output .= ', 0';
903
+			} else {
904
+				$output .= ', 0';
905
+			}
834 906
 			//$orientation = '"orientation" : { ';
835 907
 			//$orientation .= '"unitQuaternion": [';
836 908
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
@@ -838,13 +910,18 @@  discard block
 block discarded – undo
838 910
 		} else {
839 911
 			$nblatlong = $nblatlong+1;
840 912
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
841
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
913
+			if ($maxitime < strtotime($spotter_item['date'])) {
914
+				$maxitime = strtotime($spotter_item['date']);
915
+			}
842 916
 			if ($spotter_item['ground_speed'] == 0) {
843 917
 				$output .= $prevlong.', ';
844 918
 				$output .= $prevlat;
845 919
 				//if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt;
846
-				if (!$marine) $output .= ', '.$prevalt;
847
-				else $output .= ', 0';
920
+				if (!$marine) {
921
+					$output .= ', '.$prevalt;
922
+				} else {
923
+					$output .= ', 0';
924
+				}
848 925
 			} else {
849 926
 				$output .= $spotter_item['longitude'].', ';
850 927
 				$output .= $spotter_item['latitude'];
@@ -857,14 +934,17 @@  discard block
 block discarded – undo
857 934
 							$output .= ', 0';
858 935
 						}
859 936
 					} else {
860
-						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048);
861
-						elseif ($tracker) {
937
+						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
938
+							$output .= ', '.round($spotter_item['real_altitude']*0.3048);
939
+						} elseif ($tracker) {
862 940
 							$output .= ', '.round($spotter_item['altitude']*0.3048);
863 941
 						} else {
864 942
 							$output .= ', '.round($spotter_item['altitude']*30.48);
865 943
 						}
866 944
 					}
867
-				} else $output .= ', 0';
945
+				} else {
946
+					$output .= ', 0';
947
+				}
868 948
 			}
869 949
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
870 950
 			//$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
@@ -885,9 +965,10 @@  discard block
 block discarded – undo
885 965
 		} else {
886 966
 			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
887 967
 		}
968
+	} else {
969
+		$output = str_replace('%minitime%',date("c",$minitime),$output);
888 970
 	}
889
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
890
-} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
971
+	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
891 972
 	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
892 973
 } else {
893 974
 	$output = str_replace('%minitime%',date("c",$minitime),$output);
@@ -897,7 +978,10 @@  discard block
 block discarded – undo
897 978
 } else {
898 979
 	$output = str_replace('%maxitime%',date("c",$maxitime),$output);
899 980
 }
900
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
901
-else $output = str_replace('%gltf2%','false',$output);
981
+if ($gltf2) {
982
+	$output = str_replace('%gltf2%','true',$output);
983
+} else {
984
+	$output = str_replace('%gltf2%','false',$output);
985
+}
902 986
 print $output;
903 987
 ?>
Please login to merge, or discard this patch.
require/class.SpotterLive.php 2 patches
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -17,62 +17,62 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30 30
 		if (isset($filter[0]['source'])) {
31
-			$filters = array_merge($filters,$filter);
31
+			$filters = array_merge($filters, $filter);
32 32
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
34 34
 		$filter_query_join = '';
35 35
 		$filter_query_where = '';
36
-		foreach($filters as $flt) {
36
+		foreach ($filters as $flt) {
37 37
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
38 38
 				if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') {
39 39
 					if (isset($flt['source'])) {
40
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
40
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
41 41
 					} else {
42
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
42
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
43 43
 					}
44 44
 				}
45 45
 			}
46 46
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
47 47
 				if (isset($flt['source'])) {
48
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
48
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
49 49
 				} else {
50
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
50
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
51 51
 				}
52 52
 			}
53 53
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
54 54
 				if (isset($flt['source'])) {
55
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
55
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
56 56
 				} else {
57
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
57
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
58 58
 				}
59 59
 			}
60 60
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
61 61
 				if (isset($flt['source'])) {
62
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
62
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
63 63
 				} else {
64
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
64
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
65 65
 				}
66 66
 			}
67 67
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
68 68
 				if (isset($flt['source'])) {
69
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
69
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
70 70
 				}
71 71
 			}
72 72
 		}
73 73
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
74 74
 			if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') {
75
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
75
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
76 76
 			}
77 77
 		}
78 78
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
83 83
 		}
84 84
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
85
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
85
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
86 86
 		}
87 87
 		if (isset($filter['source']) && !empty($filter['source'])) {
88 88
 			if (count($filter['source']) == 1) {
89 89
 				$filter_query_where .= " AND format_source = '".$filter['source'][0]."'";
90 90
 			} else {
91
-				$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
91
+				$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
92 92
 			}
93 93
 		}
94 94
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
122 122
 				}
123 123
 			}
124
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
124
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
125 125
 		}
126 126
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
127
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
127
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
128 128
 		}
129 129
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
130 130
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
131 131
 		if ($filter_query_where != '') {
132
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
132
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
133 133
 		}
134 134
 		$filter_query = $filter_query_join.$filter_query_where;
135 135
 		return $filter_query;
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 		if ($limit != '')
153 153
 		{
154 154
 			$limit_array = explode(',', $limit);
155
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
156
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
155
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
156
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
157 157
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
158 158
 			{
159 159
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		} else {
178 178
 			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query;
179 179
 		}
180
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
180
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
181 181
 
182 182
 		return $spotter_array;
183 183
 	}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	{
193 193
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
194 194
 		date_default_timezone_set('UTC');
195
-		$filter_query = $this->getFilter($filter,true,true);
195
+		$filter_query = $this->getFilter($filter, true, true);
196 196
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
197 197
 		if ($globalDBdriver == 'mysql') {
198 198
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		try {
216 216
 			$sth = $this->db->prepare($query);
217 217
 			$sth->execute();
218
-		} catch(PDOException $e) {
218
+		} catch (PDOException $e) {
219 219
 			echo $e->getMessage();
220 220
 			die;
221 221
 		}
@@ -229,20 +229,20 @@  discard block
 block discarded – undo
229 229
 	* @return Array the spotter information
230 230
 	*
231 231
 	*/
232
-	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '')
232
+	public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false, $id = '')
233 233
 	{
234 234
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
235 235
 		date_default_timezone_set('UTC');
236 236
 		$usecoord = false;
237 237
 		if (is_array($coord) && !empty($coord)) {
238
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
239
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
240
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
241
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
238
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
239
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
240
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
241
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
242 242
 			$usecoord = true;
243 243
 		}
244
-		$id = filter_var($id,FILTER_SANITIZE_STRING);
245
-		$filter_query = $this->getFilter($filter,true,true);
244
+		$id = filter_var($id, FILTER_SANITIZE_STRING);
245
+		$filter_query = $this->getFilter($filter, true, true);
246 246
 
247 247
 		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
248 248
 		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
255 255
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
256 256
 				*/
257
-				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
257
+				$query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
258 258
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
259 259
 				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
260 260
 				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 				ORDER BY flightaware_id, date";
269 269
 				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
270 270
 			} else {
271
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
271
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
272 272
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date ";
273 273
 				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
274 274
 				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
285 285
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
286 286
                                */
287
-				$query  = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
287
+				$query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
288 288
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
289 289
 				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
290 290
 				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		try {
312 312
 			$sth = $this->db->prepare($query);
313 313
 			$sth->execute($query_values);
314
-		} catch(PDOException $e) {
314
+		} catch (PDOException $e) {
315 315
 			echo $e->getMessage();
316 316
 			die;
317 317
 		}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	public function getLiveSpotterCount($filter = array())
329 329
 	{
330 330
 		global $globalDBdriver, $globalLiveInterval;
331
-		$filter_query = $this->getFilter($filter,true,true);
331
+		$filter_query = $this->getFilter($filter, true, true);
332 332
 
333 333
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
334 334
 		if ($globalDBdriver == 'mysql') {
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 		try {
342 342
 			$sth = $this->db->prepare($query);
343 343
 			$sth->execute();
344
-		} catch(PDOException $e) {
344
+		} catch (PDOException $e) {
345 345
 			echo $e->getMessage();
346 346
 			die;
347 347
 		}
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 		$filter_query = $this->getFilter($filter);
365 365
 
366 366
 		if (is_array($coord)) {
367
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
368
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
369
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
370
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
367
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
368
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
369
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
370
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
371 371
 		} else return array();
372 372
 		if ($globalDBdriver == 'mysql') {
373 373
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -390,23 +390,23 @@  discard block
 block discarded – undo
390 390
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
391 391
 		$Spotter = new Spotter($this->db);
392 392
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
393
-		$filter_query = $this->getFilter($filter,true,true);
393
+		$filter_query = $this->getFilter($filter, true, true);
394 394
 
395 395
 		if (is_array($coord)) {
396
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
397
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
398
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
399
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
396
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
397
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
398
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
399
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
400 400
 		} else return array();
401 401
 		if ($globalDBdriver == 'mysql') {
402 402
 			if (isset($globalArchive) && $globalArchive === TRUE) {
403
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
403
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
404 404
 				FROM spotter_live 
405 405
 				'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date 
406 406
 				AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
407 407
 				AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC';
408 408
 			} else {
409
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
409
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
410 410
 				FROM spotter_live 
411 411
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
412 412
 				    FROM spotter_live l 
@@ -418,14 +418,14 @@  discard block
 block discarded – undo
418 418
 			}
419 419
 		} else {
420 420
 			if (isset($globalArchive) && $globalArchive === TRUE) {
421
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
421
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
422 422
 				FROM spotter_live 
423 423
 				".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
424 424
 				AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
425 425
 				AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
426 426
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC";
427 427
 			} else {
428
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
428
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
429 429
 				FROM spotter_live 
430 430
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
431 431
 				    FROM spotter_live l 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 		try {
441 441
 			$sth = $this->db->prepare($query);
442 442
 			$sth->execute();
443
-		} catch(PDOException $e) {
443
+		} catch (PDOException $e) {
444 444
 			echo $e->getMessage();
445 445
 			die;
446 446
 		}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 if ($interval == '1m')
490 490
                 {
491 491
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
492
-                } else if ($interval == '15m'){
492
+                } else if ($interval == '15m') {
493 493
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
494 494
                 } 
495 495
             }
@@ -497,14 +497,14 @@  discard block
 block discarded – undo
497 497
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
498 498
         }
499 499
 
500
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
500
+                $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
501 501
                    WHERE spotter_live.latitude <> '' 
502 502
                                    AND spotter_live.longitude <> '' 
503 503
                    ".$additional_query."
504 504
                    HAVING distance < :radius  
505 505
                                    ORDER BY distance";
506 506
 
507
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
507
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
508 508
 
509 509
                 return $spotter_array;
510 510
         }
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 		date_default_timezone_set('UTC');
523 523
 
524 524
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
525
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
525
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
526 526
 
527
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
527
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
528 528
 
529 529
 		return $spotter_array;
530 530
 	}
@@ -535,16 +535,16 @@  discard block
 block discarded – undo
535 535
 	* @return Array the spotter information
536 536
 	*
537 537
 	*/
538
-	public function getDateLiveSpotterDataByIdent($ident,$date)
538
+	public function getDateLiveSpotterDataByIdent($ident, $date)
539 539
 	{
540 540
 		$Spotter = new Spotter($this->db);
541 541
 		date_default_timezone_set('UTC');
542 542
 
543 543
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
544
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
544
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
545 545
 
546
-                $date = date('c',$date);
547
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
546
+                $date = date('c', $date);
547
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
548 548
 
549 549
 		return $spotter_array;
550 550
 	}
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
 		$Spotter = new Spotter($this->db);
561 561
 		date_default_timezone_set('UTC');
562 562
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
563
-		$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
564
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
563
+		$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
564
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
565 565
 		return $spotter_array;
566 566
 	}
567 567
 
@@ -571,15 +571,15 @@  discard block
 block discarded – undo
571 571
 	* @return Array the spotter information
572 572
 	*
573 573
 	*/
574
-	public function getDateLiveSpotterDataById($id,$date)
574
+	public function getDateLiveSpotterDataById($id, $date)
575 575
 	{
576 576
 		$Spotter = new Spotter($this->db);
577 577
 		date_default_timezone_set('UTC');
578 578
 
579 579
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
580
-		$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
581
-		$date = date('c',$date);
582
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
580
+		$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
581
+		$date = date('c', $date);
582
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
583 583
 		return $spotter_array;
584 584
 	}
585 585
 
@@ -595,13 +595,13 @@  discard block
 block discarded – undo
595 595
 		date_default_timezone_set('UTC');
596 596
 
597 597
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
598
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
598
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
599 599
 
600 600
     		try {
601 601
 			
602 602
 			$sth = $this->db->prepare($query);
603 603
 			$sth->execute(array(':ident' => $ident));
604
-		} catch(PDOException $e) {
604
+		} catch (PDOException $e) {
605 605
 			echo $e->getMessage();
606 606
 			die;
607 607
 		}
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 	* @return Array the spotter information
617 617
 	*
618 618
 	*/
619
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
619
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
620 620
 	{
621 621
 		global $globalDBdriver, $globalLiveInterval;
622 622
 		date_default_timezone_set('UTC');
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 		try {
636 636
 			$sth = $this->db->prepare($query);
637 637
 			$sth->execute(array(':id' => $id));
638
-		} catch(PDOException $e) {
638
+		} catch (PDOException $e) {
639 639
 			echo $e->getMessage();
640 640
 			die;
641 641
 		}
@@ -653,12 +653,12 @@  discard block
 block discarded – undo
653 653
 	{
654 654
 		date_default_timezone_set('UTC');
655 655
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
656
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
656
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
657 657
     		try {
658 658
 			
659 659
 			$sth = $this->db->prepare($query);
660 660
 			$sth->execute(array(':ident' => $ident));
661
-		} catch(PDOException $e) {
661
+		} catch (PDOException $e) {
662 662
 			echo $e->getMessage();
663 663
 			die;
664 664
 		}
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 			
689 689
 			$sth = $this->db->prepare($query);
690 690
 			$sth->execute();
691
-		} catch(PDOException $e) {
691
+		} catch (PDOException $e) {
692 692
 			return "error";
693 693
 		}
694 694
 
@@ -711,14 +711,14 @@  discard block
 block discarded – undo
711 711
 				
712 712
 				$sth = $this->db->prepare($query);
713 713
 				$sth->execute();
714
-			} catch(PDOException $e) {
714
+			} catch (PDOException $e) {
715 715
 				return "error";
716 716
 			}
717 717
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
718 718
                         $i = 0;
719
-                        $j =0;
719
+                        $j = 0;
720 720
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
721
-			foreach($all as $row)
721
+			foreach ($all as $row)
722 722
 			{
723 723
 				$i++;
724 724
 				$j++;
@@ -726,9 +726,9 @@  discard block
 block discarded – undo
726 726
 					if ($globalDebug) echo ".";
727 727
 				    	try {
728 728
 						
729
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
729
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
730 730
 						$sth->execute();
731
-					} catch(PDOException $e) {
731
+					} catch (PDOException $e) {
732 732
 						return "error";
733 733
 					}
734 734
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -739,9 +739,9 @@  discard block
 block discarded – undo
739 739
 			if ($i > 0) {
740 740
     				try {
741 741
 					
742
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
742
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
743 743
 					$sth->execute();
744
-				} catch(PDOException $e) {
744
+				} catch (PDOException $e) {
745 745
 					return "error";
746 746
 				}
747 747
 			}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 				
755 755
 				$sth = $this->db->prepare($query);
756 756
 				$sth->execute();
757
-			} catch(PDOException $e) {
757
+			} catch (PDOException $e) {
758 758
 				return "error";
759 759
 			}
760 760
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -802,13 +802,13 @@  discard block
 block discarded – undo
802 802
 	public function deleteLiveSpotterDataByIdent($ident)
803 803
 	{
804 804
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
805
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
805
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
806 806
         
807 807
     		try {
808 808
 			
809 809
 			$sth = $this->db->prepare($query);
810 810
 			$sth->execute(array(':ident' => $ident));
811
-		} catch(PDOException $e) {
811
+		} catch (PDOException $e) {
812 812
 			return "error";
813 813
 		}
814 814
 
@@ -824,13 +824,13 @@  discard block
 block discarded – undo
824 824
 	public function deleteLiveSpotterDataById($id)
825 825
 	{
826 826
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
827
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
827
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
828 828
         
829 829
     		try {
830 830
 			
831 831
 			$sth = $this->db->prepare($query);
832 832
 			$sth->execute(array(':id' => $id));
833
-		} catch(PDOException $e) {
833
+		} catch (PDOException $e) {
834 834
 			return "error";
835 835
 		}
836 836
 
@@ -848,13 +848,13 @@  discard block
 block discarded – undo
848 848
 	{
849 849
 		global $globalDBdriver, $globalTimezone;
850 850
 		if ($globalDBdriver == 'mysql') {
851
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
851
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
852 852
 				WHERE spotter_live.ident = :ident 
853 853
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
854 854
 				AND spotter_live.date < UTC_TIMESTAMP()';
855 855
 			$query_data = array(':ident' => $ident);
856 856
 		} else {
857
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
857
+			$query = "SELECT spotter_live.ident FROM spotter_live 
858 858
 				WHERE spotter_live.ident = :ident 
859 859
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
860 860
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
 		
864 864
 		$sth = $this->db->prepare($query);
865 865
 		$sth->execute($query_data);
866
-		$ident_result='';
867
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
866
+		$ident_result = '';
867
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
868 868
 		{
869 869
 			$ident_result = $row['ident'];
870 870
 		}
@@ -881,13 +881,13 @@  discard block
 block discarded – undo
881 881
 	{
882 882
 		global $globalDBdriver, $globalTimezone;
883 883
 		if ($globalDBdriver == 'mysql') {
884
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
884
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
885 885
 				WHERE spotter_live.ident = :ident 
886 886
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
887 887
 //				AND spotter_live.date < UTC_TIMESTAMP()";
888 888
 			$query_data = array(':ident' => $ident);
889 889
 		} else {
890
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
890
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
891 891
 				WHERE spotter_live.ident = :ident 
892 892
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'";
893 893
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -896,8 +896,8 @@  discard block
 block discarded – undo
896 896
 		
897 897
 		$sth = $this->db->prepare($query);
898 898
 		$sth->execute($query_data);
899
-		$ident_result='';
900
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
899
+		$ident_result = '';
900
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
901 901
 		{
902 902
 			$ident_result = $row['flightaware_id'];
903 903
 		}
@@ -914,13 +914,13 @@  discard block
 block discarded – undo
914 914
 	{
915 915
 		global $globalDBdriver, $globalTimezone;
916 916
 		if ($globalDBdriver == 'mysql') {
917
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
917
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
918 918
 				WHERE spotter_live.flightaware_id = :id 
919 919
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
920 920
 //				AND spotter_live.date < UTC_TIMESTAMP()";
921 921
 			$query_data = array(':id' => $id);
922 922
 		} else {
923
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
923
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
924 924
 				WHERE spotter_live.flightaware_id = :id 
925 925
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
926 926
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
 		
930 930
 		$sth = $this->db->prepare($query);
931 931
 		$sth->execute($query_data);
932
-		$ident_result='';
933
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
932
+		$ident_result = '';
933
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
934 934
 		{
935 935
 			$ident_result = $row['flightaware_id'];
936 936
 		}
@@ -947,13 +947,13 @@  discard block
 block discarded – undo
947 947
 	{
948 948
 		global $globalDBdriver, $globalTimezone;
949 949
 		if ($globalDBdriver == 'mysql') {
950
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
950
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
951 951
 				WHERE spotter_live.ModeS = :modes 
952 952
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
953 953
 //				AND spotter_live.date < UTC_TIMESTAMP()";
954 954
 			$query_data = array(':modes' => $modes);
955 955
 		} else {
956
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
956
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
957 957
 				WHERE spotter_live.ModeS = :modes 
958 958
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'";
959 959
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 		
963 963
 		$sth = $this->db->prepare($query);
964 964
 		$sth->execute($query_data);
965
-		$ident_result='';
966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
965
+		$ident_result = '';
966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
967 967
 		{
968 968
 			//$ident_result = $row['spotter_live_id'];
969 969
 			$ident_result = $row['flightaware_id'];
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
 				return array();
989 989
 			} else {
990 990
 				$q_array = explode(" ", $q);
991
-				foreach ($q_array as $q_item){
992
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
991
+				foreach ($q_array as $q_item) {
992
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
993 993
 					$additional_query .= " AND (";
994 994
 					$additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR ";
995 995
 					$additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR ";
@@ -1004,11 +1004,11 @@  discard block
 block discarded – undo
1004 1004
 			}
1005 1005
 		}
1006 1006
 		if ($globalDBdriver == 'mysql') {
1007
-			$query  = "SELECT spotter_live.* FROM spotter_live 
1007
+			$query = "SELECT spotter_live.* FROM spotter_live 
1008 1008
 			    WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
1009 1009
 			    AND spotter_live.date < UTC_TIMESTAMP()";
1010 1010
 		} else {
1011
-			$query  = "SELECT spotter_live.* FROM spotter_live 
1011
+			$query = "SELECT spotter_live.* FROM spotter_live 
1012 1012
 			    WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
1013 1013
 			    AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
1014 1014
 		}
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 	* @return String success or false
1029 1029
 	*
1030 1030
 	*/
1031
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
1031
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
1032 1032
 	{
1033 1033
 		global $globalURL, $globalArchive, $globalDebug;
1034 1034
 		$Common = new Common();
@@ -1128,27 +1128,27 @@  discard block
 block discarded – undo
1128 1128
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
1129 1129
 
1130 1130
         
1131
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
1132
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1133
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
1134
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1135
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1136
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1137
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1138
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
1139
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1140
-		$altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1141
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
1142
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1143
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
1144
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
1145
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
1146
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
1147
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
1148
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
1149
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
1150
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
1151
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
1131
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
1132
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1133
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
1134
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1135
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1136
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1137
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1138
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
1139
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1140
+		$altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1141
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
1142
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1143
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
1144
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
1145
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
1146
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
1147
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
1148
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
1149
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
1150
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
1151
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
1152 1152
 
1153 1153
 		$airline_name = '';
1154 1154
 		$airline_icao = '';
@@ -1170,10 +1170,10 @@  discard block
 block discarded – undo
1170 1170
 		$arrival_airport_country = '';
1171 1171
 		
1172 1172
             	
1173
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1174
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1175
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1176
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1173
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
1174
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
1175
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1176
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1177 1177
 		
1178 1178
 		$query = '';
1179 1179
 		if ($globalArchive) {
@@ -1184,19 +1184,19 @@  discard block
 block discarded – undo
1184 1184
 		$query  .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) 
1185 1185
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)';
1186 1186
 
1187
-		$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real);
1187
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real);
1188 1188
 		try {
1189 1189
 			
1190 1190
 			$sth = $this->db->prepare($query);
1191 1191
 			$sth->execute($query_values);
1192 1192
 			$sth->closeCursor();
1193
-		} catch(PDOException $e) {
1193
+		} catch (PDOException $e) {
1194 1194
 			return "error : ".$e->getMessage();
1195 1195
 		}
1196 1196
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1197 1197
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1198 1198
 		    $SpotterArchive = new SpotterArchive($this->db);
1199
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1199
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
1200 1200
 		    if ($globalDebug) echo $result.')';
1201 1201
 		} elseif ($globalDebug && $putinarchive !== true) {
1202 1202
 			echo '(Not adding to archive)';
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 	public function getOrderBy()
1211 1211
 	{
1212
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1212
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1213 1213
 		return $orderby;
1214 1214
 	}
1215 1215
 
Please login to merge, or discard this patch.
Braces   +143 added lines, -48 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 	public function __construct($dbc = null) {
9 9
 		$Connection = new Connection($dbc);
10 10
 		$this->db = $Connection->db();
11
-		if ($this->db === null) die('Error: No DB connection. (SpotterLive)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (SpotterLive)');
13
+		}
12 14
 	}
13 15
 
14 16
 
@@ -30,7 +32,9 @@  discard block
 block discarded – undo
30 32
 		if (isset($filter[0]['source'])) {
31 33
 			$filters = array_merge($filters,$filter);
32 34
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) {
36
+			$filter = array_merge($filter,$globalFilter);
37
+		}
34 38
 		$filter_query_join = '';
35 39
 		$filter_query_where = '';
36 40
 		foreach($filters as $flt) {
@@ -126,8 +130,11 @@  discard block
 block discarded – undo
126 130
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
127 131
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
128 132
 		}
129
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
130
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
133
+		if ($filter_query_where == '' && $where) {
134
+			$filter_query_where = ' WHERE';
135
+		} elseif ($filter_query_where != '' && $and) {
136
+			$filter_query_where .= ' AND';
137
+		}
131 138
 		if ($filter_query_where != '') {
132 139
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
133 140
 		}
@@ -168,9 +175,13 @@  discard block
 block discarded – undo
168 175
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
169 176
 			}
170 177
 		}
171
-		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
178
+		if ($orderby_query == '') {
179
+			$orderby_query = ' ORDER BY date DESC';
180
+		}
172 181
 
173
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
182
+		if (!isset($globalLiveInterval)) {
183
+			$globalLiveInterval = '200';
184
+		}
174 185
 		if ($globalDBdriver == 'mysql') {
175 186
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
176 187
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -193,7 +204,9 @@  discard block
 block discarded – undo
193 204
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
194 205
 		date_default_timezone_set('UTC');
195 206
 		$filter_query = $this->getFilter($filter,true,true);
196
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
207
+		if (!isset($globalLiveInterval)) {
208
+			$globalLiveInterval = '200';
209
+		}
197 210
 		if ($globalDBdriver == 'mysql') {
198 211
 			if (isset($globalArchive) && $globalArchive === TRUE) {
199 212
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
@@ -244,8 +257,12 @@  discard block
 block discarded – undo
244 257
 		$id = filter_var($id,FILTER_SANITIZE_STRING);
245 258
 		$filter_query = $this->getFilter($filter,true,true);
246 259
 
247
-		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
248
-		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
260
+		if (!isset($globalLiveInterval) || $globalLiveInterval == '') {
261
+			$globalLiveInterval = '200';
262
+		}
263
+		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') {
264
+			$globalMap3DAircraftsLimit = '300';
265
+		}
249 266
 		if ($globalDBdriver == 'mysql') {
250 267
 			if (isset($globalArchive) && $globalArchive === TRUE) {
251 268
 				/*
@@ -256,25 +273,41 @@  discard block
 block discarded – undo
256 273
 				*/
257 274
 				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
258 275
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
259
-				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
260
-				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
276
+				if ($usecoord) {
277
+					$query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
278
+				}
279
+				if ($id != '') {
280
+					$query .= "OR spotter_archive.flightaware_id = :id ";
281
+				}
261 282
 				$query .= "UNION
262 283
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
263 284
 				FROM spotter_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date";
264
-				if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
265
-				if ($id != '') $query .= " OR spotter_live.flightaware_id = :id";
285
+				if ($usecoord) {
286
+					$query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
287
+				}
288
+				if ($id != '') {
289
+					$query .= " OR spotter_live.flightaware_id = :id";
290
+				}
266 291
 				$query .= ") AS spotter 
267 292
 				WHERE latitude <> '0' AND longitude <> '0' 
268 293
 				ORDER BY flightaware_id, date";
269
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
294
+				if ($limit) {
295
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
296
+				}
270 297
 			} else {
271 298
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
272 299
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date ";
273
-				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
274
-				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
300
+				if ($usecoord) {
301
+					$query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
302
+				}
303
+				if ($id != '') {
304
+					$query .= "OR spotter_live.flightaware_id = :id ";
305
+				}
275 306
 				$query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
276 307
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
277
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
308
+				if ($limit) {
309
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
310
+				}
278 311
 			}
279 312
 		} else {
280 313
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -286,28 +319,46 @@  discard block
 block discarded – undo
286 319
                                */
287 320
 				$query  = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
288 321
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
289
-				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
290
-				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
322
+				if ($usecoord) {
323
+					$query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
324
+				}
325
+				if ($id != '') {
326
+					$query .= "OR spotter_archive.flightaware_id = :id ";
327
+				}
291 328
 				$query .= "UNION
292 329
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
293 330
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date";
294
-				if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
295
-				if ($id != '') $query .= " OR spotter_live.flightaware_id = :id";
331
+				if ($usecoord) {
332
+					$query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
333
+				}
334
+				if ($id != '') {
335
+					$query .= " OR spotter_live.flightaware_id = :id";
336
+				}
296 337
 				$query .= ") AS spotter WHERE latitude <> '0' AND longitude <> '0' ";
297 338
 				$query .= "ORDER BY flightaware_id, date";
298
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
339
+				if ($limit) {
340
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
341
+				}
299 342
 			} else {
300 343
 				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
301 344
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date ";
302
-				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
303
-				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
345
+				if ($usecoord) {
346
+					$query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
347
+				}
348
+				if ($id != '') {
349
+					$query .= "OR spotter_live.flightaware_id = :id ";
350
+				}
304 351
 				$query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
305 352
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
306
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
353
+				if ($limit) {
354
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
355
+				}
307 356
 			}
308 357
 		}
309 358
 		$query_values = array();
310
-		if ($id != '') $query_values = array(':id' => $id);
359
+		if ($id != '') {
360
+			$query_values = array(':id' => $id);
361
+		}
311 362
 		try {
312 363
 			$sth = $this->db->prepare($query);
313 364
 			$sth->execute($query_values);
@@ -330,7 +381,9 @@  discard block
 block discarded – undo
330 381
 		global $globalDBdriver, $globalLiveInterval;
331 382
 		$filter_query = $this->getFilter($filter,true,true);
332 383
 
333
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
384
+		if (!isset($globalLiveInterval)) {
385
+			$globalLiveInterval = '200';
386
+		}
334 387
 		if ($globalDBdriver == 'mysql') {
335 388
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
336 389
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -360,7 +413,9 @@  discard block
 block discarded – undo
360 413
 	{
361 414
 		global $globalDBdriver, $globalLiveInterval;
362 415
 		$Spotter = new Spotter($this->db);
363
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
416
+		if (!isset($globalLiveInterval)) {
417
+			$globalLiveInterval = '200';
418
+		}
364 419
 		$filter_query = $this->getFilter($filter);
365 420
 
366 421
 		if (is_array($coord)) {
@@ -368,7 +423,9 @@  discard block
 block discarded – undo
368 423
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
369 424
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
370 425
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
371
-		} else return array();
426
+		} else {
427
+			return array();
428
+		}
372 429
 		if ($globalDBdriver == 'mysql') {
373 430
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
374 431
 		} else {
@@ -389,7 +446,9 @@  discard block
 block discarded – undo
389 446
 	{
390 447
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
391 448
 		$Spotter = new Spotter($this->db);
392
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
449
+		if (!isset($globalLiveInterval)) {
450
+			$globalLiveInterval = '200';
451
+		}
393 452
 		$filter_query = $this->getFilter($filter,true,true);
394 453
 
395 454
 		if (is_array($coord)) {
@@ -397,7 +456,9 @@  discard block
 block discarded – undo
397 456
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
398 457
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
399 458
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
400
-		} else return array();
459
+		} else {
460
+			return array();
461
+		}
401 462
 		if ($globalDBdriver == 'mysql') {
402 463
 			if (isset($globalArchive) && $globalArchive === TRUE) {
403 464
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
@@ -624,11 +685,15 @@  discard block
 block discarded – undo
624 685
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
625 686
 		if ($globalDBdriver == 'mysql') {
626 687
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
627
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
688
+			if ($liveinterval) {
689
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
690
+			}
628 691
 			$query .= ' ORDER BY date';
629 692
 		} else {
630 693
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
631
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
694
+			if ($liveinterval) {
695
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
696
+			}
632 697
 			$query .= ' ORDER BY date';
633 698
 		}
634 699
 
@@ -723,7 +788,9 @@  discard block
 block discarded – undo
723 788
 				$i++;
724 789
 				$j++;
725 790
 				if ($j == 30) {
726
-					if ($globalDebug) echo ".";
791
+					if ($globalDebug) {
792
+						echo ".";
793
+					}
727 794
 				    	try {
728 795
 						
729 796
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -1076,7 +1143,9 @@  discard block
 block discarded – undo
1076 1143
 			{
1077 1144
 				return false;
1078 1145
 			}
1079
-		} else return '';
1146
+		} else {
1147
+			return '';
1148
+		}
1080 1149
 
1081 1150
 		if ($longitude != '')
1082 1151
 		{
@@ -1084,7 +1153,9 @@  discard block
 block discarded – undo
1084 1153
 			{
1085 1154
 				return false;
1086 1155
 			}
1087
-		} else return '';
1156
+		} else {
1157
+			return '';
1158
+		}
1088 1159
 
1089 1160
 		if ($waypoints != '')
1090 1161
 		{
@@ -1100,14 +1171,18 @@  discard block
 block discarded – undo
1100 1171
 			{
1101 1172
 				return false;
1102 1173
 			}
1103
-		} else $altitude = 0;
1174
+		} else {
1175
+			$altitude = 0;
1176
+		}
1104 1177
 		if ($altitude_real != '')
1105 1178
 		{
1106 1179
 			if (!is_numeric($altitude_real))
1107 1180
 			{
1108 1181
 				return false;
1109 1182
 			}
1110
-		} else $altitude_real = 0;
1183
+		} else {
1184
+			$altitude_real = 0;
1185
+		}
1111 1186
 
1112 1187
 		if ($heading != '')
1113 1188
 		{
@@ -1115,7 +1190,9 @@  discard block
 block discarded – undo
1115 1190
 			{
1116 1191
 				return false;
1117 1192
 			}
1118
-		} else $heading = 0;
1193
+		} else {
1194
+			$heading = 0;
1195
+		}
1119 1196
 
1120 1197
 		if ($groundspeed != '')
1121 1198
 		{
@@ -1123,9 +1200,13 @@  discard block
 block discarded – undo
1123 1200
 			{
1124 1201
 				return false;
1125 1202
 			}
1126
-		} else $groundspeed = 0;
1203
+		} else {
1204
+			$groundspeed = 0;
1205
+		}
1127 1206
 		date_default_timezone_set('UTC');
1128
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1207
+		if ($date == '') {
1208
+			$date = date("Y-m-d H:i:s", time());
1209
+		}
1129 1210
 
1130 1211
         
1131 1212
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -1170,14 +1251,24 @@  discard block
 block discarded – undo
1170 1251
 		$arrival_airport_country = '';
1171 1252
 		
1172 1253
             	
1173
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1174
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1175
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1176
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1254
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
1255
+            		$squawk = NULL;
1256
+            	}
1257
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
1258
+            		$verticalrate = NULL;
1259
+            	}
1260
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1261
+            		$groundspeed = 0;
1262
+            	}
1263
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1264
+            		$heading = 0;
1265
+            	}
1177 1266
 		
1178 1267
 		$query = '';
1179 1268
 		if ($globalArchive) {
1180
-			if ($globalDebug) echo '-- Delete previous data -- ';
1269
+			if ($globalDebug) {
1270
+				echo '-- Delete previous data -- ';
1271
+			}
1181 1272
 			$query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;';
1182 1273
 		}
1183 1274
 
@@ -1194,10 +1285,14 @@  discard block
 block discarded – undo
1194 1285
 			return "error : ".$e->getMessage();
1195 1286
 		}
1196 1287
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1197
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1288
+		    if ($globalDebug) {
1289
+		    	echo '(Add to SBS archive : ';
1290
+		    }
1198 1291
 		    $SpotterArchive = new SpotterArchive($this->db);
1199 1292
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1200
-		    if ($globalDebug) echo $result.')';
1293
+		    if ($globalDebug) {
1294
+		    	echo $result.')';
1295
+		    }
1201 1296
 		} elseif ($globalDebug && $putinarchive !== true) {
1202 1297
 			echo '(Not adding to archive)';
1203 1298
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.
require/class.MarineLive.php 2 patches
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30 30
 		if (isset($filter[0]['source'])) {
31
-			$filters = array_merge($filters,$filter);
31
+			$filters = array_merge($filters, $filter);
32 32
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
34 34
 		$filter_query_join = '';
35 35
 		$filter_query_where = '';
36
-		foreach($filters as $flt) {
36
+		foreach ($filters as $flt) {
37 37
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
38 38
 				if (isset($flt['source'])) {
39
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
39
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
40 40
 				} else {
41
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
41
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
42 42
 				}
43 43
 			}
44 44
 		}
45 45
 		if (isset($filter['source']) && !empty($filter['source'])) {
46
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
46
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
47 47
 		}
48 48
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
49 49
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 					$filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'";
79 79
 				}
80 80
 			}
81
-			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id";
81
+			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id";
82 82
 		}
83 83
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
84
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
84
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
85 85
 		}
86 86
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
87 87
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
88 88
 		if ($filter_query_where != '') {
89
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
89
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
90 90
 		}
91 91
 		$filter_query = $filter_query_join.$filter_query_where;
92 92
 		return $filter_query;
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 		if ($limit != '')
110 110
 		{
111 111
 			$limit_array = explode(',', $limit);
112
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
113
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
112
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
113
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
114 114
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
115 115
 			{
116 116
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
126 126
 			}
127 127
 		}
128
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
128
+		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
129 129
 
130 130
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
131 131
 		if ($globalDBdriver == 'mysql') {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		} else {
135 135
 			$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query;
136 136
 		}
137
-		$spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true);
137
+		$spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true);
138 138
 
139 139
 		return $spotter_array;
140 140
 	}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		global $globalDBdriver, $globalLiveInterval;
151 151
 		date_default_timezone_set('UTC');
152 152
 
153
-		$filter_query = $this->getFilter($filter,true,true);
153
+		$filter_query = $this->getFilter($filter, true, true);
154 154
 
155 155
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
156 156
 		if ($globalDBdriver == 'mysql') {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		try {
165 165
 			$sth = $this->db->prepare($query);
166 166
 			$sth->execute();
167
-		} catch(PDOException $e) {
167
+		} catch (PDOException $e) {
168 168
 			echo $e->getMessage();
169 169
 			die;
170 170
 		}
@@ -179,19 +179,19 @@  discard block
 block discarded – undo
179 179
 	* @return Array the spotter information
180 180
 	*
181 181
 	*/
182
-	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false)
182
+	public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false)
183 183
 	{
184 184
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
185 185
 		date_default_timezone_set('UTC');
186 186
 		$usecoord = false;
187 187
 		if (is_array($coord) && !empty($coord)) {
188
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
189
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
190
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
191
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
188
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
189
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
190
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
191
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
192 192
 			$usecoord = true;
193 193
 		}
194
-		$filter_query = $this->getFilter($filter,true,true);
194
+		$filter_query = $this->getFilter($filter, true, true);
195 195
 
196 196
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
197 197
 		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		try {
241 241
 			$sth = $this->db->prepare($query);
242 242
 			$sth->execute();
243
-		} catch(PDOException $e) {
243
+		} catch (PDOException $e) {
244 244
 			echo $e->getMessage();
245 245
 			die;
246 246
 		}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	public function getLiveMarineCount($filter = array())
258 258
 	{
259 259
 		global $globalDBdriver, $globalLiveInterval;
260
-		$filter_query = $this->getFilter($filter,true,true);
260
+		$filter_query = $this->getFilter($filter, true, true);
261 261
 
262 262
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
263 263
 		if ($globalDBdriver == 'mysql') {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 		try {
269 269
 			$sth = $this->db->prepare($query);
270 270
 			$sth->execute();
271
-		} catch(PDOException $e) {
271
+		} catch (PDOException $e) {
272 272
 			echo $e->getMessage();
273 273
 			die;
274 274
 		}
@@ -291,10 +291,10 @@  discard block
 block discarded – undo
291 291
 		$filter_query = $this->getFilter($filter);
292 292
 
293 293
 		if (is_array($coord)) {
294
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
295
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
296
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
297
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
294
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
295
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
296
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
297
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
298 298
 		} else return array();
299 299
 		if ($globalDBdriver == 'mysql') {
300 300
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query;
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
317 317
 		$Marine = new Marine($this->db);
318 318
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
319
-		$filter_query = $this->getFilter($filter,true,true);
319
+		$filter_query = $this->getFilter($filter, true, true);
320 320
 
321 321
 		if (is_array($coord)) {
322
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
323
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
324
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
325
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
322
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
323
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
324
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
325
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
326 326
 		} else return array();
327 327
 		/*
328 328
 		if ($globalDBdriver == 'mysql') {
@@ -337,13 +337,13 @@  discard block
 block discarded – undo
337 337
 		*/
338 338
 		if ($globalDBdriver == 'mysql') {
339 339
 			if (isset($globalArchive) && $globalArchive === TRUE) {
340
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
340
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
341 341
 				    FROM marine_live 
342 342
 				    '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date 
343 343
 				    AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
344 344
 				    AND marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY date DESC';
345 345
 			} else {
346
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
346
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
347 347
 				    FROM marine_live 
348 348
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
349 349
 				    FROM marine_live l 
@@ -355,14 +355,14 @@  discard block
 block discarded – undo
355 355
 			}
356 356
 		} else {
357 357
 			if (isset($globalArchive) && $globalArchive === TRUE) {
358
-				$query  = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
358
+				$query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
359 359
 				    FROM marine_live 
360 360
 				    ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date 
361 361
 				    AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
362 362
 				    AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
363 363
 				    AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' ORDER BY date DESC";
364 364
 			} else {
365
-				$query  = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
365
+				$query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
366 366
 				    FROM marine_live 
367 367
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
368 368
 				    FROM marine_live l 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
                 if ($interval == '1m')
420 420
                 {
421 421
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
422
-                } else if ($interval == '15m'){
422
+                } else if ($interval == '15m') {
423 423
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
424 424
                 } 
425 425
             }
@@ -427,14 +427,14 @@  discard block
 block discarded – undo
427 427
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
428 428
         }
429 429
 
430
-                $query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
430
+                $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
431 431
                    WHERE marine_live.latitude <> '' 
432 432
                                    AND marine_live.longitude <> '' 
433 433
                    ".$additional_query."
434 434
                    HAVING distance < :radius  
435 435
                                    ORDER BY distance";
436 436
 
437
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
437
+                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
438 438
 
439 439
                 return $spotter_array;
440 440
         }
@@ -452,9 +452,9 @@  discard block
 block discarded – undo
452 452
 		date_default_timezone_set('UTC');
453 453
 
454 454
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
455
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
455
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
456 456
 
457
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
457
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true);
458 458
 
459 459
 		return $spotter_array;
460 460
 	}
@@ -465,14 +465,14 @@  discard block
 block discarded – undo
465 465
 	* @return Array the spotter information
466 466
 	*
467 467
 	*/
468
-	public function getDateLiveMarineDataByIdent($ident,$date)
468
+	public function getDateLiveMarineDataByIdent($ident, $date)
469 469
 	{
470 470
 		$Marine = new Marine($this->db);
471 471
 		date_default_timezone_set('UTC');
472 472
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
473 473
 		$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
474
-		$date = date('c',$date);
475
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
474
+		$date = date('c', $date);
475
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
476 476
 		return $spotter_array;
477 477
 	}
478 478
 
@@ -482,14 +482,14 @@  discard block
 block discarded – undo
482 482
 	* @return Array the spotter information
483 483
 	*
484 484
 	*/
485
-	public function getDateLiveMarineDataByMMSI($mmsi,$date)
485
+	public function getDateLiveMarineDataByMMSI($mmsi, $date)
486 486
 	{
487 487
 		$Marine = new Marine($this->db);
488 488
 		date_default_timezone_set('UTC');
489 489
 		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
490 490
 		$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
491
-		$date = date('c',$date);
492
-		$spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date));
491
+		$date = date('c', $date);
492
+		$spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date));
493 493
 		return $spotter_array;
494 494
 	}
495 495
 
@@ -505,9 +505,9 @@  discard block
 block discarded – undo
505 505
 		date_default_timezone_set('UTC');
506 506
 
507 507
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
508
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
508
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
509 509
 
510
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
510
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true);
511 511
 
512 512
 		return $spotter_array;
513 513
 	}
@@ -518,15 +518,15 @@  discard block
 block discarded – undo
518 518
 	* @return Array the spotter information
519 519
 	*
520 520
 	*/
521
-	public function getDateLiveMarineDataById($id,$date)
521
+	public function getDateLiveMarineDataById($id, $date)
522 522
 	{
523 523
 		$Marine = new Marine($this->db);
524 524
 		date_default_timezone_set('UTC');
525 525
 
526 526
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
527
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
528
-                $date = date('c',$date);
529
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
527
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
528
+                $date = date('c', $date);
529
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
530 530
 
531 531
 		return $spotter_array;
532 532
 	}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	* @return Array the spotter information
539 539
 	*
540 540
 	*/
541
-	public function getAllLiveMarineDataById($id,$liveinterval = false)
541
+	public function getAllLiveMarineDataById($id, $liveinterval = false)
542 542
 	{
543 543
 		global $globalDBdriver, $globalLiveInterval;
544 544
 		date_default_timezone_set('UTC');
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		try {
558 558
 			$sth = $this->db->prepare($query);
559 559
 			$sth->execute(array(':id' => $id));
560
-		} catch(PDOException $e) {
560
+		} catch (PDOException $e) {
561 561
 			echo $e->getMessage();
562 562
 			die;
563 563
 		}
@@ -575,12 +575,12 @@  discard block
 block discarded – undo
575 575
 	{
576 576
 		date_default_timezone_set('UTC');
577 577
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
578
-		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
578
+		$query = self::$global_query.' WHERE marine_live.ident = :ident';
579 579
     		try {
580 580
 			
581 581
 			$sth = $this->db->prepare($query);
582 582
 			$sth->execute(array(':ident' => $ident));
583
-		} catch(PDOException $e) {
583
+		} catch (PDOException $e) {
584 584
 			echo $e->getMessage();
585 585
 			die;
586 586
 		}
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 			
611 611
 			$sth = $this->db->prepare($query);
612 612
 			$sth->execute();
613
-		} catch(PDOException $e) {
613
+		} catch (PDOException $e) {
614 614
 			return "error";
615 615
 		}
616 616
 
@@ -633,14 +633,14 @@  discard block
 block discarded – undo
633 633
 				
634 634
 				$sth = $this->db->prepare($query);
635 635
 				$sth->execute();
636
-			} catch(PDOException $e) {
636
+			} catch (PDOException $e) {
637 637
 				return "error";
638 638
 			}
639 639
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
640 640
                         $i = 0;
641
-                        $j =0;
641
+                        $j = 0;
642 642
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
643
-			foreach($all as $row)
643
+			foreach ($all as $row)
644 644
 			{
645 645
 				$i++;
646 646
 				$j++;
@@ -648,9 +648,9 @@  discard block
 block discarded – undo
648 648
 					if ($globalDebug) echo ".";
649 649
 				    	try {
650 650
 						
651
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
651
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
652 652
 						$sth->execute();
653
-					} catch(PDOException $e) {
653
+					} catch (PDOException $e) {
654 654
 						return "error";
655 655
 					}
656 656
                                 	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
@@ -661,9 +661,9 @@  discard block
 block discarded – undo
661 661
 			if ($i > 0) {
662 662
     				try {
663 663
 					
664
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
664
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
665 665
 					$sth->execute();
666
-				} catch(PDOException $e) {
666
+				} catch (PDOException $e) {
667 667
 					return "error";
668 668
 				}
669 669
 			}
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 				
677 677
 				$sth = $this->db->prepare($query);
678 678
 				$sth->execute();
679
-			} catch(PDOException $e) {
679
+			} catch (PDOException $e) {
680 680
 				return "error";
681 681
 			}
682 682
 /*			$query_delete = "DELETE FROM marine_live WHERE fammarine_id IN (";
@@ -724,13 +724,13 @@  discard block
 block discarded – undo
724 724
 	public function deleteLiveMarineDataByIdent($ident)
725 725
 	{
726 726
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
727
-		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
727
+		$query = 'DELETE FROM marine_live WHERE ident = :ident';
728 728
         
729 729
     		try {
730 730
 			
731 731
 			$sth = $this->db->prepare($query);
732 732
 			$sth->execute(array(':ident' => $ident));
733
-		} catch(PDOException $e) {
733
+		} catch (PDOException $e) {
734 734
 			return "error";
735 735
 		}
736 736
 
@@ -746,13 +746,13 @@  discard block
 block discarded – undo
746 746
 	public function deleteLiveMarineDataById($id)
747 747
 	{
748 748
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
749
-		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
749
+		$query = 'DELETE FROM marine_live WHERE fammarine_id = :id';
750 750
         
751 751
     		try {
752 752
 			
753 753
 			$sth = $this->db->prepare($query);
754 754
 			$sth->execute(array(':id' => $id));
755
-		} catch(PDOException $e) {
755
+		} catch (PDOException $e) {
756 756
 			return "error";
757 757
 		}
758 758
 
@@ -770,13 +770,13 @@  discard block
 block discarded – undo
770 770
 	{
771 771
 		global $globalDBdriver, $globalTimezone;
772 772
 		if ($globalDBdriver == 'mysql') {
773
-			$query  = 'SELECT marine_live.ident FROM marine_live 
773
+			$query = 'SELECT marine_live.ident FROM marine_live 
774 774
 				WHERE marine_live.ident = :ident 
775 775
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
776 776
 				AND marine_live.date < UTC_TIMESTAMP()';
777 777
 			$query_data = array(':ident' => $ident);
778 778
 		} else {
779
-			$query  = "SELECT marine_live.ident FROM marine_live 
779
+			$query = "SELECT marine_live.ident FROM marine_live 
780 780
 				WHERE marine_live.ident = :ident 
781 781
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
782 782
 				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -785,8 +785,8 @@  discard block
 block discarded – undo
785 785
 		
786 786
 		$sth = $this->db->prepare($query);
787 787
 		$sth->execute($query_data);
788
-		$ident_result='';
789
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
788
+		$ident_result = '';
789
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
790 790
 		{
791 791
 			$ident_result = $row['ident'];
792 792
 		}
@@ -803,13 +803,13 @@  discard block
 block discarded – undo
803 803
 	{
804 804
 		global $globalDBdriver, $globalTimezone;
805 805
 		if ($globalDBdriver == 'mysql') {
806
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
806
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
807 807
 				WHERE marine_live.ident = :ident 
808 808
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
809 809
 //				AND marine_live.date < UTC_TIMESTAMP()";
810 810
 			$query_data = array(':ident' => $ident);
811 811
 		} else {
812
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
812
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
813 813
 				WHERE marine_live.ident = :ident 
814 814
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
815 815
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -818,8 +818,8 @@  discard block
 block discarded – undo
818 818
 		
819 819
 		$sth = $this->db->prepare($query);
820 820
 		$sth->execute($query_data);
821
-		$ident_result='';
822
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
821
+		$ident_result = '';
822
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
823 823
 		{
824 824
 			$ident_result = $row['fammarine_id'];
825 825
 		}
@@ -836,13 +836,13 @@  discard block
 block discarded – undo
836 836
 	{
837 837
 		global $globalDBdriver, $globalTimezone;
838 838
 		if ($globalDBdriver == 'mysql') {
839
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
839
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
840 840
 				WHERE marine_live.fammarine_id = :id 
841 841
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
842 842
 //				AND marine_live.date < UTC_TIMESTAMP()";
843 843
 			$query_data = array(':id' => $id);
844 844
 		} else {
845
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
845
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
846 846
 				WHERE marine_live.fammarine_id = :id 
847 847
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
848 848
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -851,8 +851,8 @@  discard block
 block discarded – undo
851 851
 		
852 852
 		$sth = $this->db->prepare($query);
853 853
 		$sth->execute($query_data);
854
-		$ident_result='';
855
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
854
+		$ident_result = '';
855
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
856 856
 		{
857 857
 			$ident_result = $row['fammarine_id'];
858 858
 		}
@@ -869,13 +869,13 @@  discard block
 block discarded – undo
869 869
 	{
870 870
 		global $globalDBdriver, $globalTimezone;
871 871
 		if ($globalDBdriver == 'mysql') {
872
-			$query  = 'SELECT marine_live.fammarine_id FROM marine_live 
872
+			$query = 'SELECT marine_live.fammarine_id FROM marine_live 
873 873
 				WHERE marine_live.mmsi = :mmsi 
874 874
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
875 875
 //				AND marine_live.date < UTC_TIMESTAMP()";
876 876
 			$query_data = array(':mmsi' => $mmsi);
877 877
 		} else {
878
-			$query  = "SELECT marine_live.fammarine_id FROM marine_live 
878
+			$query = "SELECT marine_live.fammarine_id FROM marine_live 
879 879
 				WHERE marine_live.mmsi = :mmsi 
880 880
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
881 881
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -884,8 +884,8 @@  discard block
 block discarded – undo
884 884
 		
885 885
 		$sth = $this->db->prepare($query);
886 886
 		$sth->execute($query_data);
887
-		$ident_result='';
888
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
887
+		$ident_result = '';
888
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
889 889
 		{
890 890
 			$ident_result = $row['fammarine_id'];
891 891
 		}
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 	* @return String success or false
904 904
 	*
905 905
 	*/
906
-	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
906
+	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '')
907 907
 	{
908 908
 		global $globalURL, $globalArchive, $globalDebug;
909 909
 		$Common = new Common();
@@ -955,29 +955,29 @@  discard block
 block discarded – undo
955 955
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
956 956
 
957 957
         
958
-		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
959
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
960
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
961
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
962
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
963
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
964
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
965
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
966
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
967
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
968
-		$typeid = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT);
969
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
970
-		$status = filter_var($status,FILTER_SANITIZE_STRING);
971
-		$statusid = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT);
972
-		$imo = filter_var($imo,FILTER_SANITIZE_STRING);
973
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
974
-		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
975
-		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
958
+		$fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING);
959
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
960
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
961
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
962
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
963
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
964
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
965
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
966
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
967
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
968
+		$typeid = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT);
969
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
970
+		$status = filter_var($status, FILTER_SANITIZE_STRING);
971
+		$statusid = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT);
972
+		$imo = filter_var($imo, FILTER_SANITIZE_STRING);
973
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
974
+		$arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING);
975
+		$arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING);
976 976
 		if ($typeid == '') $typeid = NULL;
977 977
 		if ($statusid == '') $statusid = NULL;
978 978
 
979
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
980
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
979
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
980
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
981 981
             	if ($arrival_date == '') $arrival_date = NULL;
982 982
             	$query = '';
983 983
 		if ($globalArchive) {
@@ -986,19 +986,19 @@  discard block
 block discarded – undo
986 986
 		}
987 987
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date) 
988 988
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:typeid,:status,:statusid,:imo,:arrival_port_name,:arrival_port_date)';
989
-		$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':typeid' => $typeid,':status' => $status,':statusid' => $statusid,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date);
989
+		$query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':typeid' => $typeid, ':status' => $status, ':statusid' => $statusid, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date);
990 990
 		try {
991 991
 			$sth = $this->db->prepare($query);
992 992
 			$sth->execute($query_values);
993 993
 			$sth->closeCursor();
994
-		} catch(PDOException $e) {
994
+		} catch (PDOException $e) {
995 995
 			return "error : ".$e->getMessage();
996 996
 		}
997 997
 		
998 998
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
999 999
 			if ($globalDebug) echo '(Add to Marine archive : ';
1000 1000
 			$MarineArchive = new MarineArchive($this->db);
1001
-			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country);
1001
+			$result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country);
1002 1002
 			if ($globalDebug) echo $result.')';
1003 1003
 		}
1004 1004
 		return "success";
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 
1007 1007
 	public function getOrderBy()
1008 1008
 	{
1009
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC"));
1009
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC"));
1010 1010
 		return $orderby;
1011 1011
 	}
1012 1012
 
Please login to merge, or discard this patch.
Braces   +119 added lines, -40 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 	public function __construct($dbc = null) {
9 9
 		$Connection = new Connection($dbc);
10 10
 		$this->db = $Connection->db();
11
-		if ($this->db === null) die('Error: No DB connection. (MarineLive)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (MarineLive)');
13
+		}
12 14
 	}
13 15
 
14 16
 
@@ -30,7 +32,9 @@  discard block
 block discarded – undo
30 32
 		if (isset($filter[0]['source'])) {
31 33
 			$filters = array_merge($filters,$filter);
32 34
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) {
36
+			$filter = array_merge($filter,$globalFilter);
37
+		}
34 38
 		$filter_query_join = '';
35 39
 		$filter_query_where = '';
36 40
 		foreach($filters as $flt) {
@@ -83,8 +87,11 @@  discard block
 block discarded – undo
83 87
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
84 88
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
85 89
 		}
86
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
87
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
90
+		if ($filter_query_where == '' && $where) {
91
+			$filter_query_where = ' WHERE';
92
+		} elseif ($filter_query_where != '' && $and) {
93
+			$filter_query_where .= ' AND';
94
+		}
88 95
 		if ($filter_query_where != '') {
89 96
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
90 97
 		}
@@ -125,9 +132,13 @@  discard block
 block discarded – undo
125 132
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
126 133
 			}
127 134
 		}
128
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
135
+		if ($orderby_query == '') {
136
+			$orderby_query= ' ORDER BY date DESC';
137
+		}
129 138
 
130
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
139
+		if (!isset($globalLiveInterval)) {
140
+			$globalLiveInterval = '200';
141
+		}
131 142
 		if ($globalDBdriver == 'mysql') {
132 143
 			//$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate";
133 144
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -152,7 +163,9 @@  discard block
 block discarded – undo
152 163
 
153 164
 		$filter_query = $this->getFilter($filter,true,true);
154 165
 
155
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
166
+		if (!isset($globalLiveInterval)) {
167
+			$globalLiveInterval = '200';
168
+		}
156 169
 		if ($globalDBdriver == 'mysql') {
157 170
 			$query  = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
158 171
 			FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0";
@@ -193,48 +206,72 @@  discard block
 block discarded – undo
193 206
 		}
194 207
 		$filter_query = $this->getFilter($filter,true,true);
195 208
 
196
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
197
-		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
209
+		if (!isset($globalLiveInterval)) {
210
+			$globalLiveInterval = '200';
211
+		}
212
+		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') {
213
+			$globalMap3DMarinesLimit = '300';
214
+		}
198 215
 		if ($globalDBdriver == 'mysql') {
199 216
 			if (isset($globalArchive) && $globalArchive === TRUE) {
200 217
 				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source 
201 218
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
202
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
219
+				if ($usecoord) {
220
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
221
+				}
203 222
 				$query .= "UNION
204 223
 				    SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
205 224
 				    FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date";
206
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
225
+				if ($usecoord) {
226
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
227
+				}
207 228
 				$query .= ") AS marine 
208 229
 				    WHERE latitude <> '0' AND longitude <> '0' 
209 230
 				    ORDER BY fammarine_id, date";
210
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
231
+				if ($limit) {
232
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
233
+				}
211 234
 			} else {
212 235
 				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
213 236
 				    FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date ";
214
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
237
+				if ($usecoord) {
238
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
239
+				}
215 240
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
216 241
 				ORDER BY marine_live.fammarine_id, marine_live.date";
217
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
242
+				if ($limit) {
243
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
244
+				}
218 245
 			}
219 246
 		} else {
220 247
 			if (isset($globalArchive) && $globalArchive === TRUE) {
221 248
 				$query  = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source 
222 249
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
223
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
250
+				if ($usecoord) {
251
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
252
+				}
224 253
 				$query .= "UNION
225 254
 				    SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
226 255
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date";
227
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
256
+				if ($usecoord) {
257
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
258
+				}
228 259
 				$query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' ";
229 260
 				$query .= "ORDER BY fammarine_id, date";
230
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
261
+				if ($limit) {
262
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
263
+				}
231 264
 			} else {
232 265
 				$query  = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
233 266
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date ";
234
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
267
+				if ($usecoord) {
268
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
269
+				}
235 270
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
236 271
 				ORDER BY marine_live.fammarine_id, marine_live.date";
237
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
272
+				if ($limit) {
273
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
274
+				}
238 275
 			}
239 276
 		}
240 277
 		try {
@@ -259,7 +296,9 @@  discard block
 block discarded – undo
259 296
 		global $globalDBdriver, $globalLiveInterval;
260 297
 		$filter_query = $this->getFilter($filter,true,true);
261 298
 
262
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
299
+		if (!isset($globalLiveInterval)) {
300
+			$globalLiveInterval = '200';
301
+		}
263 302
 		if ($globalDBdriver == 'mysql') {
264 303
 			$query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
265 304
 		} else {
@@ -287,7 +326,9 @@  discard block
 block discarded – undo
287 326
 	{
288 327
 		global $globalDBdriver, $globalLiveInterval;
289 328
 		$Marine = new Marine($this->db);
290
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
329
+		if (!isset($globalLiveInterval)) {
330
+			$globalLiveInterval = '200';
331
+		}
291 332
 		$filter_query = $this->getFilter($filter);
292 333
 
293 334
 		if (is_array($coord)) {
@@ -295,7 +336,9 @@  discard block
 block discarded – undo
295 336
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
296 337
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
297 338
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
298
-		} else return array();
339
+		} else {
340
+			return array();
341
+		}
299 342
 		if ($globalDBdriver == 'mysql') {
300 343
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query;
301 344
 		} else {
@@ -315,7 +358,9 @@  discard block
 block discarded – undo
315 358
 	{
316 359
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
317 360
 		$Marine = new Marine($this->db);
318
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
361
+		if (!isset($globalLiveInterval)) {
362
+			$globalLiveInterval = '200';
363
+		}
319 364
 		$filter_query = $this->getFilter($filter,true,true);
320 365
 
321 366
 		if (is_array($coord)) {
@@ -323,7 +368,9 @@  discard block
 block discarded – undo
323 368
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
324 369
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
325 370
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
326
-		} else return array();
371
+		} else {
372
+			return array();
373
+		}
327 374
 		/*
328 375
 		if ($globalDBdriver == 'mysql') {
329 376
 			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
@@ -546,11 +593,15 @@  discard block
 block discarded – undo
546 593
 		//$query  = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date';
547 594
 		if ($globalDBdriver == 'mysql') {
548 595
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
549
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
596
+			if ($liveinterval) {
597
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
598
+			}
550 599
 			$query .= ' ORDER BY date';
551 600
 		} else {
552 601
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
553
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
602
+			if ($liveinterval) {
603
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
604
+			}
554 605
 			$query .= ' ORDER BY date';
555 606
 		}
556 607
 
@@ -645,7 +696,9 @@  discard block
 block discarded – undo
645 696
 				$i++;
646 697
 				$j++;
647 698
 				if ($j == 30) {
648
-					if ($globalDebug) echo ".";
699
+					if ($globalDebug) {
700
+						echo ".";
701
+					}
649 702
 				    	try {
650 703
 						
651 704
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -925,7 +978,9 @@  discard block
 block discarded – undo
925 978
 			{
926 979
 				return false;
927 980
 			}
928
-		} else return '';
981
+		} else {
982
+			return '';
983
+		}
929 984
 
930 985
 		if ($longitude != '')
931 986
 		{
@@ -933,7 +988,9 @@  discard block
 block discarded – undo
933 988
 			{
934 989
 				return false;
935 990
 			}
936
-		} else return '';
991
+		} else {
992
+			return '';
993
+		}
937 994
 
938 995
 
939 996
 		if ($heading != '')
@@ -942,7 +999,9 @@  discard block
 block discarded – undo
942 999
 			{
943 1000
 				return false;
944 1001
 			}
945
-		} else $heading = 0;
1002
+		} else {
1003
+			$heading = 0;
1004
+		}
946 1005
 
947 1006
 		if ($groundspeed != '')
948 1007
 		{
@@ -950,9 +1009,13 @@  discard block
 block discarded – undo
950 1009
 			{
951 1010
 				return false;
952 1011
 			}
953
-		} else $groundspeed = 0;
1012
+		} else {
1013
+			$groundspeed = 0;
1014
+		}
954 1015
 		date_default_timezone_set('UTC');
955
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1016
+		if ($date == '') {
1017
+			$date = date("Y-m-d H:i:s", time());
1018
+		}
956 1019
 
957 1020
         
958 1021
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -973,15 +1036,27 @@  discard block
 block discarded – undo
973 1036
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
974 1037
 		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
975 1038
 		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
976
-		if ($typeid == '') $typeid = NULL;
977
-		if ($statusid == '') $statusid = NULL;
1039
+		if ($typeid == '') {
1040
+			$typeid = NULL;
1041
+		}
1042
+		if ($statusid == '') {
1043
+			$statusid = NULL;
1044
+		}
978 1045
 
979
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
980
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
981
-            	if ($arrival_date == '') $arrival_date = NULL;
1046
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1047
+            		$groundspeed = 0;
1048
+            	}
1049
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1050
+            		$heading = 0;
1051
+            	}
1052
+            	if ($arrival_date == '') {
1053
+            		$arrival_date = NULL;
1054
+            	}
982 1055
             	$query = '';
983 1056
 		if ($globalArchive) {
984
-			if ($globalDebug) echo '-- Delete previous data -- ';
1057
+			if ($globalDebug) {
1058
+				echo '-- Delete previous data -- ';
1059
+			}
985 1060
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
986 1061
 		}
987 1062
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date) 
@@ -996,10 +1071,14 @@  discard block
 block discarded – undo
996 1071
 		}
997 1072
 		
998 1073
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
999
-			if ($globalDebug) echo '(Add to Marine archive : ';
1074
+			if ($globalDebug) {
1075
+				echo '(Add to Marine archive : ';
1076
+			}
1000 1077
 			$MarineArchive = new MarineArchive($this->db);
1001 1078
 			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country);
1002
-			if ($globalDebug) echo $result.')';
1079
+			if ($globalDebug) {
1080
+				echo $result.')';
1081
+			}
1003 1082
 		}
1004 1083
 		return "success";
1005 1084
 	}
Please login to merge, or discard this patch.